【发布时间】:2014-05-15 01:39:16
【问题描述】:
我是 phonegap 的新手。我正在开发一个 Windows 应用程序。在那个应用程序中,我尝试使用navigator.app.exitApp()。但它不起作用,我一直在尝试在我的项目中添加一个自定义插件。所以我下载了cordova-plugin-exitapp-master.zip。
在具有以下文件的 zip 文件中
cordova-plugin-exitapp-master/plugin.xml
cordova-plugin-exitapp-master/www/ExitApp.js
cordova-plugin-exitapp-master/src/wp/ExitApp.cs
cordova-plugin-exitapp-master/plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="se.sanitarium.cordova.exitapp"
version="1.0.0">
<name>ExitApp</name>
<description>Implements navigator.app.exitApp on WP8</description>
<license>Apache 2.0</license>
<keywords>cordova,terminate</keywords>
<js-module src="www/ExitApp.js" name="exitApp">
<merges target="navigator.app" />
</js-module>
<!-- wp8 -->
<platform name="wp8">
<config-file target="config.xml" parent="/*">
<feature name="ExitApp">
<param name="wp-package" value="ExitApp" />
</feature>
</config-file>
<source-file src="src/wp/ExitApp.cs" />
</platform>
</plugin>
cordova-plugin-exitapp-master/www/ExitApp.js
var exec = require('cordova/exec');
module.exports = {
/**
* Exits the PhoneGap application with no questions asked.
*/
exitApp: function() {
exec(null, null, 'ExitApp', 'exitApp', []);
}
};
cordova-plugin-exitapp-master/src/wp/ExitApp.cs
using System;
using System.Windows;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WPCordovaClassLib.Cordova;
using WPCordovaClassLib.Cordova.Commands;
using WPCordovaClassLib.Cordova.JSON;
namespace WPCordovaClassLib.Cordova.Commands
{
public class ExitApp : BaseCommand
{
public void exitApp(string options)
{
Application.Current.Terminate();
}
}
}
所以,请任何人告诉我。我必须在我的项目中的哪个地方添加上述插件?
【问题讨论】:
-
我已经引用了那个网址...但它说错误...所以我想知道我必须在我的项目中添加哪个地方?