本文整理汇总了C#中Android.App.ProgressDialog.SetButton方法的典型用法代码示例。如果您正苦于以下问题:C# ProgressDialog.SetButton方法的具体用法?C# ProgressDialog.SetButton怎么用?C# ProgressDialog.SetButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.App.ProgressDialog
的用法示例。
在下文中一共展示了ProgressDialog.SetButton方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
Button start = FindViewById<Button>(Resource.Id.startButton);
Button stop = FindViewById<Button>(Resource.Id.stopButton);
ProgressDialog pd = new ProgressDialog(this)
{
Indeterminate = true,
};
pd.SetMessage("Waiting");
pd.SetButton("cancel", (s, e) => Stop(pd));
pd.SetIcon(Resource.Drawable.Icon);
//pd.SetCancelable(false);
Drawable myIcon = Resources.GetDrawable(Resource.Animation.progress_dialog_icon_drawable_animation);
pd.SetIndeterminateDrawable(myIcon);
start.Click += delegate { Start(pd); };
stop.Click += delegate { Stop(pd); };
}
示例2: OnItemTap
public void OnItemTap(object sender, AdapterView.ItemClickEventArgs args)
{
if(progressDialog == null)
{
progressDialog = new ProgressDialog(this);
progressDialog.SetMessage("Uploading your content. Please wait.");
progressDialog.SetButton("Cancel Upload", (arg1, arg2) => { if (cancelTokenSource != null) cancelTokenSource.Cancel(); });
progressDialog.Indeterminate = true;
}
Android.Support.V7.App.AlertDialog alert = new Android.Support.V7.App.AlertDialog.Builder(this)
.SetTitle("Scenario Complete!")
.SetMessage("What would you like to do with the results of this scenario?")
.SetCancelable(true)
.SetNegativeButton("Delete", (EventHandler<DialogClickEventArgs>)null)
.SetPositiveButton("Upload", (s, a) => {
IResultItem toUpload = AppData.Session.ResultsToUpload[args.Position - 1];
progressDialog.Show();
cancelTokenSource = new CancellationTokenSource();
ServerData.PushResult(toUpload, RefreshList, OnUploadComplete, cancelTokenSource.Token);
})
.SetNeutralButton("Cancel", (s, a) => { })
.Create();
alert.Show();
// A second alert dialogue, confirming the decision to delete
Button negative = alert.GetButton((int)DialogButtonType.Negative);
negative.Click += delegate(object s, EventArgs e)
{
Android.Support.V7.App.AlertDialog.Builder confirm = new Android.Support.V7.App.AlertDialog.Builder(this);
confirm.SetTitle("Are you sure?");
confirm.SetMessage("The recorded data will be irrecoverably lost.");
confirm.SetPositiveButton("Delete", (senderAlert, confArgs) =>
{
AppData.Session.DeleteResult(AppData.Session.ResultsToUpload[args.Position - 1]);
RefreshList();
alert.Dismiss();
});
confirm.SetNegativeButton("Cancel", (senderAlert, confArgs) => { });
confirm.Show();
};
}
示例3: OnCreateDialog
protected override Dialog OnCreateDialog(int id)
{
switch (id) {
case DIALOG_YES_NO_MESSAGE: {
var builder = new AlertDialog.Builder (this);
builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle (Resource.String.alert_dialog_two_buttons_title);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
return builder.Create ();
}
case DIALOG_YES_NO_OLD_SCHOOL_MESSAGE: {
var builder = new AlertDialog.Builder (this, Android.App.AlertDialog.ThemeTraditional);
builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle (Resource.String.alert_dialog_two_buttons_title);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
return builder.Create ();
}
case DIALOG_YES_NO_HOLO_LIGHT_MESSAGE: {
var builder = new AlertDialog.Builder (this, Android.App.AlertDialog.ThemeHoloLight);
builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle (Resource.String.alert_dialog_two_buttons_title);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
return builder.Create ();
}
case DIALOG_YES_NO_LONG_MESSAGE: {
var builder = new AlertDialog.Builder (this);
builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle (Resource.String.alert_dialog_two_buttons_msg);
builder.SetMessage (Resource.String.alert_dialog_two_buttons_msg);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
builder.SetNeutralButton (Resource.String.alert_dialog_something, NeutralClicked);
return builder.Create ();
}
case DIALOG_YES_NO_ULTRA_LONG_MESSAGE: {
var builder = new AlertDialog.Builder (this);
builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle (Resource.String.alert_dialog_two_buttons_msg);
builder.SetMessage (Resource.String.alert_dialog_two_buttons2ultra_msg);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
builder.SetNeutralButton (Resource.String.alert_dialog_something, NeutralClicked);
return builder.Create ();
}
case DIALOG_LIST: {
var builder = new AlertDialog.Builder (this);
builder.SetTitle (Resource.String.select_dialog);
builder.SetItems (Resource.Array.select_dialog_items, ListClicked);
return builder.Create ();
}
case DIALOG_PROGRESS: {
progress_dialog = new ProgressDialog (this);
progress_dialog.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
progress_dialog.SetTitle (Resource.String.select_dialog);
progress_dialog.SetProgressStyle (ProgressDialogStyle.Horizontal);
progress_dialog.Max = MAX_PROGRESS;
progress_dialog.SetButton (Android.App.Dialog.InterfaceConsts.ButtonPositive, GetText (Resource.String.alert_dialog_ok), OkClicked);
progress_dialog.SetButton (Android.App.Dialog.InterfaceConsts.ButtonNegative, GetText (Resource.String.alert_dialog_cancel), CancelClicked);
return progress_dialog;
}
case DIALOG_SINGLE_CHOICE: {
var builder = new AlertDialog.Builder (this);
builder.SetIconAttribute (Android.Resource.Attribute.AlertDialogIcon);
builder.SetTitle (Resource.String.alert_dialog_single_choice);
builder.SetSingleChoiceItems (Resource.Array.select_dialog_items2, 0, ListClicked);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
return builder.Create ();
}
case DIALOG_MULTIPLE_CHOICE: {
var builder = new AlertDialog.Builder (this);
builder.SetIcon (Resource.Drawable.ic_popup_reminder);
builder.SetTitle (Resource.String.alert_dialog_multi_choice);
builder.SetMultiChoiceItems (Resource.Array.select_dialog_items3, new bool[] { false, true, false, true, false, false, false }, MultiListClicked);
builder.SetPositiveButton (Resource.String.alert_dialog_ok, OkClicked);
builder.SetNegativeButton (Resource.String.alert_dialog_cancel, CancelClicked);
return builder.Create ();
}
case DIALOG_MULTIPLE_CHOICE_CURSOR: {
var projection = new string[] { BaseColumns.Id, Contacts.PeopleColumns.DisplayName, Contacts.PeopleColumns.SendToVoicemail };
var cursor = ManagedQuery (ContactsContract.Contacts.ContentUri, projection, null, null, null);
var builder = new AlertDialog.Builder (this);
builder.SetIcon (Resource.Drawable.ic_popup_reminder);
builder.SetTitle (Resource.String.alert_dialog_multi_choice_cursor);
//.........这里部分代码省略.........
示例4: OnPreExecute
protected override void OnPreExecute()
{
base.OnPreExecute();
_progressDialog = new ProgressDialog(_context);
_progressDialog.SetTitle("Mandelbrot generation in progress");
_progressDialog.SetMessage("Please wait...");
_progressDialog.SetCancelable(true);
_progressDialog.SetProgressStyle(ProgressDialogStyle.Horizontal);
_progressDialog.SetButton(-2, "Cancel", CancelClicked);
_progressDialog.Show();
}
示例5: DownloadingProgressDialog
public ProgressDialog DownloadingProgressDialog(string title, string message)
{
ProgressDialog progress = new ProgressDialog(context);
progress.SetMessage(message);
progress.SetTitle(title);
progress.SetIcon(Resource.Drawable.Icon);
progress.SetButton("Cancel", (sender, args) =>
{
// Close progress dialog
progress.Dismiss();
// Stop all downloads
client.CancelAsync();
// Remove any language folders that were to be downloaded
for (var i = 0; i < downloadQueue.Count; i++)
{
DeleteLanguagePack(downloadQueue[i]);
}
// No downloads to be downloaded
downloadQueue = new List<string>();
// No files to be download
FilesCoutner = 0;
// They didn't all download, but set to true anyways
allDownloaded = true;
if (DownloadedLanguages.Count > 0)
{
Language = Language;
}
});
progress.SetProgressStyle(ProgressDialogStyle.Horizontal);
progress.SetCancelable(false);
progress.SetCanceledOnTouchOutside(false);
return progress;
}