cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [10/10] wp7 commit: Updated project structure and moved all commands to the plugin folder for future splitting out
Date Mon, 15 Apr 2013 23:58:54 GMT
Updated project structure and moved all commands to the plugin folder for future splitting out


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

Branch: refs/heads/master
Commit: 4551e1e583a7d96f195d849bbef0da20cab65e4c
Parents: 68922b9
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Mon Apr 15 16:58:03 2013 -0700
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Mon Apr 15 16:58:03 2013 -0700

----------------------------------------------------------------------
 framework/WPCordovaClassLib.csproj                 |  190 +-
 templates/standalone/CordovaAppProj.csproj         |   72 +-
 templates/standalone/CordovaSourceDictionary.xml   |    5 +-
 templates/standalone/Plugins/Accelerometer.cs      |  196 ++
 templates/standalone/Plugins/AudioFormatsHelper.cs |   89 +
 templates/standalone/Plugins/AudioPlayer.cs        |  620 ++++++
 templates/standalone/Plugins/Battery.cs            |   79 +
 templates/standalone/Plugins/Camera.cs             |  490 +++++
 templates/standalone/Plugins/Capture.cs            |  736 +++++++
 templates/standalone/Plugins/Compass.cs            |  362 ++++
 templates/standalone/Plugins/Contacts.cs           |  664 ++++++
 templates/standalone/Plugins/DebugConsole.cs       |   49 +
 templates/standalone/Plugins/Device.cs             |  135 ++
 templates/standalone/Plugins/File.cs               | 1554 +++++++++++++++
 templates/standalone/Plugins/FileTransfer.cs       |  526 +++++
 templates/standalone/Plugins/GeoLocation.cs        |   34 +
 templates/standalone/Plugins/Globalization.cs      | 1178 +++++++++++
 templates/standalone/Plugins/ImageExifHelper.cs    |  209 ++
 templates/standalone/Plugins/InAppBrowser.cs       |  269 +++
 templates/standalone/Plugins/Media.cs              |  532 +++++
 templates/standalone/Plugins/MimeTypeMapper.cs     |   99 +
 templates/standalone/Plugins/NetworkStatus.cs      |  124 ++
 templates/standalone/Plugins/Notification.cs       |  345 ++++
 .../standalone/Plugins/UI/AudioCaptureTask.cs      |  107 +
 templates/standalone/Plugins/UI/AudioRecorder.xaml |   66 +
 .../standalone/Plugins/UI/AudioRecorder.xaml.cs    |  306 +++
 templates/standalone/Plugins/UI/ImageCapture.xaml  |   26 +
 .../standalone/Plugins/UI/ImageCapture.xaml.cs     |  109 +
 .../standalone/Plugins/UI/NotificationBox.xaml     |   62 +
 .../standalone/Plugins/UI/NotificationBox.xaml.cs  |   41 +
 .../standalone/Plugins/UI/VideoCaptureTask.cs      |  105 +
 templates/standalone/Plugins/UI/VideoRecorder.xaml |   52 +
 .../standalone/Plugins/UI/VideoRecorder.xaml.cs    |  405 ++++
 .../cordovalib/Commands/Accelerometer.cs           |  196 --
 .../cordovalib/Commands/AudioFormatsHelper.cs      |   89 -
 .../standalone/cordovalib/Commands/AudioPlayer.cs  |  620 ------
 .../standalone/cordovalib/Commands/Battery.cs      |   79 -
 templates/standalone/cordovalib/Commands/Camera.cs |  490 -----
 .../standalone/cordovalib/Commands/Capture.cs      |  736 -------
 .../standalone/cordovalib/Commands/Compass.cs      |  362 ----
 .../standalone/cordovalib/Commands/Contacts.cs     |  664 ------
 .../standalone/cordovalib/Commands/DebugConsole.cs |   49 -
 templates/standalone/cordovalib/Commands/Device.cs |  135 --
 templates/standalone/cordovalib/Commands/File.cs   | 1554 ---------------
 .../standalone/cordovalib/Commands/FileTransfer.cs |  526 -----
 .../standalone/cordovalib/Commands/GeoLocation.cs  |   34 -
 .../cordovalib/Commands/Globalization.cs           | 1178 -----------
 .../cordovalib/Commands/ImageExifHelper.cs         |  209 --
 .../standalone/cordovalib/Commands/InAppBrowser.cs |  269 ---
 templates/standalone/cordovalib/Commands/Media.cs  |  532 -----
 .../cordovalib/Commands/MimeTypeMapper.cs          |   99 -
 .../cordovalib/Commands/NetworkStatus.cs           |  124 --
 .../standalone/cordovalib/Commands/Notification.cs |  345 ----
 .../cordovalib/Images/appbar.back.rest.png         |  Bin 375 -> 0 bytes
 .../cordovalib/Images/appbar.close.rest.png        |  Bin 359 -> 0 bytes
 .../Images/appbar.feature.video.rest.png           |  Bin 433 -> 0 bytes
 .../cordovalib/Images/appbar.next.rest.png         |  Bin 388 -> 0 bytes
 .../cordovalib/Images/appbar.save.rest.png         |  Bin 297 -> 0 bytes
 .../cordovalib/Images/appbar.stop.rest.png         |  Bin 350 -> 0 bytes
 .../standalone/cordovalib/UI/AudioCaptureTask.cs   |  107 -
 .../standalone/cordovalib/UI/AudioRecorder.xaml    |   66 -
 .../standalone/cordovalib/UI/AudioRecorder.xaml.cs |  306 ---
 .../standalone/cordovalib/UI/ImageCapture.xaml     |   26 -
 .../standalone/cordovalib/UI/ImageCapture.xaml.cs  |  109 -
 .../standalone/cordovalib/UI/NotificationBox.xaml  |   62 -
 .../cordovalib/UI/NotificationBox.xaml.cs          |   41 -
 .../standalone/cordovalib/UI/VideoCaptureTask.cs   |  105 -
 .../standalone/cordovalib/UI/VideoRecorder.xaml    |   52 -
 .../standalone/cordovalib/UI/VideoRecorder.xaml.cs |  405 ----
 69 files changed, 9684 insertions(+), 9721 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/4551e1e5/framework/WPCordovaClassLib.csproj
----------------------------------------------------------------------
diff --git a/framework/WPCordovaClassLib.csproj b/framework/WPCordovaClassLib.csproj
index 846bfdf..1292286 100644
--- a/framework/WPCordovaClassLib.csproj
+++ b/framework/WPCordovaClassLib.csproj
@@ -86,66 +86,9 @@
     <Compile Include="..\templates\standalone\cordovalib\CommandFactory.cs">
       <Link>CordovaLib\CommandFactory.cs</Link>
     </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\Accelerometer.cs">
-      <Link>CordovaLib\Commands\Accelerometer.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\AudioFormatsHelper.cs">
-      <Link>CordovaLib\Commands\AudioFormatsHelper.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\AudioPlayer.cs">
-      <Link>CordovaLib\Commands\AudioPlayer.cs</Link>
-    </Compile>
     <Compile Include="..\templates\standalone\cordovalib\Commands\BaseCommand.cs">
       <Link>CordovaLib\Commands\BaseCommand.cs</Link>
     </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\Battery.cs">
-      <Link>CordovaLib\Commands\Battery.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\Camera.cs">
-      <Link>CordovaLib\Commands\Camera.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\Capture.cs">
-      <Link>CordovaLib\Commands\Capture.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\Compass.cs">
-      <Link>CordovaLib\Commands\Compass.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\Contacts.cs">
-      <Link>CordovaLib\Commands\Contacts.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\DebugConsole.cs">
-      <Link>CordovaLib\Commands\DebugConsole.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\Device.cs">
-      <Link>CordovaLib\Commands\Device.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\File.cs">
-      <Link>CordovaLib\Commands\File.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\FileTransfer.cs">
-      <Link>CordovaLib\Commands\FileTransfer.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\GeoLocation.cs">
-      <Link>CordovaLib\Commands\GeoLocation.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\ImageExifHelper.cs">
-      <Link>CordovaLib\Commands\ImageExifHelper.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\InAppBrowser.cs">
-      <Link>CordovaLib\Commands\InAppBrowser.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\Media.cs">
-      <Link>CordovaLib\Commands\Media.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\MimeTypeMapper.cs">
-      <Link>CordovaLib\Commands\MimeTypeMapper.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\NetworkStatus.cs">
-      <Link>CordovaLib\Commands\NetworkStatus.cs</Link>
-    </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\Commands\Notification.cs">
-      <Link>CordovaLib\Commands\Notification.cs</Link>
-    </Compile>
     <Compile Include="..\templates\standalone\cordovalib\ConfigHandler.cs">
       <Link>CordovaLib\ConfigHandler.cs</Link>
     </Compile>
@@ -174,51 +117,107 @@
     <Compile Include="..\templates\standalone\cordovalib\ScriptCallback.cs">
       <Link>CordovaLib\ScriptCallback.cs</Link>
     </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\UI\AudioCaptureTask.cs">
-      <Link>CordovaLib\UI\AudioCaptureTask.cs</Link>
+    <Compile Include="..\templates\standalone\Plugins\Accelerometer.cs">
+      <Link>CordovaLib\Plugins\Accelerometer.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\AudioFormatsHelper.cs">
+      <Link>CordovaLib\Plugins\AudioFormatsHelper.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\AudioPlayer.cs">
+      <Link>CordovaLib\Plugins\AudioPlayer.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\Battery.cs">
+      <Link>CordovaLib\Plugins\Battery.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\Camera.cs">
+      <Link>CordovaLib\Plugins\Camera.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\Capture.cs">
+      <Link>CordovaLib\Plugins\Capture.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\Compass.cs">
+      <Link>CordovaLib\Plugins\Compass.cs</Link>
     </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\UI\AudioRecorder.xaml.cs">
-      <Link>CordovaLib\UI\AudioRecorder.xaml.cs</Link>
-      <DependentUpon>AudioRecorder.xaml</DependentUpon>
+    <Compile Include="..\templates\standalone\Plugins\Contacts.cs">
+      <Link>CordovaLib\Plugins\Contacts.cs</Link>
     </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\UI\ImageCapture.xaml.cs">
-      <Link>CordovaLib\UI\ImageCapture.xaml.cs</Link>
-      <DependentUpon>ImageCapture.xaml</DependentUpon>
+    <Compile Include="..\templates\standalone\Plugins\DebugConsole.cs">
+      <Link>CordovaLib\Plugins\DebugConsole.cs</Link>
     </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\UI\NotificationBox.xaml.cs">
-      <Link>CordovaLib\UI\NotificationBox.xaml.cs</Link>
-      <DependentUpon>NotificationBox.xaml</DependentUpon>
+    <Compile Include="..\templates\standalone\Plugins\Device.cs">
+      <Link>CordovaLib\Plugins\Device.cs</Link>
     </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\UI\VideoCaptureTask.cs">
-      <Link>CordovaLib\UI\VideoCaptureTask.cs</Link>
+    <Compile Include="..\templates\standalone\Plugins\File.cs">
+      <Link>CordovaLib\Plugins\File.cs</Link>
     </Compile>
-    <Compile Include="..\templates\standalone\cordovalib\UI\VideoRecorder.xaml.cs">
-      <Link>CordovaLib\UI\VideoRecorder.xaml.cs</Link>
-      <DependentUpon>VideoRecorder.xaml</DependentUpon>
+    <Compile Include="..\templates\standalone\Plugins\FileTransfer.cs">
+      <Link>CordovaLib\Plugins\FileTransfer.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\GeoLocation.cs">
+      <Link>CordovaLib\Plugins\GeoLocation.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\Globalization.cs">
+      <Link>CordovaLib\Plugins\Globalization.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\ImageExifHelper.cs">
+      <Link>CordovaLib\Plugins\ImageExifHelper.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\InAppBrowser.cs">
+      <Link>CordovaLib\Plugins\InAppBrowser.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\Media.cs">
+      <Link>CordovaLib\Plugins\Media.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\MimeTypeMapper.cs">
+      <Link>CordovaLib\Plugins\MimeTypeMapper.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\NetworkStatus.cs">
+      <Link>CordovaLib\Plugins\NetworkStatus.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\Notification.cs">
+      <Link>CordovaLib\Plugins\Notification.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\UI\AudioCaptureTask.cs">
+      <Link>CordovaLib\Plugins\UI\AudioCaptureTask.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\UI\AudioRecorder.xaml.cs">
+      <Link>CordovaLib\Plugins\UI\AudioRecorder.xaml.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\UI\ImageCapture.xaml.cs">
+      <Link>CordovaLib\Plugins\UI\ImageCapture.xaml.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\UI\NotificationBox.xaml.cs">
+      <Link>CordovaLib\Plugins\UI\NotificationBox.xaml.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\UI\VideoCaptureTask.cs">
+      <Link>CordovaLib\Plugins\UI\VideoCaptureTask.cs</Link>
+    </Compile>
+    <Compile Include="..\templates\standalone\Plugins\UI\VideoRecorder.xaml.cs">
+      <Link>CordovaLib\Plugins\UI\VideoRecorder.xaml.cs</Link>
     </Compile>
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
-    <Resource Include="..\templates\standalone\cordovalib\Images\appbar.back.rest.png">
+    <Content Include="..\templates\standalone\cordovalib\resources\notification-beep.wav">
+      <Link>CordovaLib\resources\notification-beep.wav</Link>
+    </Content>
+    <Content Include="..\templates\standalone\Images\appbar.back.rest.png">
       <Link>CordovaLib\Images\appbar.back.rest.png</Link>
-    </Resource>
-    <Resource Include="..\templates\standalone\cordovalib\Images\appbar.close.rest.png">
+    </Content>
+    <Content Include="..\templates\standalone\Images\appbar.close.rest.png">
       <Link>CordovaLib\Images\appbar.close.rest.png</Link>
-    </Resource>
-    <Resource Include="..\templates\standalone\cordovalib\Images\appbar.feature.video.rest.png">
+    </Content>
+    <Content Include="..\templates\standalone\Images\appbar.feature.video.rest.png">
       <Link>CordovaLib\Images\appbar.feature.video.rest.png</Link>
-    </Resource>
-    <Resource Include="..\templates\standalone\cordovalib\Images\appbar.next.rest.png">
+    </Content>
+    <Content Include="..\templates\standalone\Images\appbar.next.rest.png">
       <Link>CordovaLib\Images\appbar.next.rest.png</Link>
-    </Resource>
-    <Resource Include="..\templates\standalone\cordovalib\Images\appbar.save.rest.png">
+    </Content>
+    <Content Include="..\templates\standalone\Images\appbar.save.rest.png">
       <Link>CordovaLib\Images\appbar.save.rest.png</Link>
-    </Resource>
-    <Resource Include="..\templates\standalone\cordovalib\Images\appbar.stop.rest.png">
+    </Content>
+    <Content Include="..\templates\standalone\Images\appbar.stop.rest.png">
       <Link>CordovaLib\Images\appbar.stop.rest.png</Link>
-    </Resource>
-    <Content Include="..\templates\standalone\cordovalib\resources\notification-beep.wav">
-      <Link>CordovaLib\resources\notification-beep.wav</Link>
     </Content>
     <Content Include="Images\appbar.back.rest.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -251,23 +250,23 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="..\templates\standalone\cordovalib\UI\AudioRecorder.xaml">
-      <Link>CordovaLib\UI\AudioRecorder.xaml</Link>
+    <Page Include="..\templates\standalone\Plugins\UI\AudioRecorder.xaml">
+      <Link>CordovaLib\Plugins\UI\AudioRecorder.xaml</Link>
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="..\templates\standalone\cordovalib\UI\ImageCapture.xaml">
-      <Link>CordovaLib\UI\ImageCapture.xaml</Link>
+    <Page Include="..\templates\standalone\Plugins\UI\ImageCapture.xaml">
+      <Link>CordovaLib\Plugins\UI\ImageCapture.xaml</Link>
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="..\templates\standalone\cordovalib\UI\NotificationBox.xaml">
-      <Link>CordovaLib\UI\NotificationBox.xaml</Link>
+    <Page Include="..\templates\standalone\Plugins\UI\NotificationBox.xaml">
+      <Link>CordovaLib\Plugins\UI\NotificationBox.xaml</Link>
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="..\templates\standalone\cordovalib\UI\VideoRecorder.xaml">
-      <Link>CordovaLib\UI\VideoRecorder.xaml</Link>
+    <Page Include="..\templates\standalone\Plugins\UI\VideoRecorder.xaml">
+      <Link>CordovaLib\Plugins\UI\VideoRecorder.xaml</Link>
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
@@ -295,5 +294,4 @@
   </Target>
   <Target Name="AfterBuild">
   </Target>-->
-  
 </Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/4551e1e5/templates/standalone/CordovaAppProj.csproj
----------------------------------------------------------------------
diff --git a/templates/standalone/CordovaAppProj.csproj b/templates/standalone/CordovaAppProj.csproj
index dcd90bc..61b3be1 100644
--- a/templates/standalone/CordovaAppProj.csproj
+++ b/templates/standalone/CordovaAppProj.csproj
@@ -86,26 +86,7 @@
     </Compile>
     <Compile Include="cordovalib\BrowserMouseHelper.cs" />
     <Compile Include="cordovalib\CommandFactory.cs" />
-    <Compile Include="cordovalib\Commands\Accelerometer.cs" />
-    <Compile Include="cordovalib\Commands\AudioFormatsHelper.cs" />
-    <Compile Include="cordovalib\Commands\AudioPlayer.cs" />
     <Compile Include="cordovalib\Commands\BaseCommand.cs" />
-    <Compile Include="cordovalib\Commands\Battery.cs" />
-    <Compile Include="cordovalib\Commands\Camera.cs" />
-    <Compile Include="cordovalib\Commands\Capture.cs" />
-    <Compile Include="cordovalib\Commands\Compass.cs" />
-    <Compile Include="cordovalib\Commands\Contacts.cs" />
-    <Compile Include="cordovalib\Commands\DebugConsole.cs" />
-    <Compile Include="cordovalib\Commands\Device.cs" />
-    <Compile Include="cordovalib\Commands\File.cs" />
-    <Compile Include="cordovalib\Commands\FileTransfer.cs" />
-    <Compile Include="cordovalib\Commands\GeoLocation.cs" />
-    <Compile Include="cordovalib\Commands\ImageExifHelper.cs" />
-    <Compile Include="cordovalib\Commands\InAppBrowser.cs" />
-    <Compile Include="cordovalib\Commands\Media.cs" />
-    <Compile Include="cordovalib\Commands\MimeTypeMapper.cs" />
-    <Compile Include="cordovalib\Commands\NetworkStatus.cs" />
-    <Compile Include="cordovalib\Commands\Notification.cs" />
     <Compile Include="cordovalib\ConfigHandler.cs" />
     <Compile Include="cordovalib\CordovaCommandCall.cs" />
     <Compile Include="cordovalib\CordovaView.xaml.cs">
@@ -117,20 +98,9 @@
     <Compile Include="cordovalib\OrientationHelper.cs" />
     <Compile Include="cordovalib\PluginResult.cs" />
     <Compile Include="cordovalib\ScriptCallback.cs" />
-    <Compile Include="cordovalib\UI\AudioCaptureTask.cs" />
-    <Compile Include="cordovalib\UI\AudioRecorder.xaml.cs">
-      <DependentUpon>AudioRecorder.xaml</DependentUpon>
-    </Compile>
-    <Compile Include="cordovalib\UI\ImageCapture.xaml.cs">
-      <DependentUpon>ImageCapture.xaml</DependentUpon>
-    </Compile>
-    <Compile Include="cordovalib\UI\NotificationBox.xaml.cs">
-      <DependentUpon>NotificationBox.xaml</DependentUpon>
-    </Compile>
-    <Compile Include="cordovalib\UI\VideoCaptureTask.cs" />
-    <Compile Include="cordovalib\UI\VideoRecorder.xaml.cs">
-      <DependentUpon>VideoRecorder.xaml</DependentUpon>
-    </Compile>
+
+
+
     <Compile Include="MainPage.xaml.cs">
       <DependentUpon>MainPage.xaml</DependentUpon>
     </Compile>
@@ -145,45 +115,38 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="cordovalib\UI\AudioRecorder.xaml">
-      <Generator>MSBuild:Compile</Generator>
+    
+    <Page Include="MainPage.xaml">
       <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="cordovalib\UI\ImageCapture.xaml">
+
+    <Page Include="Plugins\UI\AudioRecorder.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="cordovalib\UI\NotificationBox.xaml">
+    <Page Include="Plugins\UI\ImageCapture.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="cordovalib\UI\VideoRecorder.xaml">
+    <Page Include="Plugins\UI\NotificationBox.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="MainPage.xaml">
-      <SubType>Designer</SubType>
+    <Page Include="Plugins\UI\VideoRecorder.xaml">
       <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
     </Page>
+
   </ItemGroup>
   <ItemGroup>
     <Content Include="www\**" />
     <Content Include="config.xml" />
-    <Content Include="Images\appbar.back.rest.png" />
-    <Content Include="Images\appbar.close.rest.png" />
-    <Content Include="Images\appbar.feature.video.rest.png" />
-    <Content Include="Images\appbar.next.rest.png" />
-    <Content Include="Images\appbar.save.rest.png" />
-    <Content Include="Images\appbar.stop.rest.png" />
+    <Content Include="Images\**" />
+
     <Content Include="resources\notification-beep.wav" />
     <None Include="VERSION" />
-    <Resource Include="cordovalib\Images\appbar.back.rest.png" />
-    <Resource Include="cordovalib\Images\appbar.close.rest.png" />
-    <Resource Include="cordovalib\Images\appbar.feature.video.rest.png" />
-    <Resource Include="cordovalib\Images\appbar.next.rest.png" />
-    <Resource Include="cordovalib\Images\appbar.save.rest.png" />
-    <Resource Include="cordovalib\Images\appbar.stop.rest.png" />
-    <Content Include="cordovalib\resources\notification-beep.wav" />
+    
     <Content Include="CordovaSourceDictionary.xml">
       <SubType>Designer</SubType>
     </Content>
@@ -211,7 +174,8 @@
     <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="Plugins\" />
+      <Compile Include="Plugins\*" />
+      <Compile Include="Plugins\UI\*.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
   <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/4551e1e5/templates/standalone/CordovaSourceDictionary.xml
----------------------------------------------------------------------
diff --git a/templates/standalone/CordovaSourceDictionary.xml b/templates/standalone/CordovaSourceDictionary.xml
index 0e3967b..74f51b7 100644
--- a/templates/standalone/CordovaSourceDictionary.xml
+++ b/templates/standalone/CordovaSourceDictionary.xml
@@ -1,8 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- This file is auto-generated, do not edit! -jm -->
 <CordovaSourceDictionary>
+    <FilePath Value="www\cordova-2.6.0.js"/>
+    <FilePath Value="www\index.html"/>
+    <FilePath Value="www\css\index.css"/>
     <FilePath Value="www\img\logo.png"/>
     <FilePath Value="www\js\index.js"/>
-    <FilePath Value="www\css\index.css"/>
-    <FilePath Value="www\index.html"/>
 </CordovaSourceDictionary>

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/4551e1e5/templates/standalone/Plugins/Accelerometer.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/Accelerometer.cs b/templates/standalone/Plugins/Accelerometer.cs
new file mode 100644
index 0000000..cba911c
--- /dev/null
+++ b/templates/standalone/Plugins/Accelerometer.cs
@@ -0,0 +1,196 @@
+/*  
+	Licensed under the Apache License, Version 2.0 (the "License");
+	you may not use this file except in compliance with the License.
+	You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0
+	
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+*/
+
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using System.Threading;
+using Microsoft.Devices.Sensors;
+using System.Globalization;
+using System.Diagnostics;
+
+namespace WPCordovaClassLib.Cordova.Commands
+{
+    /// <summary>
+    /// Captures device motion in the x, y, and z direction.
+    /// </summary>
+    public class Accelerometer : BaseCommand
+    {
+        #region AccelerometerOptions class
+        /// <summary>
+        /// Represents Accelerometer options.
+        /// </summary>
+        [DataContract]
+        public class AccelerometerOptions
+        {
+            /// <summary>
+            /// How often to retrieve the Acceleration in milliseconds
+            /// </summary>
+            [DataMember(IsRequired = false, Name = "frequency")]
+            public int Frequency { get; set; }
+
+            /// <summary>
+            /// Watcher id
+            /// </summary>
+            [DataMember(IsRequired = false, Name = "id")]
+            public string Id { get; set; }
+
+            /// <summary>
+            /// Creates options object with default parameters
+            /// </summary>
+            public AccelerometerOptions()
+            {
+                this.SetDefaultValues(new StreamingContext());
+            }
+
+            /// <summary>
+            /// Initializes default values for class fields.
+            /// Implemented in separate method because default constructor is not invoked during deserialization.
+            /// </summary>
+            /// <param name="context"></param>
+            [OnDeserializing()]
+            public void SetDefaultValues(StreamingContext context)
+            {
+                this.Frequency = 10000;
+            }
+        }
+
+        #endregion
+
+        #region Status codes and Constants
+
+        public const int Stopped = 0;
+        public const int Starting = 1;
+        public const int Running = 2;
+        public const int ErrorFailedToStart = 3;
+
+        public const double gConstant = -9.81;
+
+        #endregion
+
+        #region Static members
+
+        /// <summary>
+        /// Status of listener
+        /// </summary>
+        private static int currentStatus;
+
+        /// <summary>
+        /// Accelerometer
+        /// </summary>
+        private static Microsoft.Devices.Sensors.Accelerometer accelerometer = new Microsoft.Devices.Sensors.Accelerometer();
+
+        private static DateTime StartOfEpoch = new DateTime(1970, 1, 1, 0, 0, 0);
+
+        #endregion
+
+        /// <summary>
+        /// Sensor listener event
+        /// </summary>        
+        private void accelerometer_CurrentValueChanged(object sender, SensorReadingEventArgs<AccelerometerReading> e)
+        {
+            this.SetStatus(Running);
+
+            PluginResult result = new PluginResult(PluginResult.Status.OK, GetCurrentAccelerationFormatted());
+            result.KeepCallback = true;
+            DispatchCommandResult(result);
+        }
+
+        /// <summary>
+        /// Starts listening for acceleration sensor
+        /// </summary>
+        /// <returns>status of listener</returns>
+        public void start(string options)
+        {
+            if ((currentStatus == Running) || (currentStatus == Starting))
+            {
+                return;
+            }
+            try
+            {
+                lock (accelerometer)
+                {
+                    accelerometer.CurrentValueChanged += accelerometer_CurrentValueChanged;
+                    accelerometer.Start();
+                    this.SetStatus(Starting);
+                }
+
+                long timeout = 2000;
+                while ((currentStatus == Starting) && (timeout > 0))
+                {
+                    timeout = timeout - 100;
+                    Thread.Sleep(100);
+                }
+
+                if (currentStatus != Running)
+                {
+                    this.SetStatus(ErrorFailedToStart);
+                    DispatchCommandResult(new PluginResult(PluginResult.Status.IO_EXCEPTION, ErrorFailedToStart));
+                    return;
+                }
+            }
+            catch (Exception)
+            {
+                this.SetStatus(ErrorFailedToStart);
+                DispatchCommandResult(new PluginResult(PluginResult.Status.IO_EXCEPTION, ErrorFailedToStart));
+                return;
+            }
+            PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
+            result.KeepCallback = true;
+            DispatchCommandResult(result);
+        }
+
+        public void stop(string options)
+        {
+            if (currentStatus == Running)
+            {
+                lock (accelerometer)
+                {
+                    accelerometer.CurrentValueChanged -= accelerometer_CurrentValueChanged;
+                    accelerometer.Stop();
+                    this.SetStatus(Stopped);
+                }
+            }
+            DispatchCommandResult(new PluginResult(PluginResult.Status.OK));
+        }
+
+        /// <summary>
+        /// Formats current coordinates into JSON format
+        /// </summary>
+        /// <returns>Coordinates in JSON format</returns>
+        private string GetCurrentAccelerationFormatted()
+        {
+            // convert to unix timestamp
+            // long timestamp = ((accelerometer.CurrentValue.Timestamp.DateTime - StartOfEpoch).Ticks) / 10000;
+            // Note: Removed timestamp, to let the JS side create it using (new Date().getTime()) -jm
+            // this resolves an issue with inconsistencies between JS dates and Native DateTime 
+            string resultCoordinates = String.Format("\"x\":{0},\"y\":{1},\"z\":{2}",
+                            (accelerometer.CurrentValue.Acceleration.X * gConstant).ToString("0.00000", CultureInfo.InvariantCulture),
+                            (accelerometer.CurrentValue.Acceleration.Y * gConstant).ToString("0.00000", CultureInfo.InvariantCulture),
+                            (accelerometer.CurrentValue.Acceleration.Z * gConstant).ToString("0.00000", CultureInfo.InvariantCulture));
+            return  "{" + resultCoordinates + "}";
+        }
+
+        /// <summary>
+        /// Sets current status
+        /// </summary>
+        /// <param name="status">current status</param>
+        private void SetStatus(int status)
+        {
+            currentStatus = status;
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/4551e1e5/templates/standalone/Plugins/AudioFormatsHelper.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/AudioFormatsHelper.cs b/templates/standalone/Plugins/AudioFormatsHelper.cs
new file mode 100644
index 0000000..dca7ee6
--- /dev/null
+++ b/templates/standalone/Plugins/AudioFormatsHelper.cs
@@ -0,0 +1,89 @@
+/*  
+	Licensed under the Apache License, Version 2.0 (the "License");
+	you may not use this file except in compliance with the License.
+	You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0
+	
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+
+ */
+
+using System;
+using System.IO;
+
+namespace WPCordovaClassLib.Cordova.Commands
+{
+    /// <summary>
+    /// Provides extra functionality to support different audio formats.
+    /// </summary>
+    public static class AudioFormatsHelper
+    {
+        #region Wav
+        /// <summary>
+        /// Adds wav file format header to the stream
+        /// https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
+        /// </summary>
+        /// <param name="stream">The stream</param>
+        /// <param name="sampleRate">Sample Rate</param>
+        public static void InitializeWavStream(this Stream stream, int sampleRate)
+        {
+            #region args checking
+
+            if (stream == null) 
+            {
+                throw new ArgumentNullException("stream can't be null or empty");
+            }
+
+            #endregion
+
+            int numBits = 16;
+            int numBytes = numBits / 8;
+
+            stream.Write(System.Text.Encoding.UTF8.GetBytes("RIFF"), 0, 4);
+            stream.Write(BitConverter.GetBytes(0), 0, 4);
+            stream.Write(System.Text.Encoding.UTF8.GetBytes("WAVE"), 0, 4);
+            stream.Write(System.Text.Encoding.UTF8.GetBytes("fmt "), 0, 4);
+            stream.Write(BitConverter.GetBytes(16), 0, 4);
+            stream.Write(BitConverter.GetBytes((short)1), 0, 2);
+            stream.Write(BitConverter.GetBytes((short)1), 0, 2);
+            stream.Write(BitConverter.GetBytes(sampleRate), 0, 4);
+            stream.Write(BitConverter.GetBytes(sampleRate * numBytes), 0, 4);
+            stream.Write(BitConverter.GetBytes((short)(numBytes)), 0, 2);
+            stream.Write(BitConverter.GetBytes((short)(numBits)), 0, 2);
+            stream.Write(System.Text.Encoding.UTF8.GetBytes("data"), 0, 4);
+            stream.Write(BitConverter.GetBytes(0), 0, 4);
+        }
+
+        /// <summary>
+        /// Updates wav file format header
+        /// https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
+        /// </summary>
+        /// <param name="stream">Wav stream</param>
+        public static void UpdateWavStream(this Stream stream)
+        {
+            #region args checking
+
+            if (stream == null)
+            {
+                throw new ArgumentNullException("stream can't be null or empty");
+            }
+
+            #endregion
+
+            var position = stream.Position;
+
+            stream.Seek(4, SeekOrigin.Begin);
+            stream.Write(BitConverter.GetBytes((int)stream.Length - 8), 0, 4);
+            stream.Seek(40, SeekOrigin.Begin);
+            stream.Write(BitConverter.GetBytes((int)stream.Length - 44), 0, 4);
+            stream.Seek(position, SeekOrigin.Begin);
+        }
+
+        #endregion
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/4551e1e5/templates/standalone/Plugins/AudioPlayer.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/AudioPlayer.cs b/templates/standalone/Plugins/AudioPlayer.cs
new file mode 100644
index 0000000..a83be5b
--- /dev/null
+++ b/templates/standalone/Plugins/AudioPlayer.cs
@@ -0,0 +1,620 @@
+/*  
+	Licensed under the Apache License, Version 2.0 (the "License");
+	you may not use this file except in compliance with the License.
+	You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0
+	
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+*/
+
+using System;
+using System.IO;
+using System.IO.IsolatedStorage;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Threading;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Audio;
+using Microsoft.Xna.Framework.Media;
+using Microsoft.Phone.Controls;
+using System.Diagnostics;
+using System.Windows.Resources;
+
+namespace WPCordovaClassLib.Cordova.Commands
+{
+    /// <summary>
+    /// Implements audio record and play back functionality.
+    /// </summary>
+    internal class AudioPlayer : IDisposable
+    {
+        #region Constants
+
+        // AudioPlayer states
+        private const int PlayerState_None = 0;
+        private const int PlayerState_Starting = 1;
+        private const int PlayerState_Running = 2;
+        private const int PlayerState_Paused = 3;
+        private const int PlayerState_Stopped = 4;
+
+        // AudioPlayer messages
+        private const int MediaState = 1;
+        private const int MediaDuration = 2;
+        private const int MediaPosition = 3;
+        private const int MediaError = 9;
+
+        // AudioPlayer errors
+        private const int MediaErrorPlayModeSet = 1;
+        private const int MediaErrorAlreadyRecording = 2;
+        private const int MediaErrorStartingRecording = 3;
+        private const int MediaErrorRecordModeSet = 4;
+        private const int MediaErrorStartingPlayback = 5;
+        private const int MediaErrorResumeState = 6;
+        private const int MediaErrorPauseState = 7;
+        private const int MediaErrorStopState = 8;
+
+        //TODO: get rid of this callback, it should be universal
+        //private const string CallbackFunction = "CordovaMediaonStatus";
+
+        #endregion
+
+        /// <summary>
+        /// The AudioHandler object
+        /// </summary>
+        private Media handler;
+
+        /// <summary>
+        /// Temporary buffer to store audio chunk
+        /// </summary>
+        private byte[] buffer;
+
+        /// <summary>
+        /// Xna game loop dispatcher
+        /// </summary>
+        DispatcherTimer dtXna;
+
+        /// <summary>
+        /// Output buffer
+        /// </summary>
+        private MemoryStream memoryStream;
+
+        /// <summary>
+        /// The id of this player (used to identify Media object in JavaScript)
+        /// </summary>
+        private String id;
+
+        /// <summary>
+        /// State of recording or playback
+        /// </summary>
+        private int state = PlayerState_None;
+
+        /// <summary>
+        /// File name to play or record to
+        /// </summary>
+        private String audioFile = null;
+
+        /// <summary>
+        /// Duration of audio
+        /// </summary>
+        private double duration = -1;
+
+        /// <summary>
+        /// Audio player object
+        /// </summary>
+        private MediaElement player = null;
+
+        /// <summary>
+        /// Audio source
+        /// </summary>
+        private Microphone recorder;
+
+        /// <summary>
+        /// Internal flag specified that we should only open audio w/o playing it
+        /// </summary>
+        private bool prepareOnly = false;
+
+        /// <summary>
+        /// Creates AudioPlayer instance
+        /// </summary>
+        /// <param name="handler">Media object</param>
+        /// <param name="id">player id</param>
+        public AudioPlayer(Media handler, String id)
+        {
+            this.handler = handler;
+            this.id = id;
+        }
+
+        /// <summary>
+        /// Destroys player and stop audio playing or recording
+        /// </summary>
+        public void Dispose()
+        {
+            if (this.player != null)
+            {
+                this.stopPlaying();
+                this.player = null;
+            }
+            if (this.recorder != null)
+            {
+                this.stopRecording();
+                this.recorder = null;
+            }
+
+            this.FinalizeXnaGameLoop();
+        }
+
+        private void InvokeCallback(int message, string value, bool removeHandler)
+        {
+            string args = string.Format("('{0}',{1},{2});", this.id, message, value);
+            string callback = @"(function(id,msg,value){
+                try {
+                    if (msg == Media.MEDIA_ERROR) {
+                        value = {'code':value};
+                    }
+                    Media.onStatus(id,msg,value);
+                }
+                catch(e) {
+                    console.log('Error calling Media.onStatus :: ' + e);
+                }
+            })" + args;
+            this.handler.InvokeCustomScript(new ScriptCallback("eval", new string[] { callback }), false);
+        }
+
+        private void InvokeCallback(int message, int value, bool removeHandler)
+        {
+            InvokeCallback(message, value.ToString(), removeHandler);
+        }
+
+        private void InvokeCallback(int message, double value, bool removeHandler)
+        {
+            InvokeCallback(message, value.ToString(), removeHandler);
+        }
+
+        /// <summary>
+        /// Starts recording, data is stored in memory
+        /// </summary>
+        /// <param name="filePath"></param>
+        public void startRecording(string filePath)
+        {
+            if (this.player != null)
+            {
+                InvokeCallback(MediaError, MediaErrorPlayModeSet, false);
+            }
+            else if (this.recorder == null)
+            {
+                try
+                {
+                    this.audioFile = filePath;
+                    this.InitializeXnaGameLoop();
+                    this.recorder = Microphone.Default;
+                    this.recorder.BufferDuration = TimeSpan.FromMilliseconds(500);
+                    this.buffer = new byte[recorder.GetSampleSizeInBytes(this.recorder.BufferDuration)];
+                    this.recorder.BufferReady += new EventHandler<EventArgs>(recorderBufferReady);
+                    this.memoryStream = new MemoryStream();
+                    this.memoryStream.InitializeWavStream(this.recorder.SampleRate);
+                    this.recorder.Start();
+                    FrameworkDispatcher.Update();
+                    this.SetState(PlayerState_Running);
+                }
+                catch (Exception)
+                {
+                    InvokeCallback(MediaError, MediaErrorStartingRecording, false);
+                    //this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaError, MediaErrorStartingRecording),false);
+                }
+            }
+            else
+            {
+                InvokeCallback(MediaError, MediaErrorAlreadyRecording, false);
+                //this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaError, MediaErrorAlreadyRecording),false);
+            }
+        }
+
+        /// <summary>
+        /// Stops recording
+        /// </summary>
+        public void stopRecording()
+        {
+            if (this.recorder != null)
+            {
+                if (this.state == PlayerState_Running)
+                {
+                    try
+                    {
+                        this.recorder.Stop();
+                        this.recorder.BufferReady -= recorderBufferReady;
+                        this.recorder = null;
+                        SaveAudioClipToLocalStorage();
+                        this.FinalizeXnaGameLoop();
+                        this.SetState(PlayerState_Stopped);
+                    }
+                    catch (Exception)
+                    {
+                        //TODO 
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// Starts or resume playing audio file
+        /// </summary>
+        /// <param name="filePath">The name of the audio file</param>
+        /// <summary>
+        /// Starts or resume playing audio file
+        /// </summary>
+        /// <param name="filePath">The name of the audio file</param>
+        public void startPlaying(string filePath)
+        {
+            if (this.recorder != null)
+            {
+                InvokeCallback(MediaError, MediaErrorRecordModeSet, false);
+                //this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaError, MediaErrorRecordModeSet),false);
+                return;
+            }
+
+
+            if (this.player == null || this.player.Source.AbsolutePath.LastIndexOf(filePath) < 0)
+            {
+                try
+                {
+                    // this.player is a MediaElement, it must be added to the visual tree in order to play
+                    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)
+                            {
+
+                                this.player = grid.FindName("playerMediaElement") as MediaElement;
+                                if (this.player == null) // still null ?
+                                {
+                                    this.player = new MediaElement();
+                                    this.player.Name = "playerMediaElement";
+                                    grid.Children.Add(this.player);
+                                    this.player.Visibility = Visibility.Visible;
+                                }
+                                if (this.player.CurrentState == System.Windows.Media.MediaElementState.Playing)
+                                {
+                                    this.player.Stop(); // stop it!
+                                }
+                                
+                                this.player.Source = null; // Garbage collect it.
+                                this.player.MediaOpened += MediaOpened;
+                                this.player.MediaEnded += MediaEnded;
+                                this.player.MediaFailed += MediaFailed;
+                            }
+                        }
+                    }
+
+                    this.audioFile = filePath;
+
+                    Uri uri = new Uri(filePath, UriKind.RelativeOrAbsolute);
+                    if (uri.IsAbsoluteUri)
+                    {
+                        this.player.Source = uri;
+                    }
+                    else
+                    {
+                        using (IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForApplication())
+                        {
+                            if (!isoFile.FileExists(filePath))
+                            {
+                                // try to unpack it from the dll into isolated storage
+                                StreamResourceInfo fileResourceStreamInfo = Application.GetResourceStream(new Uri(filePath, UriKind.Relative));
+                                if (fileResourceStreamInfo != null)
+                                {
+                                    using (BinaryReader br = new BinaryReader(fileResourceStreamInfo.Stream))
+                                    {
+                                        byte[] data = br.ReadBytes((int)fileResourceStreamInfo.Stream.Length);          
+
+                                        string[] dirParts = filePath.Split('/');
+                                        string dirName = "";
+                                        for (int n = 0; n < dirParts.Length - 1; n++)
+                                        {
+                                            dirName += dirParts[n] + "/";
+                                        }
+                                        if (!isoFile.DirectoryExists(dirName))
+                                        {
+                                            isoFile.CreateDirectory(dirName);
+                                        }
+
+                                        using (IsolatedStorageFileStream outFile = isoFile.OpenFile(filePath, FileMode.Create))
+                                        {
+                                            using (BinaryWriter writer = new BinaryWriter(outFile))
+                                            {
+                                                writer.Write(data);
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                            if (isoFile.FileExists(filePath))
+                            {
+                                using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(filePath, FileMode.Open, isoFile))
+                                {
+                                    this.player.SetSource(stream);
+                                }
+                            }
+                            else
+                            {
+                                InvokeCallback(MediaError, MediaErrorPlayModeSet, false);
+                                //this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaError, 1), false);
+                                return;
+                            }
+                        }
+                    }
+                    this.SetState(PlayerState_Starting);
+                }
+                catch (Exception e)
+                {
+                    Debug.WriteLine("Error in AudioPlayer::startPlaying : " + e.Message);
+                    InvokeCallback(MediaError, MediaErrorStartingPlayback, false);
+                    //this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaError, MediaErrorStartingPlayback),false);
+                }
+            }
+            else
+            {
+                if (this.state != PlayerState_Running)
+                {
+                    this.player.Play();
+                    this.SetState(PlayerState_Running);
+                }
+                else
+                {
+                    InvokeCallback(MediaError, MediaErrorResumeState, false);
+                    //this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaError, MediaErrorResumeState),false);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Callback to be invoked when the media source is ready for playback
+        /// </summary>
+        private void MediaOpened(object sender, RoutedEventArgs arg)
+        {
+            if (this.player != null)
+            {
+                this.duration = this.player.NaturalDuration.TimeSpan.TotalSeconds;
+                InvokeCallback(MediaDuration, this.duration, false);
+                //this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaDuration, this.duration),false);
+                if (!this.prepareOnly)
+                {
+                    this.player.Play();
+                    this.SetState(PlayerState_Running);
+                }
+                this.prepareOnly = false;
+            }
+            else
+            {
+                // TODO: occasionally MediaOpened is signalled, but player is null
+            }
+        }
+
+        /// <summary>
+        /// Callback to be invoked when playback of a media source has completed
+        /// </summary>
+        private void MediaEnded(object sender, RoutedEventArgs arg)
+        {
+            this.SetState(PlayerState_Stopped);
+        }
+
+        /// <summary>
+        /// Callback to be invoked when playback of a media source has failed
+        /// </summary>
+        private void MediaFailed(object sender, RoutedEventArgs arg)
+        {
+            player.Stop();
+            InvokeCallback(MediaError, MediaErrorStartingPlayback, false);
+            //this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaError.ToString(), "Media failed"),false);
+        }
+
+        /// <summary>
+        /// Seek or jump to a new time in the track
+        /// </summary>
+        /// <param name="milliseconds">The new track position</param>
+        public void seekToPlaying(int milliseconds)
+        {
+            if (this.player != null)
+            {
+                TimeSpan tsPos = new TimeSpan(0, 0, 0, 0, milliseconds);
+                this.player.Position = tsPos;
+                InvokeCallback(MediaPosition, milliseconds / 1000.0f, false);
+                //this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaPosition, milliseconds / 1000.0f),false);
+            }
+        }
+
+        /// <summary>
+        /// Set the volume of the player
+        /// </summary>
+        /// <param name="vol">volume 0.0-1.0, default value is 0.5</param>
+        public void setVolume(double vol)
+        {
+            if (this.player != null)
+            {
+                this.player.Volume = vol;
+            }
+        }
+
+        /// <summary>
+        /// Pauses playing
+        /// </summary>
+        public void pausePlaying()
+        {
+            if (this.state == PlayerState_Running)
+            {
+                this.player.Pause();
+                this.SetState(PlayerState_Paused);
+            }
+            else
+            {
+                InvokeCallback(MediaError, MediaErrorPauseState, false);
+                //this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaError, MediaErrorPauseState),false);
+            }
+        }
+
+
+        /// <summary>
+        /// Stops playing the audio file
+        /// </summary>
+        public void stopPlaying()
+        {
+            if ((this.state == PlayerState_Running) || (this.state == PlayerState_Paused))
+            {
+                this.player.Stop();
+
+                this.player.Position = new TimeSpan(0L);
+                this.SetState(PlayerState_Stopped);
+            }
+            //else // Why is it an error to call stop on a stopped media?
+            //{
+            //    this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaError, MediaErrorStopState), false);
+            //}
+        }
+
+        /// <summary>
+        /// Gets current position of playback
+        /// </summary>
+        /// <returns>current position</returns>
+        public double getCurrentPosition()
+        {
+            if ((this.state == PlayerState_Running) || (this.state == PlayerState_Paused))
+            {
+                double currentPosition = this.player.Position.TotalSeconds;
+                //this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaPosition, currentPosition),false);
+                return currentPosition;
+            }
+            else
+            {
+                return 0;
+            }
+        }
+
+        /// <summary>
+        /// Gets the duration of the audio file
+        /// </summary>
+        /// <param name="filePath">The name of the audio file</param>
+        /// <returns>track duration</returns>
+        public double getDuration(string filePath)
+        {
+            if (this.recorder != null)
+            {
+                return (-2);
+            }
+
+            if (this.player != null)
+            {
+                return this.duration;
+
+            }
+            else
+            {
+                this.prepareOnly = true;
+                this.startPlaying(filePath);
+                return this.duration;
+            }
+        }
+
+        /// <summary>
+        /// Sets the state and send it to JavaScript
+        /// </summary>
+        /// <param name="state">state</param>
+        private void SetState(int state)
+        {
+            if (this.state != state)
+            {
+                InvokeCallback(MediaState, state, false);
+                //this.handler.InvokeCustomScript(new ScriptCallback(CallbackFunction, this.id, MediaState, state),false);
+            }
+
+            this.state = state;
+        }
+
+        #region record methods
+
+        /// <summary>
+        /// Copies data from recorder to memory storages and updates recording state
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void recorderBufferReady(object sender, EventArgs e)
+        {
+            this.recorder.GetData(this.buffer);
+            this.memoryStream.Write(this.buffer, 0, this.buffer.Length);
+        }
+
+        /// <summary>
+        /// Writes audio data from memory to isolated storage
+        /// </summary>
+        /// <returns></returns>
+        private void SaveAudioClipToLocalStorage()
+        {
+            if (this.memoryStream == null || this.memoryStream.Length <= 0)
+            {
+                return;
+            }
+
+            this.memoryStream.UpdateWavStream();
+
+            try
+            {
+                using (IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForApplication())
+                {
+                    string directory = Path.GetDirectoryName(audioFile);
+
+                    if (!isoFile.DirectoryExists(directory))
+                    {
+                        isoFile.CreateDirectory(directory);
+                    }
+
+                    this.memoryStream.Seek(0, SeekOrigin.Begin);
+
+                    using (IsolatedStorageFileStream fileStream = isoFile.CreateFile(audioFile))
+                    {
+                        this.memoryStream.CopyTo(fileStream);
+                    }
+                }
+            }
+            catch (Exception)
+            {
+                //TODO: log or do something else
+                throw;
+            }
+        }    
+
+        #region Xna loop
+        /// <summary>
+        /// Special initialization required for the microphone: XNA game loop
+        /// </summary>
+        private void InitializeXnaGameLoop()
+        {
+            // Timer to simulate the XNA game loop (Microphone is from XNA)
+            this.dtXna = new DispatcherTimer();
+            this.dtXna.Interval = TimeSpan.FromMilliseconds(33);
+            this.dtXna.Tick += delegate { try { FrameworkDispatcher.Update(); } catch { } };
+            this.dtXna.Start();
+        }
+        /// <summary>
+        /// Finalizes XNA game loop for microphone
+        /// </summary>
+        private void FinalizeXnaGameLoop()
+        {
+            // Timer to simulate the XNA game loop (Microphone is from XNA)
+            if (this.dtXna != null)
+            {
+                this.dtXna.Stop();
+                this.dtXna = null;
+            }
+        }
+
+        #endregion
+
+        #endregion
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/4551e1e5/templates/standalone/Plugins/Battery.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/Battery.cs b/templates/standalone/Plugins/Battery.cs
new file mode 100644
index 0000000..962959e
--- /dev/null
+++ b/templates/standalone/Plugins/Battery.cs
@@ -0,0 +1,79 @@
+/*  
+	Licensed under the Apache License, Version 2.0 (the "License");
+	you may not use this file except in compliance with the License.
+	You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0
+	
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+*/
+
+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.Info;
+
+namespace WPCordovaClassLib.Cordova.Commands
+{
+    /// <summary>
+    /// Listens for changes to the state of the battery on the device.
+    /// Currently only the "isPlugged" parameter available via native APIs.
+    /// </summary>
+    public class Battery : BaseCommand
+    {
+        private bool isPlugged = false;
+        private EventHandler powerChanged;
+
+        public Battery()
+        {
+            powerChanged = new EventHandler(DeviceStatus_PowerSourceChanged);
+            isPlugged = DeviceStatus.PowerSource.ToString().CompareTo("External") == 0;
+        }
+
+        public void start(string options)
+        {
+            // Register power changed event handler
+            DeviceStatus.PowerSourceChanged += powerChanged;
+
+            PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
+            result.KeepCallback = true;
+            DispatchCommandResult(result);
+        }
+        public void stop(string options)
+        {
+            // Unregister power changed event handler
+            DeviceStatus.PowerSourceChanged -= powerChanged;
+        }
+
+        private void DeviceStatus_PowerSourceChanged(object sender, EventArgs e)
+        {
+            isPlugged = DeviceStatus.PowerSource.ToString().CompareTo("External") == 0;
+            PluginResult result = new PluginResult(PluginResult.Status.OK, GetCurrentBatteryStateFormatted());
+            result.KeepCallback = true;
+            DispatchCommandResult(result);
+        }
+
+        private string GetCurrentBatteryStateFormatted()
+        {
+            string batteryState = String.Format("\"level\":{0},\"isPlugged\":{1}",
+                                                    "null",
+                                                    isPlugged ? "true" : "false"
+                            );
+            batteryState = "{" + batteryState + "}";
+            return batteryState;
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/4551e1e5/templates/standalone/Plugins/Camera.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/Camera.cs b/templates/standalone/Plugins/Camera.cs
new file mode 100644
index 0000000..5ff8045
--- /dev/null
+++ b/templates/standalone/Plugins/Camera.cs
@@ -0,0 +1,490 @@
+/*  
+	Licensed under the Apache License, Version 2.0 (the "License");
+	you may not use this file except in compliance with the License.
+	You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0
+	
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+*/
+
+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.Collections.Generic;
+using Microsoft.Phone.Tasks;
+using System.Runtime.Serialization;
+using System.IO;
+using System.IO.IsolatedStorage;
+using System.Windows.Media.Imaging;
+using Microsoft.Phone;
+using Microsoft.Xna.Framework.Media;
+using System.Diagnostics;
+
+namespace WPCordovaClassLib.Cordova.Commands
+{
+    public class Camera : BaseCommand
+    {
+
+        /// <summary>
+        /// Return base64 encoded string
+        /// </summary>
+        private const int DATA_URL = 0;
+
+        /// <summary>
+        /// Return file uri
+        /// </summary>
+        private const int FILE_URI = 1;
+
+        /// <summary>
+        /// Choose image from picture library
+        /// </summary>
+        private const int PHOTOLIBRARY = 0;
+
+        /// <summary>
+        /// Take picture from camera
+        /// </summary>
+
+        private const int CAMERA = 1;
+
+        /// <summary>
+        /// Choose image from picture library
+        /// </summary>
+        private const int SAVEDPHOTOALBUM = 2;
+
+        /// <summary>
+        /// Take a picture of type JPEG
+        /// </summary>
+        private const int JPEG = 0;
+
+        /// <summary>
+        /// Take a picture of type PNG
+        /// </summary>
+        private const int PNG = 1;
+
+        /// <summary>
+        /// Folder to store captured images
+        /// </summary>
+        private const string isoFolder = "CapturedImagesCache";
+
+        /// <summary>
+        /// Represents captureImage action options.
+        /// </summary>
+        [DataContract]
+        public class CameraOptions
+        {
+            /// <summary>
+            /// Source to getPicture from.
+            /// </summary>
+            [DataMember(IsRequired = false, Name = "sourceType")]
+            public int PictureSourceType { get; set; }
+
+            /// <summary>
+            /// Format of image that returned from getPicture.
+            /// </summary>
+            [DataMember(IsRequired = false, Name = "destinationType")]
+            public int DestinationType { get; set; }
+
+            /// <summary>
+            /// Quality of saved image
+            /// </summary>
+            [DataMember(IsRequired = false, Name = "quality")]
+            public int Quality { get; set; }
+
+            /// <summary>
+            /// Controls whether or not the image is also added to the device photo album.
+            /// </summary>
+            [DataMember(IsRequired = false, Name = "saveToPhotoAlbum")]
+            public bool SaveToPhotoAlbum { get; set; }
+
+            /// <summary>
+            /// Ignored
+            /// </summary>
+            [DataMember(IsRequired = false, Name = "correctOrientation")]
+            public bool CorrectOrientation { get; set; }
+
+            
+
+            /// <summary>
+            /// Ignored
+            /// </summary>
+            [DataMember(IsRequired = false, Name = "allowEdit")]
+            public bool AllowEdit { get; set; }
+
+                        /// <summary>
+            /// Height in pixels to scale image
+            /// </summary>
+            [DataMember(IsRequired = false, Name = "encodingType")]
+            public int EncodingType { get; set; }
+
+                        /// <summary>
+            /// Height in pixels to scale image
+            /// </summary>
+            [DataMember(IsRequired = false, Name = "mediaType")]
+            public int MediaType { get; set; }
+
+
+            /// <summary>
+            /// Height in pixels to scale image
+            /// </summary>
+            [DataMember(IsRequired = false, Name = "targetHeight")]
+            public int TargetHeight { get; set; }
+
+
+            /// <summary>
+            /// Width in pixels to scale image
+            /// </summary>
+            [DataMember(IsRequired = false, Name = "targetWidth")]
+            public int TargetWidth { get; set; }
+
+            /// <summary>
+            /// Creates options object with default parameters
+            /// </summary>
+            public CameraOptions()
+            {
+                this.SetDefaultValues(new StreamingContext());
+            }
+
+            /// <summary>
+            /// Initializes default values for class fields.
+            /// Implemented in separate method because default constructor is not invoked during deserialization.
+            /// </summary>
+            /// <param name="context"></param>
+            [OnDeserializing()]
+            public void SetDefaultValues(StreamingContext context)
+            {
+                PictureSourceType = CAMERA;
+                DestinationType = FILE_URI;
+                Quality = 80;
+                TargetHeight = -1;
+                TargetWidth = -1;
+                SaveToPhotoAlbum = false;
+                CorrectOrientation = true;
+                AllowEdit = false;
+                MediaType = -1;
+                EncodingType = -1;
+            }
+        }
+
+        /// <summary>
+        /// Used to open photo library
+        /// </summary>
+        PhotoChooserTask photoChooserTask;
+
+        /// <summary>
+        /// Used to open camera application
+        /// </summary>
+        CameraCaptureTask cameraTask;
+
+        /// <summary>
+        /// Camera options
+        /// </summary>
+        CameraOptions cameraOptions;
+
+        public void takePicture(string options)
+        {
+            try
+            {
+                string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+                // ["quality", "destinationType", "sourceType", "targetWidth", "targetHeight", "encodingType",
+                //     "mediaType", "allowEdit", "correctOrientation", "saveToPhotoAlbum" ]
+                this.cameraOptions = new CameraOptions();
+                this.cameraOptions.Quality = int.Parse(args[0]);
+                this.cameraOptions.DestinationType = int.Parse(args[1]);
+                this.cameraOptions.PictureSourceType = int.Parse(args[2]);
+                this.cameraOptions.TargetWidth = int.Parse(args[3]);
+                this.cameraOptions.TargetHeight = int.Parse(args[4]);
+                this.cameraOptions.EncodingType = int.Parse(args[5]);
+                this.cameraOptions.MediaType = int.Parse(args[6]);
+                this.cameraOptions.AllowEdit = bool.Parse(args[7]);
+                this.cameraOptions.CorrectOrientation = bool.Parse(args[8]);
+                this.cameraOptions.SaveToPhotoAlbum = bool.Parse(args[9]);
+                
+                //this.cameraOptions = String.IsNullOrEmpty(options) ?
+                //        new CameraOptions() : JSON.JsonHelper.Deserialize<CameraOptions>(options);
+            }
+            catch (Exception ex)
+            {
+                this.DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION, ex.Message));
+                return;
+            }
+
+            //TODO Check if all the options are acceptable
+
+
+            if (cameraOptions.PictureSourceType == CAMERA)
+            {
+                cameraTask = new CameraCaptureTask();
+                cameraTask.Completed += onCameraTaskCompleted;
+                cameraTask.Show();
+            }
+            else
+            {
+                if ((cameraOptions.PictureSourceType == PHOTOLIBRARY) || (cameraOptions.PictureSourceType == SAVEDPHOTOALBUM))
+                {
+                    photoChooserTask = new PhotoChooserTask();
+                    photoChooserTask.Completed += onPickerTaskCompleted;
+                    photoChooserTask.Show();
+                }
+                else
+                {
+                    DispatchCommandResult(new PluginResult(PluginResult.Status.NO_RESULT));
+                }
+            }
+
+        }
+
+        public void onCameraTaskCompleted(object sender, PhotoResult e)
+        {
+            if (e.Error != null)
+            {
+                DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR));
+                return;
+            }
+
+            switch (e.TaskResult)
+            {
+                case TaskResult.OK:
+                    try
+                    {
+                        string imagePathOrContent = string.Empty;
+
+                        if (cameraOptions.DestinationType == FILE_URI)
+                        {
+                            // Save image in media library
+                            if (cameraOptions.SaveToPhotoAlbum)
+                            {
+                                MediaLibrary library = new MediaLibrary();
+                                Picture pict = library.SavePicture(e.OriginalFileName, e.ChosenPhoto); // to save to photo-roll ...
+                            }
+
+                            int orient = ImageExifHelper.getImageOrientationFromStream(e.ChosenPhoto);
+                            int newAngle = 0;
+                            switch (orient)
+                            {
+                                case ImageExifOrientation.LandscapeLeft:
+                                    newAngle = 90;
+                                    break;
+                                case ImageExifOrientation.PortraitUpsideDown:
+                                    newAngle = 180;
+                                    break;
+                                case ImageExifOrientation.LandscapeRight:
+                                    newAngle = 270;
+                                    break;
+                                case ImageExifOrientation.Portrait:
+                                default: break; // 0 default already set
+                            }
+
+                            Stream rotImageStream = ImageExifHelper.RotateStream(e.ChosenPhoto, newAngle);
+
+                            // we should return stream position back after saving stream to media library
+                            rotImageStream.Seek(0, SeekOrigin.Begin);
+
+                            WriteableBitmap image = PictureDecoder.DecodeJpeg(rotImageStream);
+
+                            imagePathOrContent = this.SaveImageToLocalStorage(image, Path.GetFileName(e.OriginalFileName));
+
+
+                        }
+                        else if (cameraOptions.DestinationType == DATA_URL)
+                        {
+                            imagePathOrContent = this.GetImageContent(e.ChosenPhoto);
+                        }
+                        else
+                        {
+                            // TODO: shouldn't this happen before we launch the camera-picker?
+                            DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Incorrect option: destinationType"));
+                            return;
+                        }
+
+                        DispatchCommandResult(new PluginResult(PluginResult.Status.OK, imagePathOrContent));
+
+                    }
+                    catch (Exception)
+                    {
+                        DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Error retrieving image."));
+                    }
+                    break;
+
+                case TaskResult.Cancel:
+                    DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Selection cancelled."));
+                    break;
+
+                default:
+                    DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Selection did not complete!"));
+                    break;
+            }
+
+        }
+
+        public void onPickerTaskCompleted(object sender, PhotoResult e)
+        {
+            if (e.Error != null)
+            {
+                DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR));
+                return;
+            }
+
+            switch (e.TaskResult)
+            {
+                case TaskResult.OK:
+                    try
+                    {
+                        string imagePathOrContent = string.Empty;
+
+                        if (cameraOptions.DestinationType == FILE_URI)
+                        {
+                            WriteableBitmap image = PictureDecoder.DecodeJpeg(e.ChosenPhoto);
+                            imagePathOrContent = this.SaveImageToLocalStorage(image, Path.GetFileName(e.OriginalFileName));
+                        }
+                        else if (cameraOptions.DestinationType == DATA_URL)
+                        {
+                            imagePathOrContent = this.GetImageContent(e.ChosenPhoto);
+
+                        }
+                        else
+                        {
+                            // TODO: shouldn't this happen before we launch the camera-picker?
+                            DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Incorrect option: destinationType"));
+                            return;
+                        }
+
+                        DispatchCommandResult(new PluginResult(PluginResult.Status.OK, imagePathOrContent));
+
+                    }
+                    catch (Exception)
+                    {
+                        DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Error retrieving image."));
+                    }
+                    break;
+
+                case TaskResult.Cancel:
+                    DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Selection cancelled."));
+                    break;
+
+                default:
+                    DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Selection did not complete!"));
+                    break;
+            }
+        }
+
+        /// <summary>
+        /// Returns image content in a form of base64 string
+        /// </summary>
+        /// <param name="stream">Image stream</param>
+        /// <returns>Base64 representation of the image</returns>
+        private string GetImageContent(Stream stream)
+        {
+            int streamLength = (int)stream.Length;
+            byte[] fileData = new byte[streamLength + 1];
+            stream.Read(fileData, 0, streamLength);
+
+            //use photo's actual width & height if user doesn't provide width & height
+            if (cameraOptions.TargetWidth < 0 && cameraOptions.TargetHeight < 0)
+            {
+                stream.Close();
+                return Convert.ToBase64String(fileData);
+            }
+            else
+            {
+                // resize photo
+                byte[] resizedFile = ResizePhoto(stream, fileData);
+                stream.Close();
+                return Convert.ToBase64String(resizedFile);
+            }
+        }
+
+        /// <summary>
+        /// Resize image
+        /// </summary>
+        /// <param name="stream">Image stream</param>
+        /// <param name="fileData">File data</param>
+        /// <returns>resized image</returns>
+        private byte[] ResizePhoto(Stream stream, byte[] fileData)
+        {
+            int streamLength = (int)stream.Length;
+            int intResult = 0;
+
+            byte[] resizedFile;
+
+            stream.Read(fileData, 0, streamLength);
+
+            BitmapImage objBitmap = new BitmapImage();
+            MemoryStream objBitmapStream = new MemoryStream(fileData);
+            MemoryStream objBitmapStreamResized = new MemoryStream();
+            WriteableBitmap objWB;
+            objBitmap.SetSource(stream);
+            objWB = new WriteableBitmap(objBitmap);
+
+            // resize the photo with user defined TargetWidth & TargetHeight
+            Extensions.SaveJpeg(objWB, objBitmapStreamResized, cameraOptions.TargetWidth, cameraOptions.TargetHeight, 0, cameraOptions.Quality);
+
+            //Convert the resized stream to a byte array. 
+            streamLength = (int)objBitmapStreamResized.Length;
+            resizedFile = new Byte[streamLength]; //-1 
+            objBitmapStreamResized.Position = 0;
+            //for some reason we have to set Position to zero, but we don't have to earlier when we get the bytes from the chosen photo... 
+            intResult = objBitmapStreamResized.Read(resizedFile, 0, streamLength);
+
+            return resizedFile;
+        }
+
+        /// <summary>
+        /// Saves captured image in isolated storage
+        /// </summary>
+        /// <param name="imageFileName">image file name</param>
+        /// <returns>Image path</returns>
+        private string SaveImageToLocalStorage(WriteableBitmap image, string imageFileName)
+        {
+
+            if (image == null)
+            {
+                throw new ArgumentNullException("imageBytes");
+            }
+            try
+            {
+
+
+                var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
+
+                if (!isoFile.DirectoryExists(isoFolder))
+                {
+                    isoFile.CreateDirectory(isoFolder);
+                }
+
+                string filePath = System.IO.Path.Combine("///" + isoFolder + "/", imageFileName);
+
+                using (var stream = isoFile.CreateFile(filePath))
+                {
+                    // resize image if Height and Width defined via options 
+                    if (cameraOptions.TargetHeight > 0 && cameraOptions.TargetWidth > 0)
+                    {
+                        image.SaveJpeg(stream, cameraOptions.TargetWidth, cameraOptions.TargetHeight, 0, cameraOptions.Quality);
+                    }
+                    else
+                    {
+                        image.SaveJpeg(stream, image.PixelWidth, image.PixelHeight, 0, cameraOptions.Quality);
+                    }
+                }
+
+                return new Uri(filePath, UriKind.Relative).ToString();
+            }
+            catch (Exception)
+            {
+                //TODO: log or do something else
+                throw;
+            }
+        }
+
+    }
+}


Mime
View raw message