diff --git a/framework/PhoneGap/Commands/ChildBrowserCommand.cs b/framework/PhoneGap/Commands/ChildBrowserCommand.cs deleted file mode 100644 index 935f7eb..0000000 --- a/framework/PhoneGap/Commands/ChildBrowserCommand.cs +++ /dev/null @@ -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(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(browser_Navigating); - browser.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(browser_NavigationFailed); - browser.Navigated += new EventHandler(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); - } - - } -} diff --git a/tests/BatchSubstitute.bat b/tests/BatchSubstitute.bat deleted file mode 100644 index 99bffdc..0000000 --- a/tests/BatchSubstitute.bat +++ /dev/null @@ -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. -) diff --git a/tests/FileNameParser.bat b/tests/FileNameParser.bat deleted file mode 100644 index 72fb824..0000000 --- a/tests/FileNameParser.bat +++ /dev/null @@ -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 \ No newline at end of file diff --git a/tests/MobileSpecUnitTests/www/ChildBrowser.js b/tests/MobileSpecUnitTests/www/ChildBrowser.js deleted file mode 100644 index 8f45548..0000000 --- a/tests/MobileSpecUnitTests/www/ChildBrowser.js +++ /dev/null @@ -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; -}; diff --git a/tests/MobileSpecUnitTests/www/childBrowser.html b/tests/MobileSpecUnitTests/www/childBrowser.html deleted file mode 100644 index 640d1ef..0000000 --- a/tests/MobileSpecUnitTests/www/childBrowser.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - PhoneGap - ChildBrowser - - - - - - - - - - - - - - - -
Open AppHub
- -
Open Facebook
- - Back - - \ No newline at end of file diff --git a/tests/MobileSpecUnitTests/www/index.html b/tests/MobileSpecUnitTests/www/index.html index bedb14c..c0e1236 100644 --- a/tests/MobileSpecUnitTests/www/index.html +++ b/tests/MobileSpecUnitTests/www/index.html @@ -91,7 +91,6 @@

Width:  , Height:   Accel Game Audio Play/Record Camera - Child Browser Capture Compass Connection diff --git a/tests/xml.js b/tests/xml.js deleted file mode 100644 index cfea48c..0000000 --- a/tests/xml.js +++ /dev/null @@ -1,59 +0,0 @@ -var strLine = ""; - -var objFS = new ActiveXObject("Scripting.FileSystemObject"); - -var DIR_PATH = objFS.GetAbsolutePathName("") + "\\"; -var PATH = DIR_PATH + "MobileSpecUnitTests\\"; - -var objInputFile = objFS.OpenTextFile(DIR_PATH + "filelist.txt"); -var objOutputFile = objFS.CreateTextFile(DIR_PATH + "temp.txt", true); - -while (!objInputFile.AtEndOfStream) -{ - strLine = objInputFile.ReadLine(); - strLine = strLine.replace(PATH, ""); - strLine = strLine.replace(/\\/gi, "/"); - - objOutputFile.WriteLine(""); -} - -objOutputFile.Close(); -objInputFile.Close(); - -objFS.DeleteFile(DIR_PATH + "filelist.txt"); - -objOutputFile = null; -objInputFile = null; - -var objXmlNodeFile = objFS.OpenTextFile(DIR_PATH + "temp.txt"); -var objResourceFile = objFS.CreateTextFile(PATH + "GapSourceDictionary.xml", true); - -objResourceFile.WriteLine(""); -objResourceFile.WriteLine(""); -objResourceFile.WriteLine(""); -objResourceFile.WriteLine(""); -objResourceFile.WriteLine(""); - -while (!objXmlNodeFile.AtEndOfStream) -{ - strLine = objXmlNodeFile.ReadLine(); - - if (strLine.indexOf(".") > 0) - { - objResourceFile.WriteLine(strLine); - } -} - -objResourceFile.WriteLine(""); - -objXmlNodeFile.Close(); -objResourceFile.Close(); - -objFS.DeleteFile(DIR_PATH + "temp.txt"); - - -objXmlNodeFile = null; -objResourceFile = null; - -objFS = null; -