簡體   English   中英

如何使用插件在Windows Phone的phonegap中顯示加載對話框?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM