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/05/28 02:14:15 UTC
[5/5] wp7 commit: removed dependencies for Battery status plugin
removed dependencies for Battery status plugin
Project: http://git-wip-us.apache.org/repos/asf/cordova-wp7/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp7/commit/86d27fc9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp7/tree/86d27fc9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp7/diff/86d27fc9
Branch: refs/heads/3.0.0
Commit: 86d27fc9730d055970c4528c6156eea0fbc2bf8c
Parents: ec35629
Author: Benn Mapes <be...@gmail.com>
Authored: Mon May 27 17:11:10 2013 -0700
Committer: Benn Mapes <be...@gmail.com>
Committed: Mon May 27 17:13:13 2013 -0700
----------------------------------------------------------------------
templates/standalone/CordovaAppProj.csproj | 1 -
templates/standalone/Plugins/Battery.cs | 79 -----------------------
templates/standalone/config.xml | 1 -
3 files changed, 0 insertions(+), 81 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/86d27fc9/templates/standalone/CordovaAppProj.csproj
----------------------------------------------------------------------
diff --git a/templates/standalone/CordovaAppProj.csproj b/templates/standalone/CordovaAppProj.csproj
index 2b43554..bcf300c 100644
--- a/templates/standalone/CordovaAppProj.csproj
+++ b/templates/standalone/CordovaAppProj.csproj
@@ -168,7 +168,6 @@
<ItemGroup>
<Compile Include="Plugins\AudioFormatsHelper.cs" />
<Compile Include="Plugins\AudioPlayer.cs" />
- <Compile Include="Plugins\Battery.cs" />
<Compile Include="Plugins\Camera.cs" />
<Compile Include="Plugins\Contacts.cs" />
<Compile Include="Plugins\DebugConsole.cs" />
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/86d27fc9/templates/standalone/Plugins/Battery.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/Plugins/Battery.cs b/templates/standalone/Plugins/Battery.cs
deleted file mode 100644
index 962959e..0000000
--- a/templates/standalone/Plugins/Battery.cs
+++ /dev/null
@@ -1,79 +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;
-
-namespace WPCordovaClassLib.Cordova.Commands
-{
- /// <summary>
- /// Listens for changes to the state of the battery on the device.
- /// Currently only the "isPlugged" parameter available via native APIs.
- /// </summary>
- public class Battery : BaseCommand
- {
- private bool isPlugged = false;
- private EventHandler powerChanged;
-
- public Battery()
- {
- powerChanged = new EventHandler(DeviceStatus_PowerSourceChanged);
- isPlugged = DeviceStatus.PowerSource.ToString().CompareTo("External") == 0;
- }
-
- public void start(string options)
- {
- // Register power changed event handler
- DeviceStatus.PowerSourceChanged += powerChanged;
-
- PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
- result.KeepCallback = true;
- DispatchCommandResult(result);
- }
- public void stop(string options)
- {
- // Unregister power changed event handler
- DeviceStatus.PowerSourceChanged -= powerChanged;
- }
-
- private void DeviceStatus_PowerSourceChanged(object sender, EventArgs e)
- {
- isPlugged = DeviceStatus.PowerSource.ToString().CompareTo("External") == 0;
- PluginResult result = new PluginResult(PluginResult.Status.OK, GetCurrentBatteryStateFormatted());
- result.KeepCallback = true;
- DispatchCommandResult(result);
- }
-
- private string GetCurrentBatteryStateFormatted()
- {
- string batteryState = String.Format("\"level\":{0},\"isPlugged\":{1}",
- "null",
- isPlugged ? "true" : "false"
- );
- batteryState = "{" + batteryState + "}";
- return batteryState;
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/cordova-wp7/blob/86d27fc9/templates/standalone/config.xml
----------------------------------------------------------------------
diff --git a/templates/standalone/config.xml b/templates/standalone/config.xml
index 64aef33..56869c3 100644
--- a/templates/standalone/config.xml
+++ b/templates/standalone/config.xml
@@ -35,7 +35,6 @@
<plugin name="Media"/>
<plugin name="Capture"/>
<plugin name="SplashScreen"/>
- <plugin name="Battery"/>
<plugin name="Globalization"/>
</plugins>