You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by be...@apache.org on 2013/06/15 01:12:43 UTC
[2/7] Removed plugins and plugin dependancies
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/Plugins/UI/AudioCaptureTask.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/UI/AudioCaptureTask.cs b/templates/standalone/Plugins/UI/AudioCaptureTask.cs
deleted file mode 100644
index 9f43d23..0000000
--- a/templates/standalone/Plugins/UI/AudioCaptureTask.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- 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.Windows;
-using Microsoft.Phone.Controls;
-using Microsoft.Phone.Tasks;
-
-namespace WPCordovaClassLib.Cordova.UI
-{
- /// <summary>
- /// Allows an application to launch the Audio Recording application.
- /// Use this to allow users to record audio from your application.
- /// </summary>
- public class AudioCaptureTask
- {
- /// <summary>
- /// Represents recorded audio returned from a call to the Show method of
- /// a WPCordovaClassLib.Cordova.Controls.AudioCaptureTask object
- /// </summary>
- public class AudioResult : TaskEventArgs
- {
- /// <summary>
- /// Initializes a new instance of the AudioResult class.
- /// </summary>
- public AudioResult()
- { }
-
- /// <summary>
- /// Initializes a new instance of the AudioResult class
- /// with the specified Microsoft.Phone.Tasks.TaskResult.
- /// </summary>
- /// <param name="taskResult">Associated Microsoft.Phone.Tasks.TaskResult</param>
- public AudioResult(TaskResult taskResult)
- : base(taskResult)
- { }
-
- /// <summary>
- /// Gets the file name of the recorded audio.
- /// </summary>
- public Stream AudioFile { get; internal set; }
-
- /// <summary>
- /// Gets the stream containing the data for the recorded audio.
- /// </summary>
- public string AudioFileName { get; internal set; }
- }
-
- /// <summary>
- /// Occurs when a audio recording task is completed.
- /// </summary>
- public event EventHandler<AudioResult> Completed;
-
- /// <summary>
- /// Shows Audio Recording application
- /// </summary>
- public void Show()
- {
- Deployment.Current.Dispatcher.BeginInvoke(() =>
- {
- var root = Application.Current.RootVisual as PhoneApplicationFrame;
-
- root.Navigated += new System.Windows.Navigation.NavigatedEventHandler(NavigationService_Navigated);
-
- string baseUrl = WPCordovaClassLib.Cordova.Commands.BaseCommand.GetBaseURL();
- // dummy parameter is used to always open a fresh version
- root.Navigate(new System.Uri(baseUrl + "CordovaLib/UI/AudioRecorder.xaml?dummy=" + Guid.NewGuid().ToString(), UriKind.Relative));
-
- });
- }
-
- /// <summary>
- /// Performs additional configuration of the recording application.
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void NavigationService_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
- {
- if (!(e.Content is AudioRecorder)) return;
-
- (Application.Current.RootVisual as PhoneApplicationFrame).Navigated -= NavigationService_Navigated;
-
- AudioRecorder audioRecorder = (AudioRecorder)e.Content;
-
- if (audioRecorder != null)
- {
- audioRecorder.Completed += this.Completed;
- }
- else if (this.Completed != null)
- {
- this.Completed(this, new AudioResult(TaskResult.Cancel));
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/Plugins/UI/AudioRecorder.xaml
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/UI/AudioRecorder.xaml b/templates/standalone/Plugins/UI/AudioRecorder.xaml
deleted file mode 100644
index 0fd26ab..0000000
--- a/templates/standalone/Plugins/UI/AudioRecorder.xaml
+++ /dev/null
@@ -1,66 +0,0 @@
-<!--
- 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="WPCordovaClassLib.Cordova.UI.AudioRecorder"
- 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"
- FontFamily="{StaticResource PhoneFontFamilyNormal}"
- FontSize="{StaticResource PhoneFontSizeNormal}"
- Foreground="{StaticResource PhoneForegroundBrush}"
- SupportedOrientations="Portrait" Orientation="Portrait"
- mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
- shell:SystemTray.IsVisible="True">
-
- <!--LayoutRoot is the root grid where all page content is placed-->
- <Grid x:Name="LayoutRoot" Background="Transparent">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
-
- <!--TitlePanel contains the name of the application and page title-->
- <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="0,17,0,28">
- <TextBlock x:Name="PageTitle" Text="Audio recorder" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
- </StackPanel>
-
- <!--ContentPanel - place additional content here-->
- <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
- <Button Name="btnStartStop" Content="Start" Height="72" HorizontalAlignment="Left" Margin="156,96,0,0" VerticalAlignment="Top" Width="160" Click="btnStartStop_Click" />
- <Button Name="btnTake" Content="Take" IsEnabled="False" Height="72" HorizontalAlignment="Left" Margin="155,182,0,0" VerticalAlignment="Top" Width="160" Click="btnTake_Click" />
- <TextBlock Height="30" HorizontalAlignment="Left" Margin="168,60,0,0" Name="txtDuration" Text="Duration: 00:00" VerticalAlignment="Top" />
- </Grid>
- </Grid>
-
- <!--Sample code showing usage of ApplicationBar-->
- <!--<phone:PhoneApplicationPage.ApplicationBar>
- <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
- <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
- <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
- <shell:ApplicationBar.MenuItems>
- <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
- <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
- </shell:ApplicationBar.MenuItems>
- </shell:ApplicationBar>
- </phone:PhoneApplicationPage.ApplicationBar>-->
-
-</phone:PhoneApplicationPage>
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/Plugins/UI/AudioRecorder.xaml.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/UI/AudioRecorder.xaml.cs b/templates/standalone/Plugins/UI/AudioRecorder.xaml.cs
deleted file mode 100644
index 6ff0b5c..0000000
--- a/templates/standalone/Plugins/UI/AudioRecorder.xaml.cs
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- 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 Microsoft.Phone.Controls;
-using Microsoft.Phone.Tasks;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Audio;
-using System;
-using System.IO;
-using System.IO.IsolatedStorage;
-using System.Windows;
-using System.Windows.Threading;
-using WPCordovaClassLib.Cordova.Commands;
-using AudioResult = WPCordovaClassLib.Cordova.UI.AudioCaptureTask.AudioResult;
-
-namespace WPCordovaClassLib.Cordova.UI
-{
- /// <summary>
- /// Implements Audio Recording application
- /// </summary>
- public partial class AudioRecorder : PhoneApplicationPage
- {
-
- #region Constants
-
- private const string RecordingStartCaption = "Start";
- private const string RecordingStopCaption = "Stop";
-
- private const string LocalFolderName = "AudioCache";
- private const string FileNameFormat = "Audio-{0}.wav";
-
- #endregion
-
- #region Callbacks
-
- /// <summary>
- /// Occurs when a audio recording task is completed.
- /// </summary>
- public event EventHandler<AudioResult> Completed;
-
- #endregion
-
- #region Fields
-
- /// <summary>
- /// Audio source
- /// </summary>
- private Microphone microphone;
-
- /// <summary>
- /// Temporary buffer to store audio chunk
- /// </summary>
- private byte[] buffer;
-
- /// <summary>
- /// Recording duration
- /// </summary>
- private TimeSpan duration;
-
- /// <summary>
- /// Output buffer
- /// </summary>
- private MemoryStream memoryStream;
-
- /// <summary>
- /// Xna game loop dispatcher
- /// </summary>
- DispatcherTimer dtXna;
-
- /// <summary>
- /// Recording result, dispatched back when recording page is closed
- /// </summary>
- private AudioResult result = new AudioResult(TaskResult.Cancel);
-
- /// <summary>
- /// Whether we are recording audio now
- /// </summary>
- private bool IsRecording
- {
- get
- {
- return (this.microphone != null && this.microphone.State == MicrophoneState.Started);
- }
- }
-
- #endregion
-
- /// <summary>
- /// Creates new instance of the AudioRecorder class.
- /// </summary>
- public AudioRecorder()
- {
-
- this.InitializeXnaGameLoop();
-
- // microphone requires special XNA initialization to work
- InitializeComponent();
- }
-
- /// <summary>
- /// Starts recording, data is stored in memory
- /// </summary>
- private void StartRecording()
- {
- this.microphone = Microphone.Default;
- this.microphone.BufferDuration = TimeSpan.FromMilliseconds(500);
-
- this.btnTake.IsEnabled = false;
- this.btnStartStop.Content = RecordingStopCaption;
-
- this.buffer = new byte[microphone.GetSampleSizeInBytes(this.microphone.BufferDuration)];
- this.microphone.BufferReady += new EventHandler<EventArgs>(MicrophoneBufferReady);
-
- MemoryStream stream = new MemoryStream();
- this.memoryStream = stream;
- int numBits = 16;
- int numBytes = numBits / 8;
-
- // inline version from AudioFormatsHelper
- 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(this.microphone.SampleRate), 0, 4);
- stream.Write(BitConverter.GetBytes(this.microphone.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);
-
- this.duration = new TimeSpan(0);
-
- this.microphone.Start();
- }
-
- /// <summary>
- /// Stops recording
- /// </summary>
- private void StopRecording()
- {
- this.microphone.Stop();
-
- this.microphone.BufferReady -= MicrophoneBufferReady;
-
- this.microphone = null;
-
- btnStartStop.Content = RecordingStartCaption;
-
- // check there is some data
- this.btnTake.IsEnabled = true;
- }
-
- /// <summary>
- /// Handles Start/Stop events
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnStartStop_Click(object sender, RoutedEventArgs e)
- {
-
- if (this.IsRecording)
- {
- this.StopRecording();
- }
- else
- {
- this.StartRecording();
- }
- }
-
- /// <summary>
- /// Handles Take button click
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnTake_Click(object sender, RoutedEventArgs e)
- {
- this.result = this.SaveAudioClipToLocalStorage();
-
- if (Completed != null)
- {
- Completed(this, result);
- }
-
- if (this.NavigationService.CanGoBack)
- {
- this.NavigationService.GoBack();
- }
- }
-
- /// <summary>
- /// Handles page closing event, stops recording if needed and dispatches results.
- /// </summary>
- /// <param name="e"></param>
- protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
- {
- if (IsRecording)
- {
- StopRecording();
- }
-
- this.FinalizeXnaGameLoop();
-
- base.OnNavigatedFrom(e);
- }
-
- /// <summary>
- /// Copies data from microphone to memory storages and updates recording state
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MicrophoneBufferReady(object sender, EventArgs e)
- {
- this.microphone.GetData(this.buffer);
- this.memoryStream.Write(this.buffer, 0, this.buffer.Length);
- TimeSpan bufferDuration = this.microphone.BufferDuration;
-
- this.Dispatcher.BeginInvoke(() =>
- {
- this.duration += bufferDuration;
-
- this.txtDuration.Text = "Duration: " +
- this.duration.Minutes.ToString().PadLeft(2, '0') + ":" +
- this.duration.Seconds.ToString().PadLeft(2, '0');
- });
-
- }
-
- /// <summary>
- /// Writes audio data from memory to isolated storage
- /// </summary>
- /// <returns></returns>
- private AudioResult SaveAudioClipToLocalStorage()
- {
- if (this.memoryStream == null || this.memoryStream.Length <= 0)
- {
- return new AudioResult(TaskResult.Cancel);
- }
-
- //this.memoryStream.UpdateWavStream();
- long position = memoryStream.Position;
- memoryStream.Seek(4, SeekOrigin.Begin);
- memoryStream.Write(BitConverter.GetBytes((int)memoryStream.Length - 8), 0, 4);
- memoryStream.Seek(40, SeekOrigin.Begin);
- memoryStream.Write(BitConverter.GetBytes((int)memoryStream.Length - 44), 0, 4);
- memoryStream.Seek(position, SeekOrigin.Begin);
-
- // save audio data to local isolated storage
-
- string filename = String.Format(FileNameFormat, Guid.NewGuid().ToString());
-
- try
- {
- using (IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForApplication())
- {
-
- if (!isoFile.DirectoryExists(LocalFolderName))
- {
- isoFile.CreateDirectory(LocalFolderName);
- }
-
- string filePath = System.IO.Path.Combine("/" + LocalFolderName + "/", filename);
-
- this.memoryStream.Seek(0, SeekOrigin.Begin);
-
- using (IsolatedStorageFileStream fileStream = isoFile.CreateFile(filePath))
- {
-
- this.memoryStream.CopyTo(fileStream);
- }
-
- AudioResult result = new AudioResult(TaskResult.OK);
- result.AudioFileName = filePath;
-
- result.AudioFile = this.memoryStream;
- result.AudioFile.Seek(0, SeekOrigin.Begin);
-
- return result;
- }
-
-
-
- }
- catch (Exception)
- {
- //TODO: log or do something else
- throw;
- }
- }
-
- /// <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 (dtXna != null)
- {
- dtXna.Stop();
- dtXna = null;
- }
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/Plugins/UI/ImageCapture.xaml
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/UI/ImageCapture.xaml b/templates/standalone/Plugins/UI/ImageCapture.xaml
deleted file mode 100644
index a7eee21..0000000
--- a/templates/standalone/Plugins/UI/ImageCapture.xaml
+++ /dev/null
@@ -1,26 +0,0 @@
-<phone:PhoneApplicationPage
- x:Class="WPCordovaClassLib.Cordova.UI.ImageCapture"
- 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"
- FontFamily="{StaticResource PhoneFontFamilyNormal}"
- FontSize="{StaticResource PhoneFontSizeNormal}"
- Foreground="{StaticResource PhoneForegroundBrush}"
- SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
- mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
- shell:SystemTray.IsVisible="True">
-
- <!--LayoutRoot is the root grid where all page content is placed-->
- <Grid x:Name="LayoutRoot" Background="Yellow">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
-
- </Grid>
-
-
-</phone:PhoneApplicationPage>
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/Plugins/UI/ImageCapture.xaml.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/UI/ImageCapture.xaml.cs b/templates/standalone/Plugins/UI/ImageCapture.xaml.cs
deleted file mode 100644
index 234b444..0000000
--- a/templates/standalone/Plugins/UI/ImageCapture.xaml.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- 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.Windows;
-using Microsoft.Phone.Controls;
-using Microsoft.Phone.Tasks;
-
-namespace WPCordovaClassLib.Cordova.UI
-{
- public partial class ImageCapture : PhoneApplicationPage
- {
- public ImageCapture()
- {
- InitializeComponent();
- }
- }
-
- public class ImageCaptureTask
- {
- /// <summary>
- /// Represents an image returned from a call to the Show method of
- /// a WPCordovaClassLib.Cordova.Controls.ImageCaptureTask object
- /// </summary>
- //public class AudioResult : TaskEventArgs
- //{
- // /// <summary>
- // /// Initializes a new instance of the AudioResult class.
- // /// </summary>
- // public AudioResult()
- // { }
-
- // /// <summary>
- // /// Initializes a new instance of the AudioResult class
- // /// with the specified Microsoft.Phone.Tasks.TaskResult.
- // /// </summary>
- // /// <param name="taskResult">Associated Microsoft.Phone.Tasks.TaskResult</param>
- // public AudioResult(TaskResult taskResult)
- // : base(taskResult)
- // { }
-
- // /// <summary>
- // /// Gets the file name of the recorded audio.
- // /// </summary>
- // public Stream AudioFile { get; internal set; }
-
- // /// <summary>
- // /// Gets the stream containing the data for the recorded audio.
- // /// </summary>
- // public string AudioFileName { get; internal set; }
- //}
-
- ///// <summary>
- ///// Occurs when a audio recording task is completed.
- ///// </summary>
- //public event EventHandler<AudioResult> Completed;
-
- /// <summary>
- /// Shows Audio Recording application
- /// </summary>
- public void Show()
- {
- Deployment.Current.Dispatcher.BeginInvoke(() =>
- {
- var root = Application.Current.RootVisual as PhoneApplicationFrame;
-
- root.Navigated += new System.Windows.Navigation.NavigatedEventHandler(NavigationService_Navigated);
-
- string baseUrl = WPCordovaClassLib.Cordova.Commands.BaseCommand.GetBaseURL();
-
- // dummy parameter is used to always open a fresh version
- root.Navigate(new System.Uri(baseUrl + "Cordova/UI/ImageCapture.xaml?dummy=" + Guid.NewGuid().ToString(), UriKind.Relative));
- });
- }
-
- /// <summary>
- /// Performs additional configuration of the recording application.
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void NavigationService_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
- {
- ImageCapture imageCapture = e.Content as ImageCapture;
- if (imageCapture != null)
- {
- (Application.Current.RootVisual as PhoneApplicationFrame).Navigated -= NavigationService_Navigated;
-
- //imageCapture.Completed += this.Completed;
- //else if (this.Completed != null)
- //{
- // this.Completed(this, new AudioResult(TaskResult.Cancel));
- //}
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/Plugins/UI/NotificationBox.xaml
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/UI/NotificationBox.xaml b/templates/standalone/Plugins/UI/NotificationBox.xaml
deleted file mode 100644
index 1ca5d5f..0000000
--- a/templates/standalone/Plugins/UI/NotificationBox.xaml
+++ /dev/null
@@ -1,62 +0,0 @@
-<!--
- 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.
--->
-<UserControl x:Class="WPCordovaClassLib.Cordova.UI.NotificationBox"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- 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}"
- d:DesignHeight="800" d:DesignWidth="480" VerticalAlignment="Stretch">
-
- <Grid x:Name="LayoutRoot"
- Background="{StaticResource PhoneSemitransparentBrush}" VerticalAlignment="Stretch">
-
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
-
-
- <!--TitlePanel contains the name of the application and page title-->
- <StackPanel x:Name="TitlePanel"
- Grid.Row="0"
- Background="{StaticResource PhoneSemitransparentBrush}">
- <TextBlock x:Name="PageTitle"
- Text="Title"
- Margin="10,10"
- Style="{StaticResource PhoneTextTitle2Style}"/>
-
- <TextBlock x:Name="SubTitle"
- Text="Subtitle"
- TextWrapping="Wrap"
- Margin="10,10"
- Style="{StaticResource PhoneTextTitle3Style}"/>
-
- <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
- <StackPanel x:Name="ButtonPanel"
- Margin="10,10"
- Orientation="Horizontal"/>
- </ScrollViewer>
-
- </StackPanel>
- </Grid>
-</UserControl>
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/Plugins/UI/NotificationBox.xaml.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/UI/NotificationBox.xaml.cs b/templates/standalone/Plugins/UI/NotificationBox.xaml.cs
deleted file mode 100644
index 50b2f2a..0000000
--- a/templates/standalone/Plugins/UI/NotificationBox.xaml.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- 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;
-
-namespace WPCordovaClassLib.Cordova.UI
-{
- public partial class NotificationBox : UserControl
- {
- public NotificationBox()
- {
- InitializeComponent();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/Plugins/UI/VideoCaptureTask.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/UI/VideoCaptureTask.cs b/templates/standalone/Plugins/UI/VideoCaptureTask.cs
deleted file mode 100644
index def2a88..0000000
--- a/templates/standalone/Plugins/UI/VideoCaptureTask.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- 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.Windows;
-using Microsoft.Phone.Controls;
-using Microsoft.Phone.Tasks;
-
-namespace WPCordovaClassLib.Cordova.UI
-{
- /// <summary>
- /// Allows an application to launch the Video Recording application.
- /// Use this to allow users to record video from your application.
- /// </summary>
- public class VideoCaptureTask
- {
- /// <summary>
- /// Represents recorded video returned from a call to the Show method of
- /// a WPCordovaClassLib.Cordova.Controls.VideoCaptureTask object
- /// </summary>
- public class VideoResult : TaskEventArgs
- {
- /// <summary>
- /// Initializes a new instance of the VideoResult class.
- /// </summary>
- public VideoResult()
- { }
-
- /// <summary>
- /// Initializes a new instance of the VideoResult class
- /// with the specified Microsoft.Phone.Tasks.TaskResult.
- /// </summary>
- /// <param name="taskResult">Associated Microsoft.Phone.Tasks.TaskResult</param>
- public VideoResult(TaskResult taskResult)
- : base(taskResult)
- { }
-
- /// <summary>
- /// Gets the file name of the recorded Video.
- /// </summary>
- public Stream VideoFile { get; internal set; }
-
- /// <summary>
- /// Gets the stream containing the data for the recorded Video.
- /// </summary>
- public string VideoFileName { get; internal set; }
- }
-
- /// <summary>
- /// Occurs when a Video recording task is completed.
- /// </summary>
- public event EventHandler<VideoResult> Completed;
-
- /// <summary>
- /// Shows Video Recording application
- /// </summary>
- public void Show()
- {
- Deployment.Current.Dispatcher.BeginInvoke(() =>
- {
- var root = Application.Current.RootVisual as PhoneApplicationFrame;
-
- root.Navigated += new System.Windows.Navigation.NavigatedEventHandler(NavigationService_Navigated);
-
- string baseUrl = WPCordovaClassLib.Cordova.Commands.BaseCommand.GetBaseURL();
- // dummy parameter is used to always open a fresh version
- root.Navigate(new System.Uri(baseUrl + "CordovaLib/UI/VideoRecorder.xaml?dummy=" + Guid.NewGuid().ToString(), UriKind.Relative));
- });
- }
-
- /// <summary>
- /// Performs additional configuration of the recording application.
- /// </summary>
- private void NavigationService_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
- {
- if (!(e.Content is VideoRecorder)) return;
-
- (Application.Current.RootVisual as PhoneApplicationFrame).Navigated -= NavigationService_Navigated;
-
- VideoRecorder VideoRecorder = (VideoRecorder)e.Content;
-
- if (VideoRecorder != null)
- {
- VideoRecorder.Completed += this.Completed;
- }
- else if (this.Completed != null)
- {
- this.Completed(this, new VideoResult(TaskResult.Cancel));
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/Plugins/UI/VideoRecorder.xaml
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/UI/VideoRecorder.xaml b/templates/standalone/Plugins/UI/VideoRecorder.xaml
deleted file mode 100644
index c78fdb0..0000000
--- a/templates/standalone/Plugins/UI/VideoRecorder.xaml
+++ /dev/null
@@ -1,52 +0,0 @@
-<!--
- 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="WPCordovaClassLib.Cordova.UI.VideoRecorder"
- 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" d:DesignWidth="800" d:DesignHeight="480"
- FontFamily="{StaticResource PhoneFontFamilyNormal}"
- FontSize="{StaticResource PhoneFontSizeNormal}"
- Foreground="{StaticResource PhoneForegroundBrush}"
- SupportedOrientations="Landscape" Orientation="LandscapeLeft"
- shell:SystemTray.IsVisible="False">
-
- <Canvas x:Name="LayoutRoot" Background="Transparent" Grid.ColumnSpan="1" Grid.Column="0">
-
- <Rectangle
- x:Name="viewfinderRectangle"
- Width="640"
- Height="480"
- HorizontalAlignment="Left"
- Canvas.Left="80"/>
-
- </Canvas>
-
- <phone:PhoneApplicationPage.ApplicationBar>
- <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" x:Name="PhoneAppBar" Opacity="0.0">
- <shell:ApplicationBarIconButton IconUri="/Images/appbar.feature.video.rest.png" Text="Record" x:Name="btnStartRecording" Click="StartRecording_Click" />
- <shell:ApplicationBarIconButton IconUri="/Images/appbar.save.rest.png" Text="Take" x:Name="btnTakeVideo" Click="TakeVideo_Click"/>
- </shell:ApplicationBar>
- </phone:PhoneApplicationPage.ApplicationBar>
-
-</phone:PhoneApplicationPage>
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/Plugins/UI/VideoRecorder.xaml.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/UI/VideoRecorder.xaml.cs b/templates/standalone/Plugins/UI/VideoRecorder.xaml.cs
deleted file mode 100644
index 6ab1cc3..0000000
--- a/templates/standalone/Plugins/UI/VideoRecorder.xaml.cs
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- 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.Media;
-using System.Windows.Navigation;
-using Microsoft.Phone.Controls;
-using Microsoft.Phone.Shell;
-using Microsoft.Phone.Tasks;
-using VideoResult = WPCordovaClassLib.Cordova.UI.VideoCaptureTask.VideoResult;
-
-namespace WPCordovaClassLib.Cordova.UI
-{
- public partial class VideoRecorder : PhoneApplicationPage
- {
-
- #region Constants
-
- /// <summary>
- /// Caption for record button in ready state
- /// </summary>
- private const string RecordingStartCaption = "Record";
-
- /// <summary>
- /// Caption for record button in recording state
- /// </summary>
- private const string RecordingStopCaption = "Stop";
-
- /// <summary>
- /// Start record icon URI
- /// </summary>
- private const string StartIconUri = "/Images/appbar.feature.video.rest.png";
-
- /// <summary>
- /// Stop record icon URI
- /// </summary>
- private const string StopIconUri = "/Images/appbar.stop.rest.png";
-
- /// <summary>
- /// Folder to save video clips
- /// </summary>
- private const string LocalFolderName = "VideoCache";
-
- /// <summary>
- /// File name format
- /// </summary>
- private const string FileNameFormat = "Video-{0}.mp4";
-
- /// <summary>
- /// Temporary file name
- /// </summary>
- private const string defaultFileName = "NewVideoFile.mp4";
-
- #endregion
-
- #region Callbacks
- /// <summary>
- /// Occurs when a video recording task is completed.
- /// </summary>
- public event EventHandler<VideoResult> Completed;
-
- #endregion
-
- #region Fields
-
- /// <summary>
- /// Viewfinder for capturing video
- /// </summary>
- private VideoBrush videoRecorderBrush;
-
- /// <summary>
- /// Path to save video clip
- /// </summary>
- private string filePath;
-
- /// <summary>
- /// Source for capturing video.
- /// </summary>
- private CaptureSource captureSource;
-
- /// <summary>
- /// Video device
- /// </summary>
- private VideoCaptureDevice videoCaptureDevice;
-
- /// <summary>
- /// File sink so save recording video in Isolated Storage
- /// </summary>
- private FileSink fileSink;
-
- /// <summary>
- /// For managing button and application state
- /// </summary>
- private enum VideoState { Initialized, Ready, Recording, CameraNotSupported };
-
- /// <summary>
- /// Current video state
- /// </summary>
- private VideoState currentVideoState;
-
- /// <summary>
- /// Stream to return result
- /// </summary>
- private MemoryStream memoryStream;
-
- /// <summary>
- /// Recording result, dispatched back when recording page is closed
- /// </summary>
- private VideoResult result = new VideoResult(TaskResult.Cancel);
-
- #endregion
-
- /// <summary>
- /// Initializes components
- /// </summary>
- public VideoRecorder()
- {
- InitializeComponent();
-
- PhoneAppBar = (ApplicationBar)ApplicationBar;
- PhoneAppBar.IsVisible = true;
- btnStartRecording = ((ApplicationBarIconButton)ApplicationBar.Buttons[0]);
- btnTakeVideo = ((ApplicationBarIconButton)ApplicationBar.Buttons[1]);
- }
-
- /// <summary>
- /// Initializes the video recorder then page is loading
- /// </summary>
- protected override void OnNavigatedTo(NavigationEventArgs e)
- {
- base.OnNavigatedTo(e);
- this.InitializeVideoRecorder();
- }
-
- /// <summary>
- /// Disposes camera and media objects then leave the page
- /// </summary>
- protected override void OnNavigatedFrom(NavigationEventArgs e)
- {
- this.DisposeVideoRecorder();
-
- if (this.Completed != null)
- {
- this.Completed(this, result);
- }
- base.OnNavigatedFrom(e);
- }
-
- /// <summary>
- /// Handles TakeVideo button click
- /// </summary>
- private void TakeVideo_Click(object sender, EventArgs e)
- {
- this.result = this.SaveVideoClip();
- this.NavigateBack();
- }
-
- private void NavigateBack()
- {
- if (this.NavigationService.CanGoBack)
- {
- this.NavigationService.GoBack();
- }
- }
-
- /// <summary>
- /// Resaves video clip from temporary directory to persistent
- /// </summary>
- private VideoResult SaveVideoClip()
- {
- try
- {
- using (IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForApplication())
- {
- if (string.IsNullOrEmpty(filePath) || (!isoFile.FileExists(filePath)))
- {
- return new VideoResult(TaskResult.Cancel);
- }
-
- string fileName = String.Format(FileNameFormat, Guid.NewGuid().ToString());
- string newPath = Path.Combine("/" + LocalFolderName + "/", fileName);
- isoFile.CopyFile(filePath, newPath);
- isoFile.DeleteFile(filePath);
-
- memoryStream = new MemoryStream();
- using (IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream(newPath, FileMode.Open, isoFile))
- {
- fileStream.CopyTo(memoryStream);
- }
-
- VideoResult result = new VideoResult(TaskResult.OK);
- result.VideoFileName = newPath;
- result.VideoFile = this.memoryStream;
- result.VideoFile.Seek(0, SeekOrigin.Begin);
- return result;
- }
-
- }
- catch (Exception)
- {
- return new VideoResult(TaskResult.None);
- }
- }
-
- /// <summary>
- /// Updates the buttons on the UI thread based on current state.
- /// </summary>
- /// <param name="currentState">current UI state</param>
- private void UpdateUI(VideoState currentState)
- {
- Dispatcher.BeginInvoke(delegate
- {
- switch (currentState)
- {
- case VideoState.CameraNotSupported:
- btnStartRecording.IsEnabled = false;
- btnTakeVideo.IsEnabled = false;
- break;
-
- case VideoState.Initialized:
- btnStartRecording.Text = RecordingStartCaption;
- btnStartRecording.IconUri = new Uri(StartIconUri, UriKind.Relative);
- btnTakeVideo.IsEnabled = false;
- break;
-
- case VideoState.Ready:
- btnStartRecording.Text = RecordingStartCaption;
- btnStartRecording.IconUri = new Uri(StartIconUri, UriKind.Relative);
- btnTakeVideo.IsEnabled = true;
- break;
-
- case VideoState.Recording:
- btnStartRecording.Text = RecordingStopCaption;
- btnStartRecording.IconUri = new Uri(StopIconUri, UriKind.Relative);
- btnTakeVideo.IsEnabled = false;
- break;
-
- default:
- break;
- }
- currentVideoState = currentState;
- });
- }
-
- /// <summary>
- /// Initializes VideoRecorder
- /// </summary>
- public void InitializeVideoRecorder()
- {
- if (captureSource == null)
- {
- captureSource = new CaptureSource();
- fileSink = new FileSink();
- videoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();
-
- if (videoCaptureDevice != null)
- {
- videoRecorderBrush = new VideoBrush();
- videoRecorderBrush.SetSource(captureSource);
- viewfinderRectangle.Fill = videoRecorderBrush;
- captureSource.Start();
- this.UpdateUI(VideoState.Initialized);
- }
- else
- {
- this.UpdateUI(VideoState.CameraNotSupported);
- }
- }
- }
-
- /// <summary>
- /// Sets recording state: start recording
- /// </summary>
- private void StartVideoRecording()
- {
- try
- {
- if ((captureSource.VideoCaptureDevice != null) && (captureSource.State == CaptureState.Started))
- {
- captureSource.Stop();
- fileSink.CaptureSource = captureSource;
- filePath = System.IO.Path.Combine("/" + LocalFolderName + "/", defaultFileName);
-
- using (IsolatedStorageFile isoFile = IsolatedStorageFile.GetUserStoreForApplication())
- {
- if (!isoFile.DirectoryExists(LocalFolderName))
- {
- isoFile.CreateDirectory(LocalFolderName);
- }
-
- if (isoFile.FileExists(filePath))
- {
- isoFile.DeleteFile(filePath);
- }
- }
-
- fileSink.IsolatedStorageFileName = filePath;
- }
-
- if (captureSource.VideoCaptureDevice != null
- && captureSource.State == CaptureState.Stopped)
- {
- captureSource.Start();
- }
- this.UpdateUI(VideoState.Recording);
- }
- catch (Exception)
- {
- this.result = new VideoResult(TaskResult.None);
- this.NavigateBack();
- }
- }
-
- /// <summary>
- /// Sets the recording state: stop recording
- /// </summary>
- private void StopVideoRecording()
- {
- try
- {
- if ((captureSource.VideoCaptureDevice != null) && (captureSource.State == CaptureState.Started))
- {
- captureSource.Stop();
- fileSink.CaptureSource = null;
- fileSink.IsolatedStorageFileName = null;
- this.StartVideoPreview();
- }
- }
- catch (Exception)
- {
- this.result = new VideoResult(TaskResult.None);
- this.NavigateBack();
- }
- }
-
- /// <summary>
- /// Sets the recording state: display the video on the viewfinder.
- /// </summary>
- private void StartVideoPreview()
- {
- try
- {
- if ((captureSource.VideoCaptureDevice != null) && (captureSource.State == CaptureState.Stopped))
- {
- videoRecorderBrush.SetSource(captureSource);
- viewfinderRectangle.Fill = videoRecorderBrush;
- captureSource.Start();
- this.UpdateUI(VideoState.Ready);
- }
- }
- catch (Exception)
- {
- this.result = new VideoResult(TaskResult.None);
- this.NavigateBack();
- }
- }
-
- /// <summary>
- /// Starts video recording
- /// </summary>
- private void StartRecording_Click(object sender, EventArgs e)
- {
- if (currentVideoState == VideoState.Recording)
- {
- this.StopVideoRecording();
- }
- else
- {
- this.StartVideoRecording();
- }
- }
-
- /// <summary>
- /// Releases resources
- /// </summary>
- private void DisposeVideoRecorder()
- {
- if (captureSource != null)
- {
- if ((captureSource.VideoCaptureDevice != null) && (captureSource.State == CaptureState.Started))
- {
- captureSource.Stop();
- }
- captureSource = null;
- videoCaptureDevice = null;
- fileSink = null;
- videoRecorderBrush = null;
- }
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/Properties/WMAppManifest.xml
----------------------------------------------------------------------
diff --git a/templates/standalone/Properties/WMAppManifest.xml b/templates/standalone/Properties/WMAppManifest.xml
index 96332e1..1951c91 100644
--- a/templates/standalone/Properties/WMAppManifest.xml
+++ b/templates/standalone/Properties/WMAppManifest.xml
@@ -9,20 +9,7 @@
<IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
<Capabilities>
- <Capability Name="ID_CAP_IDENTITY_DEVICE" />
- <Capability Name="ID_CAP_IDENTITY_USER" />
- <Capability Name="ID_CAP_LOCATION" />
- <Capability Name="ID_CAP_NETWORKING" />
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
- <Capability Name="ID_CAP_APPOINTMENTS"/>
- <Capability Name="ID_CAP_CONTACTS"/>
- <Capability Name="ID_CAP_ISV_CAMERA"/>
- <Capability Name="ID_CAP_MEDIALIB"/>
- <Capability Name="ID_CAP_MICROPHONE"/>
- <Capability Name="ID_CAP_PHONEDIALER"/>
- <Capability Name="ID_CAP_PUSH_NOTIFICATION"/>
- <Capability Name="ID_CAP_SENSORS"/>
- <Capability Name="ID_HW_FRONTCAMERA"/>
</Capabilities>
<Tasks>
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/config.xml
----------------------------------------------------------------------
diff --git a/templates/standalone/config.xml b/templates/standalone/config.xml
index bd50dab..be6f939 100644
--- a/templates/standalone/config.xml
+++ b/templates/standalone/config.xml
@@ -20,62 +20,5 @@
#
-->
<widget>
-
- <features>
- <feature name="Logger">
- <param name="wp-package" value="Logger"/>
- </feature>
- <feature name="Compass">
- <param name="wp-package" value="Compass" />
- </feature>
- <feature name="Accelerometer">
- <param name="wp-package" value="Accelerometer"/>
- </feature>
- <feature name="Camera">
- <param name="wp-package" value="Camera"/>
- </feature>
- <feature name="Contacts">
- <param name="wp-package" value="Contacts"/>
- </feature>
- <feature name="DebugConsole">
- <param name="wp-package" value="DebugConsole"/>
- </feature>
- <feature name="Echo">
- <param name="wp-package" value="Echo"/>
- </feature>
- <feature name="File">
- <param name="wp-package" value="File"/>
- </feature>
- <feature name="FileTransfer">
- <param name="wp-package" value="FileTransfer"/>
- </feature>
- <feature name="Geolocation">
- <param name="wp-package" value="Geolocation"/>
- </feature>
- <feature name="Geolocation">
- <param name="wp-package" value="Geolocation"/>
- </feature>
- <feature name="Media">
- <param name="wp-package" value="Media"/>
- </feature>
- <feature name="Capture">
- <param name="wp-package" value="Capture"/>
- </feature>
- <feature name="SplashScreen">
- <param name="wp-package" value="SplashScreen"/>
- </feature>
- <feature name="Battery">
- <param name="wp-package" value="Battery"/>
- </feature>
- <feature name="Globalization">
- <param name="wp-package" value="Globalization"/>
- </feature>
- <feature name="InAppBrowser">
- <param name="wp-package" value="InAppBrowser"/>
- </feature>
- </features>
-
-
<access origin="*"/>
-
</widget>
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/cordovalib/Device.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/Device.cs b/templates/standalone/cordovalib/Device.cs
deleted file mode 100644
index b5f4f03..0000000
--- a/templates/standalone/cordovalib/Device.cs
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- 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;
-using System.IO.IsolatedStorage;
-using System.Windows.Resources;
-using System.IO;
-using System.Diagnostics;
-
-namespace WPCordovaClassLib.Cordova.Commands
-{
- public class Device : BaseCommand
- {
- public void getDeviceInfo(string notused)
- {
-
- string res = String.Format("\"name\":\"{0}\",\"cordova\":\"{1}\",\"platform\":\"{2}\",\"uuid\":\"{3}\",\"version\":\"{4}\",\"model\":\"{5}\"",
- this.name,
- this.cordova,
- this.platform,
- this.uuid,
- this.version,
- this.model);
-
-
-
- res = "{" + res + "}";
- //Debug.WriteLine("Result::" + res);
- DispatchCommandResult(new PluginResult(PluginResult.Status.OK, res));
- }
-
- public string model
- {
- get
- {
- return DeviceStatus.DeviceName;
- //return String.Format("{0},{1},{2}", DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceHardwareVersion, DeviceStatus.DeviceFirmwareVersion);
- }
- }
-
- public string name
- {
- get
- {
- return DeviceStatus.DeviceName;
-
- }
- }
-
- public string cordova
- {
- get
- {
- // TODO: should be able to dynamically read the Cordova version from somewhere...
- return "2.8.0";
- }
- }
-
- public string platform
- {
- get
- {
- return Environment.OSVersion.Platform.ToString();
- }
- }
-
- public string uuid
- {
- get
- {
- string returnVal = "";
- object id;
- UserExtendedProperties.TryGetValue("ANID", out id);
-
- if (id != null)
- {
- returnVal = id.ToString().Substring(2, 32);
- }
- else
- {
- returnVal = "???unknown???";
-
- using (IsolatedStorageFile appStorage = IsolatedStorageFile.GetUserStoreForApplication())
- {
- try
- {
- IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream("DeviceID.txt", FileMode.Open, FileAccess.Read, appStorage);
-
- using (StreamReader reader = new StreamReader(fileStream))
- {
- returnVal = reader.ReadLine();
- }
- }
- catch (Exception /*ex*/)
- {
-
- }
- }
- }
-
- return returnVal;
- }
- }
-
- public string version
- {
- get
- {
- return Environment.OSVersion.Version.ToString();
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/cordovalib/NativeExecution.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/NativeExecution.cs b/templates/standalone/cordovalib/NativeExecution.cs
index af6b207..591a462 100644
--- a/templates/standalone/cordovalib/NativeExecution.cs
+++ b/templates/standalone/cordovalib/NativeExecution.cs
@@ -133,16 +133,16 @@ namespace WPCordovaClassLib.Cordova
}
};
- if ((bc is File) || (bc is Accelerometer))
+ /*if ((bc is File) || (bc is Accelerometer))
{
// Due to some issues with the IsolatedStorage in current version of WP8 SDK we have to run all File Api commands synchronously.
// TODO: test this in WP8 RTM
methodInvokation.Invoke();
}
else
- {
+ {*/
new Thread(methodInvokation).Start();
- }
+ //}
}
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/947c087d/templates/standalone/cordovalib/NetworkStatus.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/NetworkStatus.cs b/templates/standalone/cordovalib/NetworkStatus.cs
deleted file mode 100644
index 12eb061..0000000
--- a/templates/standalone/cordovalib/NetworkStatus.cs
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- 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.Diagnostics;
-using System.Net;
-using System.Net.NetworkInformation;
-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.Net.NetworkInformation;
-
-namespace WPCordovaClassLib.Cordova.Commands
-{
-
- // http://msdn.microsoft.com/en-us/library/microsoft.phone.net.networkinformation(v=VS.92).aspx
- // http://msdn.microsoft.com/en-us/library/microsoft.phone.net.networkinformation.devicenetworkinformation(v=VS.92).aspx
-
- public class NetworkStatus : BaseCommand
- {
- const string UNKNOWN = "unknown";
- const string ETHERNET = "ethernet";
- const string WIFI = "wifi";
- const string CELL_2G = "2g";
- const string CELL_3G = "3g";
- const string CELL_4G = "4g";
- const string NONE = "none";
- const string CELL = "cellular";
-
- private bool HasCallback = false;
-
- public NetworkStatus()
- {
- DeviceNetworkInformation.NetworkAvailabilityChanged += new EventHandler<NetworkNotificationEventArgs>(ChangeDetected);
- }
-
- public override void OnResume(object sender, Microsoft.Phone.Shell.ActivatedEventArgs e)
- {
- this.getConnectionInfo("");
- }
-
- public void getConnectionInfo(string empty)
- {
- HasCallback = true;
- updateConnectionType(checkConnectionType());
- }
-
- private string checkConnectionType()
- {
- if (DeviceNetworkInformation.IsNetworkAvailable)
- {
- if (DeviceNetworkInformation.IsWiFiEnabled)
- {
- return WIFI;
- }
- else
- {
- return DeviceNetworkInformation.IsCellularDataEnabled ? CELL : UNKNOWN;
- }
- }
- return NONE;
- }
-
- private string checkConnectionType(NetworkInterfaceSubType type)
- {
- switch (type)
- {
- case NetworkInterfaceSubType.Cellular_1XRTT: //cell
- case NetworkInterfaceSubType.Cellular_GPRS: //cell
- return CELL;
- case NetworkInterfaceSubType.Cellular_EDGE: //2
- return CELL_2G;
- case NetworkInterfaceSubType.Cellular_3G:
- case NetworkInterfaceSubType.Cellular_EVDO: //3
- case NetworkInterfaceSubType.Cellular_EVDV: //3
- case NetworkInterfaceSubType.Cellular_HSPA: //3
- return CELL_3G;
- case NetworkInterfaceSubType.WiFi:
- return WIFI;
- case NetworkInterfaceSubType.Unknown:
- case NetworkInterfaceSubType.Desktop_PassThru:
- default:
- return UNKNOWN;
- }
- }
-
- void ChangeDetected(object sender, NetworkNotificationEventArgs e)
- {
- switch (e.NotificationType)
- {
- case NetworkNotificationType.InterfaceConnected:
- updateConnectionType(checkConnectionType(e.NetworkInterface.InterfaceSubtype));
- break;
- case NetworkNotificationType.InterfaceDisconnected:
- updateConnectionType(NONE);
- break;
- default:
- break;
- }
- }
-
- private void updateConnectionType(string type)
- {
- // This should also implicitly fire offline/online events as that is handled on the JS side
- if (this.HasCallback)
- {
- PluginResult result = new PluginResult(PluginResult.Status.OK, type);
- result.KeepCallback = true;
- DispatchCommandResult(result);
- }
- }
- }
-}