Common plugin files for WP7+8 using preprocessor + defines
Project: http://git-wip-us.apache.org/repos/asf/cordova-wp8/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp8/commit/99747fac Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp8/tree/99747fac Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp8/diff/99747fac Branch: refs/heads/master Commit: 99747fac7b2d4fa2c1ed9395251685e696f84c2a Parents: 2274413 Author: Jesse MacFadyen <[email protected]> Authored: Wed Jun 19 01:29:14 2013 -0700 Committer: Jesse MacFadyen <[email protected]> Committed: Wed Jun 19 01:29:14 2013 -0700 ---------------------------------------------------------------------- common/Plugins/InAppBrowser.cs | 12 ++++++++++-- common/Plugins/Notification.cs | 12 +++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/99747fac/common/Plugins/InAppBrowser.cs ---------------------------------------------------------------------- diff --git a/common/Plugins/InAppBrowser.cs b/common/Plugins/InAppBrowser.cs index 2741355..f261013 100644 --- a/common/Plugins/InAppBrowser.cs +++ b/common/Plugins/InAppBrowser.cs @@ -176,8 +176,11 @@ namespace WPCordovaClassLib.Cordova.Commands { try { +#if WP8 browser.GoForward(); - //browser.InvokeScript("execScript", "history.forward();"); +#else + browser.InvokeScript("execScript", "history.forward();"); +#endif } catch (Exception) { @@ -192,8 +195,11 @@ namespace WPCordovaClassLib.Cordova.Commands { try { +#if WP8 browser.GoBack(); - //browser.InvokeScript("execScript", "history.back();"); +#else + browser.InvokeScript("execScript", "history.back();"); +#endif } catch (Exception) { @@ -239,12 +245,14 @@ namespace WPCordovaClassLib.Cordova.Commands void browser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e) { +#if WP8 if (browser != null) { backButton.IsEnabled = browser.CanGoBack; fwdButton.IsEnabled = browser.CanGoForward; } +#endif string message = "{\"type\":\"loadstop\", \"url\":\"" + e.Uri.AbsoluteUri + "\"}"; PluginResult result = new PluginResult(PluginResult.Status.OK, message); result.KeepCallback = true; http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/99747fac/common/Plugins/Notification.cs ---------------------------------------------------------------------- diff --git a/common/Plugins/Notification.cs b/common/Plugins/Notification.cs index 0759c72..6d4b93b 100644 --- a/common/Plugins/Notification.cs +++ b/common/Plugins/Notification.cs @@ -34,6 +34,12 @@ namespace WPCordovaClassLib.Cordova.Commands private NotificationBox notifyBox; + private class NotifBoxData + { + public NotificationBox previous; + public string callbackId; + } + private PhoneApplicationPage Page { get @@ -186,7 +192,7 @@ namespace WPCordovaClassLib.Cordova.Commands if (grid != null) { grid.Children.Remove(notifyBox); - dynamic notifBoxData = notifyBox.Tag; + NotifBoxData notifBoxData = notifyBox.Tag as NotifBoxData; notifyBox = notifBoxData.previous as NotificationBox; callbackId = notifBoxData.callbackId as string; } @@ -224,8 +230,8 @@ namespace WPCordovaClassLib.Cordova.Commands { grid.Children.Remove(notifBoxParent); } - - dynamic notifBoxData = notifBoxParent.Tag; + + NotifBoxData notifBoxData = notifBoxParent.Tag as NotifBoxData; notifyBox = notifBoxData.previous as NotificationBox; callbackId = notifBoxData.callbackId as string;
