Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cordova-plugin-local-notifications
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nabil Sadki
cordova-plugin-local-notifications
Commits
759ff1de
Commit
759ff1de
authored
Jan 05, 2018
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add (de)serializer for every (windows)
parent
8bbeabf0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
135 additions
and
4 deletions
+135
-4
Every.cs
...y/LocalNotificationProxy/LocalNotification/Toast/Every.cs
+120
-0
Trigger.cs
...LocalNotificationProxy/LocalNotification/Toast/Trigger.cs
+15
-4
No files found.
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Toast/Every.cs
View file @
759ff1de
...
...
@@ -21,6 +21,9 @@
namespace
LocalNotificationProxy.LocalNotification.Toast
{
using
System
;
using
Windows.Data.Xml.Dom
;
public
sealed
class
Every
{
/// <summary>
...
...
@@ -72,5 +75,122 @@ namespace LocalNotificationProxy.LocalNotification.Toast
/// Gets or sets the year.
/// </summary>
public
int
?
Year
{
get
;
set
;
}
/// <summary>
/// Deserializes the XML string into an instance of Every.
/// </summary>
/// <param name="xml">The serialized instance of Options as an xml string.</param>
/// <returns>An instance where all properties have been assigned.</returns>
internal
static
Every
Parse
(
string
xml
)
{
var
doc
=
new
XmlDocument
();
doc
.
LoadXml
(
xml
);
var
every
=
new
Every
();
var
node
=
doc
.
DocumentElement
;
if
(
node
.
GetAttributeNode
(
"minute"
)
!=
null
)
{
every
.
Minute
=
Convert
.
ToInt32
(
node
.
GetAttribute
(
"minute"
));
}
if
(
node
.
GetAttributeNode
(
"hour"
)
!=
null
)
{
every
.
Hour
=
Convert
.
ToInt32
(
node
.
GetAttribute
(
"hour"
));
}
if
(
node
.
GetAttributeNode
(
"day"
)
!=
null
)
{
every
.
Day
=
Convert
.
ToInt32
(
node
.
GetAttribute
(
"day"
));
}
if
(
node
.
GetAttributeNode
(
"weekday"
)
!=
null
)
{
every
.
Weekday
=
Convert
.
ToInt32
(
node
.
GetAttribute
(
"weekday"
));
}
if
(
node
.
GetAttributeNode
(
"week"
)
!=
null
)
{
every
.
Week
=
Convert
.
ToInt32
(
node
.
GetAttribute
(
"week"
));
}
if
(
node
.
GetAttributeNode
(
"weekdayordinal"
)
!=
null
)
{
every
.
WeekdayOrdinal
=
Convert
.
ToInt32
(
node
.
GetAttribute
(
"weekdayOrdinal"
));
}
if
(
node
.
GetAttributeNode
(
"weekOfMonth"
)
!=
null
)
{
every
.
WeekOfMonth
=
Convert
.
ToInt32
(
node
.
GetAttribute
(
"weekOfMonth"
));
}
if
(
node
.
GetAttributeNode
(
"month"
)
!=
null
)
{
every
.
Month
=
Convert
.
ToInt32
(
node
.
GetAttribute
(
"month"
));
}
if
(
node
.
GetAttributeNode
(
"year"
)
!=
null
)
{
every
.
Year
=
Convert
.
ToInt32
(
node
.
GetAttribute
(
"year"
));
}
return
every
;
}
/// <summary>
/// Gets the instance as an serialized xml element.
/// </summary>
/// <returns>Element with all property values set as attributes.</returns>
internal
string
GetXml
()
{
var
node
=
new
XmlDocument
().
CreateElement
(
"every"
);
if
(
this
.
Minute
.
HasValue
)
{
node
.
SetAttribute
(
"minute"
,
this
.
Minute
.
ToString
());
}
if
(
this
.
Hour
.
HasValue
)
{
node
.
SetAttribute
(
"hour"
,
this
.
Hour
.
ToString
());
}
if
(
this
.
Day
.
HasValue
)
{
node
.
SetAttribute
(
"day"
,
this
.
Day
.
ToString
());
}
if
(
this
.
Weekday
.
HasValue
)
{
node
.
SetAttribute
(
"weekday"
,
this
.
Weekday
.
ToString
());
}
if
(
this
.
Week
.
HasValue
)
{
node
.
SetAttribute
(
"week"
,
this
.
Week
.
ToString
());
}
if
(
this
.
WeekdayOrdinal
.
HasValue
)
{
node
.
SetAttribute
(
"weekdayOrdinal"
,
this
.
WeekdayOrdinal
.
ToString
());
}
if
(
this
.
WeekOfMonth
.
HasValue
)
{
node
.
SetAttribute
(
"weekOfMonth"
,
this
.
WeekOfMonth
.
ToString
());
}
if
(
this
.
Month
.
HasValue
)
{
node
.
SetAttribute
(
"month"
,
this
.
Month
.
ToString
());
}
if
(
this
.
Year
.
HasValue
)
{
node
.
SetAttribute
(
"year"
,
this
.
Year
.
ToString
());
}
return
node
.
GetXml
();
}
}
}
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Toast/Trigger.cs
View file @
759ff1de
...
...
@@ -97,9 +97,13 @@ namespace LocalNotificationProxy.LocalNotification.Toast
trigger
.
Unit
=
node
.
GetAttribute
(
"unit"
);
}
if
(
node
.
GetAttributeNode
(
"
e
very"
)
!=
null
)
if
(
node
.
GetAttributeNode
(
"
strE
very"
)
!=
null
)
{
trigger
.
Every
=
node
.
GetAttribute
(
"every"
);
trigger
.
Every
=
node
.
GetAttribute
(
"strEvery"
);
}
else
if
(
node
.
GetAttributeNode
(
"hshEvery"
)
!=
null
)
{
trigger
.
Every
=
Toast
.
Every
.
Parse
(
node
.
GetAttribute
(
"hshEvery"
));
}
return
trigger
;
...
...
@@ -125,9 +129,16 @@ namespace LocalNotificationProxy.LocalNotification.Toast
node
.
SetAttribute
(
"unit"
,
this
.
Unit
);
}
if
(
this
.
Every
!=
null
&&
!(
this
.
Every
is
Every
)
)
if
(
this
.
Every
!=
null
)
{
node
.
SetAttribute
(
"every"
,
this
.
Every
.
ToString
());
if
(
this
.
Every
is
Every
)
{
node
.
SetAttribute
(
"hshEvery"
,
(
this
.
Every
as
Every
).
GetXml
());
}
else
{
node
.
SetAttribute
(
"strEvery"
,
this
.
Every
.
ToString
());
}
}
return
node
.
GetXml
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment