у меня есть следующая проблема со следующим кодом:Windows Phone 8.1 Плагин: класс не найден
plugin.xml
<?xml version="1.0" encoding="utf-8" ?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="barcodescanner-plugin"
version="0.0.1">
<name>Barcode Scanner Plugin</name>
<description>Cordova Barcode Scanner Plugin...</description>
<author>XXX</author>
<license>BSD</license>
<config-file target="config.xml" parent="/*">
<feature name="BarcodeScanner">
<param name="wp-package" value="BarcodeScanner"/>
</feature>
</config-file>
<js-module src="www/BarcodeScanner.js" name="BarcodeScanner">
<clobbers target="window.BarcodeScanner" />
</js-module>
<plattform name="wp8">
<config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
<Capability Name="pointOfSale"/>
</config-file>
<source-file src="src/wp/BarcodeScanner.cs" />
<framework src="lib/Windows.Devices.PointOfService.winmd" />
<framework src="lib/WPCordovaClassLib.dll" />
</plattform>
</plugin>
BarcodeScanner.js
var exec = require('cordova/exec');
var BarcodeScanner = {
result: "No Result available<br />",
Enable: function() {
try {
var that = this;
this.result += "Test 1<br />";
exec(function() { that.result += "Test 2.1"; }, function (error) { that.result += "Test 2.2: " + error; }, "BarcodeScanner", "Enable", []);
this.result += "Test 2<br />";
} catch (e) {
this.result += "Exception occured<br />";
this.result += e.message + "<br />";
}
}
}
module.exports = BarcodeScanner;
BarcodeScanner.cs
using WPCordovaClassLib.Cordova;
using WPCordovaClassLib.Cordova.Commands;
using WPCordovaClassLib.Cordova.JSON;
namespace WPCordovaClassLib.Cordova.Commands
{
public class BarcodeScanner : BaseCommand
{
public void Enable(string options)
{
PluginResult result = new PluginResult(PluginResult.Status.OK, "Test... Test...");
DispatchCommandResult(result);
}
}
}
index.js
var i = 0;
function updateOutputText() {
document.getElementById("output").innerHTML = i + ": " + window.BarcodeScanner.result;
i++;
}
window.setInterval(updateOutputText, 1000);
(function() {
"use strict";
document.addEventListener('deviceready', onDeviceReady.bind(this), false);
function onDeviceReady() {
window.BarcodeScanner.result += "Step 1<br />";
// Handle the Cordova pause and resume events
document.addEventListener('pause', onPause.bind(this), false);
document.addEventListener('resume', onResume.bind(this), false);
window.BarcodeScanner.result += "Step 2<br />";
window.BarcodeScanner.Enable();
};
function onPause() {
};
function onResume() {
};
})();
и следующие среды:
Кордова Инструменты для VS13 Кордова-версия: 5.0.0 и 4.1.2 (в VS13)
Цель - это Panasonic FZ-E1 с Windows Phone 8.1 Встроенный карманный компьютер
Приложения не печатает следующее, когда я называю его:
п: Нет доступные результатов Шаг 1 Шаг 2 Тест 1 Теста 2 Теста 2,2: Класс не найден
если я двигаю :
<config-file target="config.xml" parent="/*">
<feature name="BarcodeScanner">
<param name="wp-package" value="BarcodeScanner"/>
</feature>
</config-file>
к сегменту КР8 не печатает тест 2,2
если я изменить:
exec(function() { that.result += "Test 2.1"; }, function (error) { that.result += "Test 2.2: " + error; }, "BarcodeScanner", "Enable", []);
к:
exec(function() { that.result += "Test 2.1"; }, function (error) { that.result += "Test 2.2: " + error; }, "BarcodeScanner.BarcodeScanner", "Enable", []);
или
exec(function() { that.result += "Test 2.1"; }, function (error) { that.result += "Test 2.2: " + error; }, "XXXBarcodeScanner", "Enable", []);
также не печатает тест 2.2
Так что я не знаю точно HOWTO invoke now my C# -Method ... Я думаю, что BarcodeScanner - это правильное имя, потому что XXXBarcodeScanner это чертовски плохо, и BarcodeScanner.BarcodeScanner, похоже, показывает тот же результат. Можете ли вы сказать мне, что я делаю неправильно? Потому что на данный момент я действительно невежественный.
С уважением, Стивен Питер
Привет, уже пробовал, прежде чем использовать его в самой кордове с тем же результатом ... Это проект только для wp8, поэтому я не думаю, что это может быть причиной и да, у меня такая же проблема с моим конфигурационным файлом, но в большинстве случаев он развертывается с плагином. Но спасибо, я ценю вашу помощь :) –