Commit 906f256f by Sebastián Katzer

WP8 support for the new callback interface as good as possible

parent e72f497d
......@@ -54,15 +54,10 @@ namespace Cordova.Extension.Commands
// Empty strings for the text values and URIs will result in the property being cleared.
FlipTileData TileData = CreateTileData(options);
// Update the Application Tile
AppTile.Update(TileData);
if (!string.IsNullOrEmpty(options.Foreground))
{
string arguments = String.Format("{0}({1})", options.Foreground, options.ID);
DispatchCommandResult(new PluginResult(PluginResult.Status.OK, arguments));
}
FireEvent("trigger", options.ID, options.JSON);
FireEvent("add", options.ID, options.JSON);
}
DispatchCommandResult();
......@@ -73,7 +68,12 @@ namespace Cordova.Extension.Commands
/// </summary>
public void cancel(string jsonArgs)
{
string[] args = JsonHelper.Deserialize<string[]>(jsonArgs);
string notificationID = args[0];
cancelAll(jsonArgs);
FireEvent("cancel", notificationID, "");
}
/// <summary>
......@@ -139,5 +139,21 @@ namespace Cordova.Extension.Commands
return tile;
}
/// <summary>
/// Fires the given event.
/// </summary>
private void FireEvent (string Event, string Id, string JSON = "")
{
string state = "foreground";
string args = String.Format("\'{0}\',\'{1}\',\'{2}\'", Id, state, JSON);
string js = String.Format("window.plugin.notification.local.on{0}({1})", Event, args);
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, js);
pluginResult.KeepCallback = true;
DispatchCommandResult(pluginResult);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment