[英]How to show loading dialog in phonegap in windows phone using plugins?
我正在开发一个phonegap应用程序,我只是试图在加载页面时显示一个循环进度对话框,我在Android中使用phonegap插件实现了这一点,当我尝试使用该插件从phonegap中的Windows本机窗口显示消息框时,它提示“无效的线程访问。”
这是我的代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Phone.Shell;
using System.Windows;
namespace WPCordovaClassLib.Cordova.Commands
{
public class Echo : BaseCommand
{
public void echo(string options)
{
MessageBox.Show("Are you sure?", "Delete Item", MessageBoxButton.OKCancel);
}
}
}
我的屏幕截图
我的JavaScript通话
cordova.exec( function(){}, function(){}, "Echo","echo", ["input string"]);
回调可能不在ui线程上,这可能是为什么只将其分派回ui线程即可得到此错误的原因:
public void echo(string options)
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
MessageBox.Show("Are you sure?", "Delete Item", MessageBoxButton.OKCancel);
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.