Loading plugin.xml +1 −0 Changes for plugin.xml: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ <config-file target="config.xml" parent="/*"> <feature name="LocalNotification"> <param name="wp-package" value="LocalNotification"/> <param name="wp-package" value="LocalNotificationOptions"/> </feature> </config-file> Loading src/wp8/LocalNotification.cs +81 −0 Changes for src/wp8/LocalNotification.cs: 81 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -16,10 +16,91 @@ using WPCordovaClassLib.Cordova; using WPCordovaClassLib.Cordova.Commands; using WPCordovaClassLib.Cordova.JSON; using De.APPPlant.Cordova.Plugin.LocalNotification; namespace Cordova.Extension.Commands { /// <summary> /// Implementes access to application live tiles /// http://msdn.microsoft.com/en-us/library/hh202948(v=VS.92).aspx /// </summary> public class LocalNotification : BaseCommand { /// <summary> /// Sets application live tile /// </summary> public void add (string jsonArgs) { string[] args = JsonHelper.Deserialize<string[]>(jsonArgs); LocalNotificationOptions options = JsonHelper.Deserialize<LocalNotificationOptions>(args[0]); // Application Tile is always the first Tile, even if it is not pinned to Start. ShellTile AppTile = ShellTile.ActiveTiles.First(); if (AppTile != null) { // Set the properties to update for the Application Tile // Empty strings for the text values and URIs will result in the property being cleared. StandardTileData TileData = CreateTileData(options); // Update the Application Tile AppTile.Update(TileData); } DispatchCommandResult(); } /// <summary> /// Clears the application live tile /// </summary> public void cancel (string jsonArgs) { cancelAll(jsonArgs); } /// <summary> /// Clears the application live tile /// </summary> public void cancelAll (string jsonArgs) { // Application Tile is always the first Tile, even if it is not pinned to Start. ShellTile AppTile = ShellTile.ActiveTiles.First(); if (AppTile != null) { // Set the properties to update for the Application Tile // Empty strings for the text values and URIs will result in the property being cleared. StandardTileData TileData = new StandardTileData { Title = "", BackTitle = "", BackContent = "" }; // Update the Application Tile AppTile.Update(TileData); } DispatchCommandResult(); } /// <summary> /// Creates tile data /// </summary> private StandardTileData CreateTileData (LocalNotificationOptions options) { StandardTileData tile = new StandardTileData(); // Badge sollte nur gelöscht werden, wenn expliziet eine `0` angegeben wurde if (options.Badge != 0) { tile.Count = options.Badge; } tile.BackTitle = options.Title; tile.Title = options.Title; tile.BackContent = options.Message; return tile; } } } src/wp8/LocalNotificationOptions.cs 0 → 100644 +59 −0 Changes for src/wp8/LocalNotificationOptions.cs: 59 added lines, 0 removed lines. Original line number Diff line number Diff line using System.Runtime.Serialization; namespace De.APPPlant.Cordova.Plugin.LocalNotification { /// <summary> /// Represents LiveTile options /// </summary> [DataContract] class LocalNotificationOptions { /// <summary> /// The Title that is displayed /// </summary> [DataMember(IsRequired = false, Name = "title")] public string Title { get; set; } /// <summary> /// The message that is displayed /// </summary> [DataMember(IsRequired = false, Name = "message")] public string Message { get; set; } /// <summary> /// Displays number badge to notification /// </summary> [DataMember(IsRequired = false, Name = "badge")] public int Badge { get; set; } /// <summary> /// Tile count /// </summary> [DataMember(IsRequired = false, Name = "Date")] public int Date { get; set; } /// <summary> /// Has the options of daily', 'weekly',''monthly','yearly') /// </summary> [DataMember(IsRequired = false, Name = "repeat")] public string Repeat { get; set; } /// <summary> /// Message-ID /// </summary> [DataMember(IsRequired = false, Name = "id")] public string ID { get; set; } /// <summary> /// A javascript function to be called if the app is in the background /// </summary> [DataMember(IsRequired = false, Name = "background")] public string Background { get; set; } /// <summary> /// A javascript function to be called if the app is running /// </summary> [DataMember(IsRequired = false, Name = "foreground")] public string Foreground { get; set; } } } Loading
plugin.xml +1 −0 Changes for plugin.xml: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ <config-file target="config.xml" parent="/*"> <feature name="LocalNotification"> <param name="wp-package" value="LocalNotification"/> <param name="wp-package" value="LocalNotificationOptions"/> </feature> </config-file> Loading
src/wp8/LocalNotification.cs +81 −0 Changes for src/wp8/LocalNotification.cs: 81 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -16,10 +16,91 @@ using WPCordovaClassLib.Cordova; using WPCordovaClassLib.Cordova.Commands; using WPCordovaClassLib.Cordova.JSON; using De.APPPlant.Cordova.Plugin.LocalNotification; namespace Cordova.Extension.Commands { /// <summary> /// Implementes access to application live tiles /// http://msdn.microsoft.com/en-us/library/hh202948(v=VS.92).aspx /// </summary> public class LocalNotification : BaseCommand { /// <summary> /// Sets application live tile /// </summary> public void add (string jsonArgs) { string[] args = JsonHelper.Deserialize<string[]>(jsonArgs); LocalNotificationOptions options = JsonHelper.Deserialize<LocalNotificationOptions>(args[0]); // Application Tile is always the first Tile, even if it is not pinned to Start. ShellTile AppTile = ShellTile.ActiveTiles.First(); if (AppTile != null) { // Set the properties to update for the Application Tile // Empty strings for the text values and URIs will result in the property being cleared. StandardTileData TileData = CreateTileData(options); // Update the Application Tile AppTile.Update(TileData); } DispatchCommandResult(); } /// <summary> /// Clears the application live tile /// </summary> public void cancel (string jsonArgs) { cancelAll(jsonArgs); } /// <summary> /// Clears the application live tile /// </summary> public void cancelAll (string jsonArgs) { // Application Tile is always the first Tile, even if it is not pinned to Start. ShellTile AppTile = ShellTile.ActiveTiles.First(); if (AppTile != null) { // Set the properties to update for the Application Tile // Empty strings for the text values and URIs will result in the property being cleared. StandardTileData TileData = new StandardTileData { Title = "", BackTitle = "", BackContent = "" }; // Update the Application Tile AppTile.Update(TileData); } DispatchCommandResult(); } /// <summary> /// Creates tile data /// </summary> private StandardTileData CreateTileData (LocalNotificationOptions options) { StandardTileData tile = new StandardTileData(); // Badge sollte nur gelöscht werden, wenn expliziet eine `0` angegeben wurde if (options.Badge != 0) { tile.Count = options.Badge; } tile.BackTitle = options.Title; tile.Title = options.Title; tile.BackContent = options.Message; return tile; } } }
src/wp8/LocalNotificationOptions.cs 0 → 100644 +59 −0 Changes for src/wp8/LocalNotificationOptions.cs: 59 added lines, 0 removed lines. Original line number Diff line number Diff line using System.Runtime.Serialization; namespace De.APPPlant.Cordova.Plugin.LocalNotification { /// <summary> /// Represents LiveTile options /// </summary> [DataContract] class LocalNotificationOptions { /// <summary> /// The Title that is displayed /// </summary> [DataMember(IsRequired = false, Name = "title")] public string Title { get; set; } /// <summary> /// The message that is displayed /// </summary> [DataMember(IsRequired = false, Name = "message")] public string Message { get; set; } /// <summary> /// Displays number badge to notification /// </summary> [DataMember(IsRequired = false, Name = "badge")] public int Badge { get; set; } /// <summary> /// Tile count /// </summary> [DataMember(IsRequired = false, Name = "Date")] public int Date { get; set; } /// <summary> /// Has the options of daily', 'weekly',''monthly','yearly') /// </summary> [DataMember(IsRequired = false, Name = "repeat")] public string Repeat { get; set; } /// <summary> /// Message-ID /// </summary> [DataMember(IsRequired = false, Name = "id")] public string ID { get; set; } /// <summary> /// A javascript function to be called if the app is in the background /// </summary> [DataMember(IsRequired = false, Name = "background")] public string Background { get; set; } /// <summary> /// A javascript function to be called if the app is running /// </summary> [DataMember(IsRequired = false, Name = "foreground")] public string Foreground { get; set; } } }