如果是xmarin.forms,使用:
try
{
Xamarin.Forms.Device.BeginInvokeOnMainThread(() => {
MessagingCenter.Send(App.Current, "log", e1.Message +"\r\n"+ e1.Source); // 这里更新UI。
});
}
catch (Exception e2)
{
Console.WriteLine(e2.Message);
}
如果是android.
FusionField.currentActivity.runOnUiThread(new Runnable()
{
public void run()
{
Toast.makeText(getApplicationContext(), , "Update My UI",
Toast.LENGTH_LONG).show();
}
});
网友评论