incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [3/4] wp7 commit: paths are resolved via BaseCommand which conditionally adds the DLL resource path if built into a library project
Date Fri, 31 Aug 2012 00:34:58 GMT
paths are resolved via BaseCommand which conditionally adds the DLL resource path if built
into a library project


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/commit/932e0a3d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/tree/932e0a3d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/diff/932e0a3d

Branch: refs/heads/master
Commit: 932e0a3d766eceb723d7aeb32b976aec374726ff
Parents: b781273
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Thu Aug 30 17:23:34 2012 -0700
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Thu Aug 30 17:23:34 2012 -0700

----------------------------------------------------------------------
 framework/WP7CordovaClassLib.csproj                |    2 +-
 .../standalone/cordovalib/Commands/BaseCommand.cs  |    9 +++++++++
 .../standalone/cordovalib/Commands/Notification.cs |   14 ++++++--------
 .../standalone/cordovalib/UI/AudioCaptureTask.cs   |    8 +++-----
 .../standalone/cordovalib/UI/ImageCapture.xaml.cs  |    4 +++-
 .../standalone/cordovalib/UI/VideoCaptureTask.cs   |    3 ++-
 6 files changed, 24 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/932e0a3d/framework/WP7CordovaClassLib.csproj
----------------------------------------------------------------------
diff --git a/framework/WP7CordovaClassLib.csproj b/framework/WP7CordovaClassLib.csproj
index a92ed15..62ee745 100644
--- a/framework/WP7CordovaClassLib.csproj
+++ b/framework/WP7CordovaClassLib.csproj
@@ -52,7 +52,7 @@
     <DebugType>pdbonly</DebugType>
     <Optimize>true</Optimize>
     <OutputPath>Bin\Release</OutputPath>
-    <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+    <DefineConstants>TRACE;DEBUG;SILVERLIGHT;WINDOWS_PHONE;CORDOVA_CLASSLIB</DefineConstants>
     <NoStdLib>true</NoStdLib>
     <NoConfig>true</NoConfig>
     <ErrorReport>prompt</ErrorReport>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/932e0a3d/templates/standalone/cordovalib/Commands/BaseCommand.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/Commands/BaseCommand.cs b/templates/standalone/cordovalib/Commands/BaseCommand.cs
index 2bdc0f3..5cdad2b 100644
--- a/templates/standalone/cordovalib/Commands/BaseCommand.cs
+++ b/templates/standalone/cordovalib/Commands/BaseCommand.cs
@@ -122,6 +122,15 @@ namespace WP7CordovaClassLib.Cordova.Commands
             service.Deactivated -= this.OnPause;
             this.OnCommandResult = null;
         }
+
+        public static string GetBaseURL()
+        {
+#if CORDOVA_CLASSLIB
+            return "/WP7CordovaClassLib;component/";
+#else
+            return "./";
+#endif
+        }
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/932e0a3d/templates/standalone/cordovalib/Commands/Notification.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/Commands/Notification.cs b/templates/standalone/cordovalib/Commands/Notification.cs
index a0d3bd9..c80ee08 100644
--- a/templates/standalone/cordovalib/Commands/Notification.cs
+++ b/templates/standalone/cordovalib/Commands/Notification.cs
@@ -91,13 +91,8 @@ namespace WP7CordovaClassLib.Cordova.Commands
             Deployment.Current.Dispatcher.BeginInvoke(() =>
             {
 
-#if CORDOVA_CLASSLIB
-                Debug.WriteLine("CORDOVA_CLASSLIB IS defined");
-#else
-                Debug.WriteLine("CORDOVA_CLASSLIB is NOT defined");
-#endif
                 string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
-                AlertOptions alertOpts = new AlertOptions();// JSON.JsonHelper.Deserialize<AlertOptions>(options);
+                AlertOptions alertOpts = new AlertOptions();
                 alertOpts.message = args[0];
                 alertOpts.title = args[1];
                 alertOpts.buttonLabel = args[2];
@@ -147,7 +142,7 @@ namespace WP7CordovaClassLib.Cordova.Commands
                         notifBox.PageTitle.Text = alertOpts.title;
                         notifBox.SubTitle.Text = alertOpts.message;
 
-                        string[] labels = alertOpts.buttonLabel.Split(',');
+                        string[] labels = JSON.JsonHelper.Deserialize<string[]>(alertOpts.buttonLabel);
                         for (int n = 0; n < labels.Length; n++)
                         {
                             Button btn = new Button();
@@ -217,7 +212,10 @@ namespace WP7CordovaClassLib.Cordova.Commands
             string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
             int times = int.Parse(args[0]);
 
-            StreamResourceInfo sri = Application.GetResourceStream(new Uri("/WP7CordovaClassLib;component/resources/notification-beep.wav",
UriKind.Relative));
+            string resourcePath = BaseCommand.GetBaseURL() + "resources/notification-beep.wav";
+
+            StreamResourceInfo sri = Application.GetResourceStream(new Uri(resourcePath,
UriKind.Relative));
+
             if (sri != null)
             {
                 SoundEffect effect = SoundEffect.FromStream(sri.Stream);

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/932e0a3d/templates/standalone/cordovalib/UI/AudioCaptureTask.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/UI/AudioCaptureTask.cs b/templates/standalone/cordovalib/UI/AudioCaptureTask.cs
index 812d9a6..565343b 100644
--- a/templates/standalone/cordovalib/UI/AudioCaptureTask.cs
+++ b/templates/standalone/cordovalib/UI/AudioCaptureTask.cs
@@ -74,12 +74,10 @@ namespace WP7CordovaClassLib.Cordova.UI
 
                 root.Navigated += new System.Windows.Navigation.NavigatedEventHandler(NavigationService_Navigated);
 
+                string baseUrl = WP7CordovaClassLib.Cordova.Commands.BaseCommand.GetBaseURL();
                 // dummy parameter is used to always open a fresh version
-#if CORDOVA_CLASSLIB
-                root.Navigate(new System.Uri("/WP7CordovaClassLib;component/Cordova/UI/AudioRecorder.xaml?dummy="
+ Guid.NewGuid().ToString(), UriKind.Relative));
-#else
-                root.Navigate(new System.Uri("component/Cordova/UI/AudioRecorder.xaml?dummy="
+ Guid.NewGuid().ToString(), UriKind.Relative));
-#endif
+                root.Navigate(new System.Uri( baseUrl + "Cordova/UI/AudioRecorder.xaml?dummy="
+ Guid.NewGuid().ToString(), UriKind.Relative));
+
             });
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/932e0a3d/templates/standalone/cordovalib/UI/ImageCapture.xaml.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/UI/ImageCapture.xaml.cs b/templates/standalone/cordovalib/UI/ImageCapture.xaml.cs
index bb3bbeb..8774e47 100644
--- a/templates/standalone/cordovalib/UI/ImageCapture.xaml.cs
+++ b/templates/standalone/cordovalib/UI/ImageCapture.xaml.cs
@@ -79,8 +79,10 @@ namespace WP7CordovaClassLib.Cordova.UI
 
                 root.Navigated += new System.Windows.Navigation.NavigatedEventHandler(NavigationService_Navigated);
 
+                string baseUrl = WP7CordovaClassLib.Cordova.Commands.BaseCommand.GetBaseURL();
+
                 // dummy parameter is used to always open a fresh version
-                root.Navigate(new System.Uri("/WP7CordovaClassLib;component/Cordova/UI/ImageCapture.xaml?dummy="
+ Guid.NewGuid().ToString(), UriKind.Relative));
+                root.Navigate(new System.Uri(baseUrl + "Cordova/UI/ImageCapture.xaml?dummy="
+ Guid.NewGuid().ToString(), UriKind.Relative));
             });
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/932e0a3d/templates/standalone/cordovalib/UI/VideoCaptureTask.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/UI/VideoCaptureTask.cs b/templates/standalone/cordovalib/UI/VideoCaptureTask.cs
index f437826..3fd92a5 100644
--- a/templates/standalone/cordovalib/UI/VideoCaptureTask.cs
+++ b/templates/standalone/cordovalib/UI/VideoCaptureTask.cs
@@ -74,8 +74,9 @@ namespace WP7CordovaClassLib.Cordova.UI
 
                 root.Navigated += new System.Windows.Navigation.NavigatedEventHandler(NavigationService_Navigated);
 
+                string baseUrl = WP7CordovaClassLib.Cordova.Commands.BaseCommand.GetBaseURL();
                 // dummy parameter is used to always open a fresh version
-                root.Navigate(new System.Uri("/WP7CordovaClassLib;component/Cordova/UI/VideoRecorder.xaml?dummy="
+ Guid.NewGuid().ToString(), UriKind.Relative));
+                root.Navigate(new System.Uri( baseUrl + "Cordova/UI/VideoRecorder.xaml?dummy="
+ Guid.NewGuid().ToString(), UriKind.Relative));
             });
         }
 


Mime
View raw message