Permalink
Browse files

More Cleanup, removed ChildBrowser as it is a plugin and not part of …

…the core
  • Loading branch information...
1 parent 59c9544 commit 08ad47781eb36e4ac8c9f9eb8b482ed8e3566084 @purplecabbage purplecabbage committed Oct 20, 2011
@@ -1,198 +0,0 @@
-using System;
-using System.Net;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Shapes;
-using Microsoft.Phone.Controls;
-using System.Diagnostics;
-using System.Runtime.Serialization;
-using WP7GapClassLib.PhoneGap.UI;
-using Microsoft.Phone.Shell;
-
-namespace WP7GapClassLib.PhoneGap.Commands
-{
- [DataContract]
- public class BrowserOptions
- {
- [DataMember]
- public string url;
-
- [DataMember]
- public bool isGeolocationEnabled;
- }
-
- public class ChildBrowserCommand : BaseCommand
- {
-
- private static WebBrowser browser;
- private static ApplicationBarIconButton backButton;
- private static ApplicationBarIconButton fwdButton;
-
- // Display an inderminate progress indicator
- public void showWebPage(string options)
- {
- BrowserOptions opts = JSON.JsonHelper.Deserialize<BrowserOptions>(options);
-
- Uri loc = new Uri(opts.url);
-
- Deployment.Current.Dispatcher.BeginInvoke(() =>
- {
- if (browser != null)
- {
- browser.IsGeolocationEnabled = opts.isGeolocationEnabled;
- browser.Navigate(loc);
- }
- else
- {
- PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
- if (frame != null)
- {
- PhoneApplicationPage page = frame.Content as PhoneApplicationPage;
- if (page != null)
- {
- Grid grid = page.FindName("LayoutRoot") as Grid;
- if (grid != null)
- {
- browser = new WebBrowser();
- browser.Navigate(loc);
-
- browser.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(browser_LoadCompleted);
-
- browser.Navigating += new EventHandler<NavigatingEventArgs>(browser_Navigating);
- browser.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(browser_NavigationFailed);
- browser.Navigated += new EventHandler<System.Windows.Navigation.NavigationEventArgs>(browser_Navigated);
- browser.IsScriptEnabled = true;
- browser.IsGeolocationEnabled = opts.isGeolocationEnabled;
- grid.Children.Add(browser);
- }
-
- ApplicationBar bar = new ApplicationBar();
- bar.BackgroundColor = Colors.Black;
- bar.IsMenuEnabled = false;
-
- backButton = new ApplicationBarIconButton();
- backButton.Text = "Back";
- backButton.IconUri = new Uri("/Images/appbar.back.rest.png", UriKind.Relative);
- backButton.Click += new EventHandler(backButton_Click);
- 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.Click += new EventHandler(fwdButton_Click);
- 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.Click += new EventHandler(closeBtn_Click);
- bar.Buttons.Add(closeBtn);
-
- page.ApplicationBar = bar;
- }
-
- }
- }
- });
- }
-
- void browser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
- {
-
- }
-
- void fwdButton_Click(object sender, EventArgs e)
- {
- if (browser != null)
- {
- try
- {
- browser.InvokeScript("execScript", "history.forward();");
- }
- catch(Exception)
- {
-
- }
- }
- }
-
- void backButton_Click(object sender, EventArgs e)
- {
- if (browser != null)
- {
- try
- {
- browser.InvokeScript("execScript", "history.back();");
- }
- catch (Exception)
- {
-
- }
- }
- }
-
- void closeBtn_Click(object sender, EventArgs e)
- {
- this.close();
- }
-
-
- public void close(string options="")
- {
- if (browser != null)
- {
- Deployment.Current.Dispatcher.BeginInvoke(() =>
- {
- PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
- if (frame != null)
- {
- PhoneApplicationPage page = frame.Content as PhoneApplicationPage;
- if (page != null)
- {
- Grid grid = page.FindName("LayoutRoot") as Grid;
- if (grid != null)
- {
- grid.Children.Remove(browser);
- }
- page.ApplicationBar = null;
- }
- }
- browser = null;
- });
- }
- }
-
- void browser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
- {
- string message = "{type:\"locationChanged\",location:\"" + e.Uri.AbsoluteUri + "\"}";
- PluginResult result = new PluginResult(PluginResult.Status.OK, message);
- result.KeepCallback = true;
- this.DispatchCommandResult(result);
- }
-
- void browser_NavigationFailed(object sender, System.Windows.Navigation.NavigationFailedEventArgs e)
- {
- string message = "{type:\"navigationError\",location:\"" + e.Uri.AbsoluteUri + "\"}";
- PluginResult result = new PluginResult(PluginResult.Status.ERROR, message);
- result.KeepCallback = true;
- this.DispatchCommandResult(result);
- }
-
- void browser_Navigating(object sender, NavigatingEventArgs e)
- {
- string message = "{type:\"locationAboutToChange\",location:\"" + e.Uri.AbsoluteUri + "\"}";
- PluginResult result = new PluginResult(PluginResult.Status.OK, message);
- result.KeepCallback = true;
- this.DispatchCommandResult(result);
- }
-
- }
-}
View
@@ -1,20 +0,0 @@
-@echo off
-REM -- Prepare the Command Processor --
-SETLOCAL ENABLEEXTENSIONS
-SETLOCAL DISABLEDELAYEDEXPANSION
-
-::BatchSubstitude - parses a File line by line and replaces a substring"
-::syntax: BatchSubstitude.bat OldStr NewStr File
-:: OldStr [in] - string to be replaced
-:: NewStr [in] - string to replace with
-:: File [in] - file to be parsed
-:$changed 20100115
-:$source http://www.dostips.com
-if "%~1"=="" findstr "^::" "%~f0"&GOTO:EOF
-for /f "tokens=1,* delims=]" %%A in ('"type %3|find /n /v """') do (
- set "line=%%B"
- if defined line (
- call set "line=echo.%%line:%~1=%~2%%"
- for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X
- ) ELSE echo.
-)
View
@@ -1,10 +0,0 @@
-::set "dirpath=c:\Users\herm\Documents\hermwong\phonegap-wp7\tests\MobileSpecUnitTests\"
-
-set dirpath=%CD%"\MobileSpecUnitTests\"
-
-dir /s /b %dirpath%www\*.* > temp.txt
-
-:: remove local path
-BatchSubstitute.bat %dirpath% "" temp.txt > filelist.txt
-
-:: temp.txt is re-used by the xml.js to store the xml nodes
@@ -1,90 +0,0 @@
-/* MIT licensed */
-// (c) 2010 Jesse MacFadyen, Nitobi
-
-/*global PhoneGap */
-
-function ChildBrowser() {
- // Does nothing
-}
-
-// Callback when the location of the page changes
-// called from native
-ChildBrowser._onLocationChange = function(newLoc)
-{
- window.plugins.childBrowser.onLocationChange(newLoc);
-};
-
-// Callback when the user chooses the 'Done' button
-// called from native
-ChildBrowser._onClose = function()
-{
- window.plugins.childBrowser.onClose();
-};
-
-// Callback when the user chooses the 'open in Safari' button
-// called from native
-ChildBrowser._onOpenExternal = function()
-{
- window.plugins.childBrowser.onOpenExternal();
-};
-
-// Pages loaded into the ChildBrowser can execute callback scripts, so be careful to
-// check location, and make sure it is a location you trust.
-// Warning ... don't exec arbitrary code, it's risky and could fuck up your app.
-// called from native
-ChildBrowser._onJSCallback = function(js,loc)
-{
- // Not Implemented
- //window.plugins.childBrowser.onJSCallback(js,loc);
-};
-
-/* The interface that you will use to access functionality */
-
-// Show a webpage, will result in a callback to onLocationChange
-ChildBrowser.prototype.showWebPage = function(loc,geolocationEnabled)
-{
- var success = function(msg)
- {
- console.log("ChildBrowser.showWebPage success :: " + msg);
- };
-
- var error = function(e)
- {
- console.log("ChildBrowser.showWebPage error :: " + e);
- };
-
- var options =
- {
- url:loc,
- geolocationEnabled:(geolocationEnabled == true)
-
- };
-
- PhoneGap.exec(success,error,"ChildBrowserCommand","showWebPage", options);
- //setTimeout(this.close,5000);
-};
-
-// close the browser, will NOT result in close callback
-ChildBrowser.prototype.close = function()
-{
- PhoneGap.exec(null,null,"ChildBrowserCommand","close");
-};
-
-// Not Implemented
-ChildBrowser.prototype.jsExec = function(jsString)
-{
- // Not Implemented!!
- //PhoneGap.exec("ChildBrowserCommand.jsExec",jsString);
-};
-
-// Note: this plugin does NOT install itself, call this method some time after deviceready to install it
-// it will be returned, and also available globally from window.plugins.childBrowser
-ChildBrowser.install = function()
-{
- if(!window.plugins) {
- window.plugins = {};
- }
-
- window.plugins.childBrowser = new ChildBrowser();
- return window.plugins.childBrowser;
-};
Oops, something went wrong.

0 comments on commit 08ad477

Please sign in to comment.