merge issues, wp7+8 differ on this command
diff --git a/templates/standalone/Plugins/InAppBrowser.cs b/templates/standalone/Plugins/InAppBrowser.cs
index 92835e5..62928cd 100644
--- a/templates/standalone/Plugins/InAppBrowser.cs
+++ b/templates/standalone/Plugins/InAppBrowser.cs
@@ -42,20 +42,20 @@
//BrowserOptions opts = JSON.JsonHelper.Deserialize<BrowserOptions>(options);
string urlLoc = args[0];
string target = args[1];
-/*
- _self - opens in the Cordova WebView if url is in the white-list, else it opens in the InAppBrowser
- _blank - always open in the InAppBrowser
- _system - always open in the system web browser
-*/
- switch (target)
+ /*
+ _self - opens in the Cordova WebView if url is in the white-list, else it opens in the InAppBrowser
+ _blank - always open in the InAppBrowser
+ _system - always open in the system web browser
+ */
+ switch (target)
{
- case "_blank" :
+ case "_blank":
ShowInAppBrowser(urlLoc);
break;
- case "_self" :
+ case "_self":
ShowCordovaBrowser(urlLoc);
break;
- case "_system" :
+ case "_system":
ShowSystemBrowser(urlLoc);
break;
}
@@ -65,7 +65,7 @@
private void ShowCordovaBrowser(string url)
{
- Uri loc = new Uri(url,UriKind.RelativeOrAbsolute);
+ Uri loc = new Uri(url, UriKind.RelativeOrAbsolute);
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
@@ -75,7 +75,7 @@
if (page != null)
{
CordovaView cView = page.FindName("CordovaView") as CordovaView;
- if(cView != null)
+ if (cView != null)
{
WebBrowser br = cView.Browser;
br.Navigate(loc);
@@ -94,7 +94,6 @@
}
- // Display an inderminate progress indicator
private void ShowInAppBrowser(string url)
{
Uri loc = new Uri(url);
@@ -113,6 +112,8 @@
{
PhoneApplicationPage page = frame.Content as PhoneApplicationPage;
+ string baseImageUrl = "Images/";
+
if (page != null)
{
Grid grid = page.FindName("LayoutRoot") as Grid;
@@ -120,7 +121,6 @@
{
browser = new WebBrowser();
browser.IsScriptEnabled = true;
-
browser.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(browser_LoadCompleted);
@@ -138,22 +138,23 @@
backButton = new ApplicationBarIconButton();
backButton.Text = "Back";
- backButton.IconUri = new Uri("/Images/appbar.back.rest.png", UriKind.Relative);
+
+ backButton.IconUri = new Uri(baseImageUrl + "appbar.back.rest.png", UriKind.Relative);
backButton.Click += new EventHandler(backButton_Click);
- //backButton.IsEnabled = false;
+ backButton.IsEnabled = false;
bar.Buttons.Add(backButton);
fwdButton = new ApplicationBarIconButton();
fwdButton.Text = "Forward";
- fwdButton.IconUri = new Uri("/Images/appbar.next.rest.png", UriKind.Relative);
+ fwdButton.IconUri = new Uri(baseImageUrl + "appbar.next.rest.png", UriKind.Relative);
fwdButton.Click += new EventHandler(fwdButton_Click);
- //fwdButton.IsEnabled = false;
+ fwdButton.IsEnabled = false;
bar.Buttons.Add(fwdButton);
ApplicationBarIconButton closeBtn = new ApplicationBarIconButton();
closeBtn.Text = "Close";
- closeBtn.IconUri = new Uri("/Images/appbar.close.rest.png", UriKind.Relative);
+ closeBtn.IconUri = new Uri(baseImageUrl + "appbar.close.rest.png", UriKind.Relative);
closeBtn.Click += new EventHandler(closeBtn_Click);
bar.Buttons.Add(closeBtn);
@@ -167,7 +168,7 @@
void browser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
-
+
}
void fwdButton_Click(object sender, EventArgs e)
@@ -176,10 +177,10 @@
{
try
{
- //browser.GoForward();
- browser.InvokeScript("execScript", "history.forward();");
+ browser.GoForward();
+ //browser.InvokeScript("execScript", "history.forward();");
}
- catch(Exception)
+ catch (Exception)
{
}
@@ -192,8 +193,8 @@
{
try
{
- //browser.GoBack();
- browser.InvokeScript("execScript", "history.back();");
+ browser.GoBack();
+ //browser.InvokeScript("execScript", "history.back();");
}
catch (Exception)
{
@@ -208,7 +209,7 @@
}
- public void close(string options="")
+ public void close(string options = "")
{
if (browser != null)
{
@@ -239,11 +240,12 @@
void browser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
- //if (browser != null)
- //{
- // backButton.IsEnabled = browser.CanGoBack;
- // fwdButton.IsEnabled = browser.CanGoForward;
- //}
+ if (browser != null)
+ {
+ backButton.IsEnabled = browser.CanGoBack;
+ fwdButton.IsEnabled = browser.CanGoForward;
+
+ }
string message = "{\"type\":\"loadstop\", \"url\":\"" + e.Uri.AbsoluteUri + "\"}";
PluginResult result = new PluginResult(PluginResult.Status.OK, message);
result.KeepCallback = true;