本文整理汇总了C#中Android.OS.Handler.SendEmptyMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Handler.SendEmptyMessage方法的具体用法?C# Handler.SendEmptyMessage怎么用?C# Handler.SendEmptyMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.OS.Handler
的用法示例。
在下文中一共展示了Handler.SendEmptyMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
tvStatus = FindViewById<TextView>(Resource.Id.tvStatus);
btnConnect = FindViewById<Button>(Resource.Id.btnConnect);
pbDownload = FindViewById<ProgressBar>(Resource.Id.pbDownLoad);
btnConnect.Click += BtnClick;
h = new Handler(new Action<Message>((Message msg) =>
{
switch (msg.What)
{
case STATUS_NONE:
btnConnect.Enabled = true;
tvStatus.Text = "Not connected";
pbDownload.Visibility = ViewStates.Gone;
break;
case STATUS_CONNECTING:
btnConnect.Enabled = false;
tvStatus.Text = "Connecting";
break;
case STATUS_CONNECTED:
tvStatus.Text = "Connected";
break;
case STATUS_DOWNLOAD_START:
tvStatus.Text = String.Format("Start download {0} files.",msg.Arg1);
pbDownload.Max = msg.Arg1;
pbDownload.Progress = 0;
pbDownload.Visibility = ViewStates.Visible;
break;
case STATUS_DOWNLOAD_FILE:
tvStatus.Text = String.Format("Downloading. {0} files left.", msg.Arg2);
pbDownload.Progress = msg.Arg1;
SaveFile((byte[])msg.Obj);
break;
case STATUS_DOWNLOAD_END:
tvStatus.Text = String.Format("Download comlete.");
break;
case STATUS_DOWNLOAD_NONE:
tvStatus.Text = String.Format("No files for download.");
break;
default:
break;
}
}));
h.SendEmptyMessage(STATUS_NONE);
}