cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwbro...@apache.org
Subject [20/37] Add WP7 and WP8 platform files.
Date Wed, 15 May 2013 20:35:59 GMT
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/framework/WPCordovaClassLib.sln
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/framework/WPCordovaClassLib.sln b/lib/cordova-wp8/framework/WPCordovaClassLib.sln
new file mode 100644
index 0000000..c34cba1
--- /dev/null
+++ b/lib/cordova-wp8/framework/WPCordovaClassLib.sln
@@ -0,0 +1,32 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Express 2012 for Windows Phone
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPCordovaClassLib", "WPCordovaClassLib.csproj", "{FC6A1A70-892D-46AD-9E4A-9793F72AF780}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|ARM = Debug|ARM
+		Debug|Any CPU = Debug|Any CPU
+		Debug|x86 = Debug|x86
+		Release|ARM = Release|ARM
+		Release|Any CPU = Release|Any CPU
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Debug|ARM.ActiveCfg = Debug|ARM
+		{FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Debug|ARM.Build.0 = Debug|ARM
+		{FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Debug|x86.ActiveCfg = Debug|x86
+		{FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Debug|x86.Build.0 = Debug|x86
+		{FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Release|ARM.ActiveCfg = Release|ARM
+		{FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Release|ARM.Build.0 = Release|ARM
+		{FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Release|Any CPU.Build.0 = Release|Any CPU
+		{FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Release|x86.ActiveCfg = Release|x86
+		{FC6A1A70-892D-46AD-9E4A-9793F72AF780}.Release|x86.Build.0 = Release|x86
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/framework/resources/notification-beep.wav
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/framework/resources/notification-beep.wav b/lib/cordova-wp8/framework/resources/notification-beep.wav
new file mode 100644
index 0000000..d0ad085
Binary files /dev/null and b/lib/cordova-wp8/framework/resources/notification-beep.wav differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/App.xaml
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/App.xaml b/lib/cordova-wp8/templates/standalone/App.xaml
new file mode 100644
index 0000000..18072fe
--- /dev/null
+++ b/lib/cordova-wp8/templates/standalone/App.xaml
@@ -0,0 +1,37 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you 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. 
+-->
+<Application 
+    x:Class="$safeprojectname$.App"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
+    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
+
+    <!--Application Resources-->
+    <Application.Resources>
+    </Application.Resources>
+
+    <Application.ApplicationLifetimeObjects>
+        <!--Required object that handles lifetime events for the application-->
+        <shell:PhoneApplicationService 
+            Launching="Application_Launching" Closing="Application_Closing" 
+            Activated="Application_Activated" Deactivated="Application_Deactivated"/>
+    </Application.ApplicationLifetimeObjects>
+
+</Application>

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/App.xaml.cs
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/App.xaml.cs b/lib/cordova-wp8/templates/standalone/App.xaml.cs
new file mode 100644
index 0000000..2b7306d
--- /dev/null
+++ b/lib/cordova-wp8/templates/standalone/App.xaml.cs
@@ -0,0 +1,154 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you 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.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Microsoft.Phone.Controls;
+using Microsoft.Phone.Shell;
+
+namespace $safeprojectname$
+{
+    public partial class App : Application
+    {
+        /// <summary>
+        /// Provides easy access to the root frame of the Phone Application.
+        /// </summary>
+        /// <returns>The root frame of the Phone Application.</returns>
+        public PhoneApplicationFrame RootFrame { get; private set; }
+
+        /// <summary>
+        /// Constructor for the Application object.
+        /// </summary>
+        public App()
+        {
+            // Global handler for uncaught exceptions. 
+            UnhandledException += Application_UnhandledException;
+
+            // Show graphics profiling information while debugging.
+            if (System.Diagnostics.Debugger.IsAttached)
+            {
+                // Display the current frame rate counters.
+                //Application.Current.Host.Settings.EnableFrameRateCounter = true;
+
+                // Show the areas of the app that are being redrawn in each frame.
+                //Application.Current.Host.Settings.EnableRedrawRegions = true;
+
+                // Enable non-production analysis visualization mode, 
+                // which shows areas of a page that are being GPU accelerated with a colored overlay.
+                //Application.Current.Host.Settings.EnableCacheVisualization = true;
+            }
+
+            // Standard Silverlight initialization
+            InitializeComponent();
+
+            // Phone-specific initialization
+            InitializePhoneApplication();
+        }
+
+        // Code to execute when the application is launching (eg, from Start)
+        // This code will not execute when the application is reactivated
+        private void Application_Launching(object sender, LaunchingEventArgs e)
+        {
+        }
+
+        // Code to execute when the application is activated (brought to foreground)
+        // This code will not execute when the application is first launched
+        private void Application_Activated(object sender, ActivatedEventArgs e)
+        {
+        }
+
+        // Code to execute when the application is deactivated (sent to background)
+        // This code will not execute when the application is closing
+        private void Application_Deactivated(object sender, DeactivatedEventArgs e)
+        {
+        }
+
+        // Code to execute when the application is closing (eg, user hit Back)
+        // This code will not execute when the application is deactivated
+        private void Application_Closing(object sender, ClosingEventArgs e)
+        {
+        }
+
+        // Code to execute if a navigation fails
+        private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
+        {
+            if (System.Diagnostics.Debugger.IsAttached)
+            {
+                // A navigation has failed; break into the debugger
+                System.Diagnostics.Debugger.Break();
+            }
+        }
+
+        // Code to execute on Unhandled Exceptions
+        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
+        {
+            if (System.Diagnostics.Debugger.IsAttached)
+            {
+                // An unhandled exception has occurred; break into the debugger
+                System.Diagnostics.Debugger.Break();
+            }
+        }
+
+        #region Phone application initialization
+
+        // Avoid double-initialization
+        private bool phoneApplicationInitialized = false;
+
+        // Do not add any additional code to this method
+        private void InitializePhoneApplication()
+        {
+            if (phoneApplicationInitialized)
+                return;
+
+            // Create the frame but don't set it as RootVisual yet; this allows the splash
+            // screen to remain active until the application is ready to render.
+            RootFrame = new PhoneApplicationFrame();
+            RootFrame.Navigated += CompleteInitializePhoneApplication;
+
+            // Handle navigation failures
+            RootFrame.NavigationFailed += RootFrame_NavigationFailed;
+
+            // Ensure we don't initialize again
+            phoneApplicationInitialized = true;
+        }
+
+        // Do not add any additional code to this method
+        private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
+        {
+            // Set the root visual to allow the application to render
+            if (RootVisual != RootFrame)
+                RootVisual = RootFrame;
+
+            // Remove this handler since it is no longer needed
+            RootFrame.Navigated -= CompleteInitializePhoneApplication;
+        }
+
+        #endregion
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/ApplicationIcon.png
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/ApplicationIcon.png b/lib/cordova-wp8/templates/standalone/ApplicationIcon.png
new file mode 100644
index 0000000..6b69046
Binary files /dev/null and b/lib/cordova-wp8/templates/standalone/ApplicationIcon.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/Background.png
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/Background.png b/lib/cordova-wp8/templates/standalone/Background.png
new file mode 100644
index 0000000..2667df4
Binary files /dev/null and b/lib/cordova-wp8/templates/standalone/Background.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/CordovaAppProj.csproj
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/CordovaAppProj.csproj b/lib/cordova-wp8/templates/standalone/CordovaAppProj.csproj
new file mode 100644
index 0000000..23e4eef
--- /dev/null
+++ b/lib/cordova-wp8/templates/standalone/CordovaAppProj.csproj
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you 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. 
+-->
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>10.0.20506</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}</ProjectGuid>
+    <ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>$safeprojectname$</RootNamespace>
+    <AssemblyName>$safeprojectname$</AssemblyName>
+    <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
+    <SilverlightVersion>
+    </SilverlightVersion>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
+    <TargetFrameworkIdentifier>WindowsPhone</TargetFrameworkIdentifier>
+    <SilverlightApplication>true</SilverlightApplication>
+    <SupportedCultures>en-US</SupportedCultures>
+    <XapOutputs>true</XapOutputs>
+    <GenerateSilverlightManifest>true</GenerateSilverlightManifest>
+    <XapFilename>CordovaAppProj_$(Configuration)_$(Platform).xap</XapFilename>
+    <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
+    <SilverlightAppEntry>$safeprojectname$.App</SilverlightAppEntry>
+    <ValidateXaml>true</ValidateXaml>
+    <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
+    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
+    <BackgroundAgentType />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>Bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+    <NoStdLib>true</NoStdLib>
+    <NoConfig>true</NoConfig>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>Bin\Release</OutputPath>
+    <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+    <NoStdLib>true</NoStdLib>
+    <NoConfig>true</NoConfig>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>Bin\x86\Debug</OutputPath>
+    <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+    <NoStdLib>true</NoStdLib>
+    <DebugType>full</DebugType>
+    <PlatformTarget>
+    </PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
+    <Optimize>false</Optimize>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>Bin\x86\Release</OutputPath>
+    <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+    <Optimize>true</Optimize>
+    <NoStdLib>true</NoStdLib>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>
+    </PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>Bin\ARM\Debug</OutputPath>
+    <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+    <NoStdLib>true</NoStdLib>
+    <DebugType>full</DebugType>
+    <PlatformTarget>
+    </PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+    <Optimize>false</Optimize>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
+    <OutputPath>Bin\ARM\Release</OutputPath>
+    <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+    <Optimize>true</Optimize>
+    <NoStdLib>true</NoStdLib>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>
+    </PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="App.xaml.cs">
+      <DependentUpon>App.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="cordovalib\BrowserMouseHelper.cs" />
+    <Compile Include="cordovalib\CommandFactory.cs" />
+    <Compile Include="cordovalib\Commands\BaseCommand.cs" />
+    <Compile Include="cordovalib\ConfigHandler.cs" />
+    <Compile Include="cordovalib\CordovaCommandCall.cs" />
+    <Compile Include="cordovalib\CordovaView.xaml.cs">
+      <DependentUpon>CordovaView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="cordovalib\DOMStorageHelper.cs" />
+    <Compile Include="cordovalib\JSON\JsonHelper.cs" />
+    <Compile Include="cordovalib\NativeExecution.cs" />
+    <Compile Include="cordovalib\OrientationHelper.cs" />
+    <Compile Include="cordovalib\PluginResult.cs" />
+    <Compile Include="cordovalib\ScriptCallback.cs" />
+   
+    <Compile Include="MainPage.xaml.cs">
+      <DependentUpon>MainPage.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </ApplicationDefinition>
+    <Page Include="cordovalib\CordovaView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+
+    <Page Include="Plugins\UI\AudioRecorder.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Plugins\UI\ImageCapture.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Plugins\UI\NotificationBox.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="Plugins\UI\VideoRecorder.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Page Include="MainPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+  </ItemGroup>
+
+  <ItemGroup>
+    <Content Include="www\**" />
+    <Content Include="config.xml" />
+    <Content Include="Images\**" />
+
+    <Content Include="resources\notification-beep.wav" />
+    <None Include="VERSION" />
+
+    <None Include="Properties\AppManifest.xml">
+      <SubType>Designer</SubType>
+    </None>
+    <None Include="Properties\WMAppManifest.xml">
+      <SubType>Designer</SubType>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="ApplicationIcon.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Background.png">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="SplashScreenImage.jpg" />
+  </ItemGroup>
+  <ItemGroup>
+    <WCFMetadata Include="Service References\" />
+  </ItemGroup>
+  <ItemGroup>
+    <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
+  </ItemGroup>
+  <ItemGroup>
+      <Compile Include="Plugins\*" />
+      <Compile Include="Plugins\UI\*.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
+  <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+  <ProjectExtensions />
+  <PropertyGroup>
+  </PropertyGroup>
+  <PropertyGroup>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/CordovaSolution.sln
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/CordovaSolution.sln b/lib/cordova-wp8/templates/standalone/CordovaSolution.sln
new file mode 100644
index 0000000..58c0e62
--- /dev/null
+++ b/lib/cordova-wp8/templates/standalone/CordovaSolution.sln
@@ -0,0 +1,30 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Express 2012 for Windows Phone
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CordovaAppProj", "CordovaAppProj.csproj", "{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|ARM = Debug|ARM
+		Debug|x86 = Debug|x86
+		Release|Any CPU = Release|Any CPU
+		Release|ARM = Release|ARM
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+		{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|ARM.ActiveCfg = Debug|Any CPU
+		{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|Any CPU.Build.0 = Release|Any CPU
+		{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|Any CPU.Deploy.0 = Release|Any CPU
+		{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|ARM.ActiveCfg = Release|Any CPU
+		{3677C1B7-D68B-4CF9-BF8A-E869D437A6DF}.Release|x86.ActiveCfg = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/Images/appbar.back.rest.png
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/Images/appbar.back.rest.png b/lib/cordova-wp8/templates/standalone/Images/appbar.back.rest.png
new file mode 100644
index 0000000..4bc2b92
Binary files /dev/null and b/lib/cordova-wp8/templates/standalone/Images/appbar.back.rest.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/Images/appbar.close.rest.png
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/Images/appbar.close.rest.png b/lib/cordova-wp8/templates/standalone/Images/appbar.close.rest.png
new file mode 100644
index 0000000..8166a1c
Binary files /dev/null and b/lib/cordova-wp8/templates/standalone/Images/appbar.close.rest.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/Images/appbar.feature.video.rest.png
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/Images/appbar.feature.video.rest.png b/lib/cordova-wp8/templates/standalone/Images/appbar.feature.video.rest.png
new file mode 100644
index 0000000..baff565
Binary files /dev/null and b/lib/cordova-wp8/templates/standalone/Images/appbar.feature.video.rest.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/Images/appbar.next.rest.png
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/Images/appbar.next.rest.png b/lib/cordova-wp8/templates/standalone/Images/appbar.next.rest.png
new file mode 100644
index 0000000..ed577d7
Binary files /dev/null and b/lib/cordova-wp8/templates/standalone/Images/appbar.next.rest.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/Images/appbar.save.rest.png
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/Images/appbar.save.rest.png b/lib/cordova-wp8/templates/standalone/Images/appbar.save.rest.png
new file mode 100644
index 0000000..d49940e
Binary files /dev/null and b/lib/cordova-wp8/templates/standalone/Images/appbar.save.rest.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/Images/appbar.stop.rest.png
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/Images/appbar.stop.rest.png b/lib/cordova-wp8/templates/standalone/Images/appbar.stop.rest.png
new file mode 100644
index 0000000..4dd724f
Binary files /dev/null and b/lib/cordova-wp8/templates/standalone/Images/appbar.stop.rest.png differ

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/MainPage.xaml
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/MainPage.xaml b/lib/cordova-wp8/templates/standalone/MainPage.xaml
new file mode 100644
index 0000000..db0d8e6
--- /dev/null
+++ b/lib/cordova-wp8/templates/standalone/MainPage.xaml
@@ -0,0 +1,53 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you 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. 
+-->
+<phone:PhoneApplicationPage 
+    x:Class="$safeprojectname$.MainPage"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
+    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}"
+    FontSize="{StaticResource PhoneFontSizeNormal}"
+    Foreground="{StaticResource PhoneForegroundBrush}"
+    Background="Black"
+    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
+    shell:SystemTray.IsVisible="True" d:DesignHeight="768" d:DesignWidth="480" 
+    xmlns:my="clr-namespace:WPCordovaClassLib">
+    <Grid x:Name="LayoutRoot" Background="Transparent" HorizontalAlignment="Stretch">
+        <Grid.RowDefinitions>
+            <RowDefinition Height="*"/>
+        </Grid.RowDefinitions>
+        <my:CordovaView HorizontalAlignment="Stretch" 
+                   Margin="0,0,0,0"  
+                   x:Name="CordovaView" 
+                   VerticalAlignment="Stretch" />
+        <Image Source="SplashScreenImage.jpg"
+          x:Name="SplashImage"
+          VerticalAlignment="Center"
+          HorizontalAlignment="Stretch">
+            <Image.Projection>
+                <PlaneProjection x:Name="SplashProjector"  CenterOfRotationX="0"/>
+            </Image.Projection>
+        </Image>
+    </Grid>
+
+</phone:PhoneApplicationPage>
+

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/MainPage.xaml.cs
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/MainPage.xaml.cs b/lib/cordova-wp8/templates/standalone/MainPage.xaml.cs
new file mode 100644
index 0000000..b9ec7e1
--- /dev/null
+++ b/lib/cordova-wp8/templates/standalone/MainPage.xaml.cs
@@ -0,0 +1,72 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you 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.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using Microsoft.Phone.Controls;
+using System.IO;
+using System.Windows.Media.Imaging;
+using System.Windows.Resources;
+
+
+namespace $safeprojectname$
+{
+    public partial class MainPage : PhoneApplicationPage
+    {
+        // Constructor
+        public MainPage()
+        {
+            InitializeComponent();
+            this.CordovaView.Loaded += CordovaView_Loaded;
+        }
+
+        private void CordovaView_Loaded(object sender, RoutedEventArgs e)
+        {
+            this.CordovaView.Loaded -= CordovaView_Loaded;
+            // first time load will have an animation
+            Storyboard _storyBoard = new Storyboard();
+            DoubleAnimation animation = new DoubleAnimation()
+            {
+                From = 0,
+                Duration = TimeSpan.FromSeconds(0.6),
+                To = 90
+            };
+            Storyboard.SetTarget(animation, SplashProjector);
+            Storyboard.SetTargetProperty(animation, new PropertyPath("RotationY"));
+            _storyBoard.Children.Add(animation);
+            _storyBoard.Begin();
+            _storyBoard.Completed += Splash_Completed;
+        }
+
+        void Splash_Completed(object sender, EventArgs e)
+        {
+            (sender as Storyboard).Completed -= Splash_Completed;
+            LayoutRoot.Children.Remove(SplashImage);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/Plugins/Accelerometer.cs
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/Plugins/Accelerometer.cs b/lib/cordova-wp8/templates/standalone/Plugins/Accelerometer.cs
new file mode 100644
index 0000000..cba911c
--- /dev/null
+++ b/lib/cordova-wp8/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-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/Plugins/AudioFormatsHelper.cs
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/Plugins/AudioFormatsHelper.cs b/lib/cordova-wp8/templates/standalone/Plugins/AudioFormatsHelper.cs
new file mode 100644
index 0000000..dca7ee6
--- /dev/null
+++ b/lib/cordova-wp8/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-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/Plugins/AudioPlayer.cs
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/Plugins/AudioPlayer.cs b/lib/cordova-wp8/templates/standalone/Plugins/AudioPlayer.cs
new file mode 100644
index 0000000..a83be5b
--- /dev/null
+++ b/lib/cordova-wp8/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-cli/blob/f59ddbbd/lib/cordova-wp8/templates/standalone/Plugins/Battery.cs
----------------------------------------------------------------------
diff --git a/lib/cordova-wp8/templates/standalone/Plugins/Battery.cs b/lib/cordova-wp8/templates/standalone/Plugins/Battery.cs
new file mode 100644
index 0000000..962959e
--- /dev/null
+++ b/lib/cordova-wp8/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;
+        }
+
+    }
+}


Mime
View raw message