本文整理汇总了C#中Android.App.AlertDialog.Builder.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# AlertDialog.Builder.Dispose方法的具体用法?C# AlertDialog.Builder.Dispose怎么用?C# AlertDialog.Builder.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.App.AlertDialog.Builder
的用法示例。
在下文中一共展示了AlertDialog.Builder.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: showConfirmDialog
public bool showConfirmDialog(Context context, string info)
{
if (!prepareModal())
return false;
// reset choice
mChoice = false;
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.SetMessage(info);
builder.SetCancelable(false);
builder.SetPositiveButton("OK", (object o, Android.Content.DialogClickEventArgs e) =>
{
this.mQuitModal = true;
this.mChoice = true;
builder.Dispose();
});
builder.SetNegativeButton("Cancel", (object o, Android.Content.DialogClickEventArgs e) =>
{
mQuitModal = true;
mChoice = false;
builder.Dispose(); // probably wrong
});
AlertDialog alert = builder.Create();
alert.Show();
doModal();
return mChoice;
}
示例2: Alert
public static void Alert(Context c, string title, string message, Activity parent)
{
AlertDialog.Builder builder = new AlertDialog.Builder(c);
builder.SetMessage(message);
builder.SetTitle(title);
builder.SetCancelable(false);
builder.SetPositiveButton(Resource.String.modalOK, (object o, Android.Content.DialogClickEventArgs e) =>
{
builder.Dispose();
});
AlertDialog alert = builder.Create();
alert.Show();
}
示例3: AlertRV
public static bool AlertRV(Context context, string title, string Message)
{
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.SetMessage(Message);
builder.SetTitle(title);
builder.SetCancelable(false);
builder.SetPositiveButton(Resource.String.modalOK, (object o, Android.Content.DialogClickEventArgs e) =>
{
builder.Dispose();
});
AlertDialog alert = builder.Create();
alert.Show();
return true;
}
示例4: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
{
base.OnElementChanged(e);
var page = e.NewElement as MainPage;
if (page != null) {
MessagingCenter.Subscribe(page, "KillActionSheet", (MainPage sender) => {
if (actionSheet != null) actionSheet.Dismiss();
});
MessagingCenter.Subscribe(page, "DisplayCustomAndroidActionSheet", (MainPage sender, CustomAndroidActionSheetArguments args) => {
var builder = new AlertDialog.Builder (Forms.Context);
builder.SetTitle(args.Title);
var items = args.Buttons.ToArray();
builder.SetItems(items, (sender2, args2) => args.Result.TrySetResult(items[args2.Which]));
if (args.Cancel != null)
builder.SetPositiveButton(args.Cancel, delegate {
args.Result.TrySetResult(args.Cancel);
});
if (args.Destruction != null)
builder.SetNegativeButton(args.Destruction, delegate {
args.Result.TrySetResult(args.Destruction);
});
actionSheet = builder.Create();
builder.Dispose();
actionSheet.SetCanceledOnTouchOutside(true);
actionSheet.CancelEvent += (sender3, ee) => args.SetResult(null);
actionSheet.Show();
});
}
}
示例5: Btn_Login_Click
private void Btn_Login_Click(object sender, EventArgs e)
{
string uuid = Android.Provider.Settings.Secure.GetString(this.ContentResolver, Android.Provider.Settings.Secure.AndroidId);
if(DataBaseController.instance().Login(uuid , edit_Password.Text) == false)
{
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
dlg.SetTitle("Password is not Correct");
dlg.SetMessage(edit_Password.Text);
dlg.SetNeutralButton("OK", (send, arg) => { dlg.Dispose(); });
dlg.Show();
}else
{
Intent cardListIntent = new Intent(this, typeof(CardListViewActivity));
StartActivity(cardListIntent);
}
}
示例6: showAlertDialog
public void showAlertDialog(Context context, string info)
{
if (!prepareModal())
return;
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.SetMessage(info);
builder.SetCancelable(false);
builder.SetPositiveButton("OK", (object o, Android.Content.DialogClickEventArgs e) =>
{
this.mQuitModal = true;
builder.Dispose(); // was dialog.dismiss()
});
AlertDialog alert = builder.Create();
alert.Show();
doModal();
}
示例7: onDelete
private void onDelete() {
ViewController vc = ViewController.getInstance();
AlertDialog.Builder builder = new AlertDialog.Builder(ViewController.getInstance().mainActivity);
builder.SetTitle("Team löschen!")
.SetMessage("Sind sie sicher?")
.SetIcon(Android.Resource.Drawable.IcDialogAlert)
.SetNegativeButton("Ja", async (sender, e) => { //left button
JsonValue json = JsonValue.Parse(await DB_Communicator.getInstance().deleteTeam(t.team.id));
vc.toastJson(null, json, ToastLength.Long, "");
//refresh team list
TeamsFragment tf = vc.mainActivity.FindFragmentByTag(ViewController.TEAMS_FRAGMENT) as TeamsFragment;
tf.listTeams = await DB_Communicator.getInstance().SelectTeams();
VBUser.GetUserFromPreferences().removeTeamrole(t.team.id);
builder.Dispose();
vc.mainActivity.popBackstack();
})
.SetPositiveButton("Abbrechen", (sender, e) => { //right button
})
.Show();
}
示例8: OnRestartClick
/// <summary>
/// This button changes states when the game ends, or begins/is going
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="e">E.</param>
public void OnRestartClick(object sender, EventArgs e)
{
if (!restartButtonToggle) {
var builder = new AlertDialog.Builder(this);
builder.SetMessage("Restart game?");
builder.SetPositiveButton("OK", (s, ea) => { newGame(); builder.Dispose(); });
builder.SetNegativeButton("Cancel", (s, ea) => { builder.Dispose(); });
builder.Create().Show();
} else {
newGame ();
}
}
示例9: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
// Use this to return your custom view for this Fragment
// return inflater.Inflate(Resource.Layout.YourFragment, container, false);
base.OnCreateView (inflater, container, savedInstanceState);
View rootView = inflater.Inflate (Resource.Layout.Block1Fragment, container, false);
pharmacyID = Arguments.GetInt (Common.PHARMACY_ID);
user = Common.GetCurrentUser ();
netCategories = Common.GetNetCategories (user.username);
promos = Common.GetPromos (user.username);
merchant = Common.GetMerchant (user.username);
territory = Common.GetTerritory (user.username);
pharmacy = PharmacyManager.GetPharmacy (pharmacyID);
var tradenets = Common.GetTradeNets (user.username);
Dictionary <int, string> tnDict = new Dictionary<int, string> ();
foreach (var item in tradenets) {
tnDict.Add (item.id, item.shortName);
};
attendance = AttendanceManager.GetCurrentAttendance ();
if (attendance == null) {
attendance = AttendanceManager.GetLastAttendance (pharmacyID);
if (attendance == null) {
attendance = new Attendance () {
pharmacy = pharmacyID,
date = DateTime.Now,
merchant = merchant.id
};
} else {
attendance.id = -1;
attendance.date = DateTime.Now;
}
}
rootView.FindViewById<TextView> (Resource.Id.b1fTradenetText).Text = tnDict [pharmacy.tradenet];//@"Аптечная Сеть";
rootView.FindViewById<TextView> (Resource.Id.b1fCityText).Text = territory.baseCity;
rootView.FindViewById<TextView> (Resource.Id.b1fPharmacyNameText).Text = pharmacy.shortName;
rootView.FindViewById<TextView> (Resource.Id.b1fPharmacyAddressText).Text = pharmacy.address;
rootView.FindViewById<TextView> (Resource.Id.b1fCategoryInOTCText).Text = pharmacy.category_otc;
rootView.FindViewById<TextView> (Resource.Id.b1fLastAttendanceText).Text = pharmacy.prev == DateTime.MinValue ? String.Empty : pharmacy.prev.ToString (@"d");
rootView.FindViewById<TextView> (Resource.Id.b1fNextAttendanceText).Text = pharmacy.next == DateTime.MinValue ? String.Empty : pharmacy.next.ToString (@"d");
rootView.FindViewById<TextView> (Resource.Id.b1fAllAttendanciesText).Text = AttendanceManager.GetStatistics(pharmacy.id);
categoryNetSpinner = rootView.FindViewById<Spinner> (Resource.Id.b1fCategoryNetSpinner);
ArrayAdapter adapter = new ArrayAdapter (Activity, Android.Resource.Layout.SimpleSpinnerItem, (from item in netCategories select item.key).ToArray<string>());
adapter.SetDropDownViewResource(Resource.Layout.SpinnerItem);
categoryNetSpinner.Adapter = adapter;
categoryNetSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => {
attendance.category_net = netCategories[e.Position].id;
};
// SetValue
for (int i = 0; i < netCategories.Count; i++) {
if (netCategories [i].id == attendance.category_net) {
categoryNetSpinner.SetSelection (i);
}
}
telephoneEdit = rootView.FindViewById<EditText> (Resource.Id.b1fTelephoneEdit);
telephoneEdit.Text = attendance.telephone;
purchaserFIOEdit = rootView.FindViewById<EditText> (Resource.Id.b1fPurchaserFIOEdit);
purchaserFIOEdit.Text = attendance.purchaserFIO;
promosEdit = rootView.FindViewById<EditText> (Resource.Id.b1fPromosEdit);
promosButton = rootView.FindViewById<Button> (Resource.Id.b1fPromosButton);
promosButton.Click += (object sender, EventArgs e) => {
bool[] checkedItems = new bool[promos.Count];
if (attendance.promos != null) {
for (int i = 0; i < promos.Count; i++) {
if(attendance.promos.Contains(promos[i].id)){
checkedItems[i] = true;
tempPromos.Add(promos[i].id);
}
}
}
string[] items = (from promo
in promos
orderby promo.id
select promo.name).ToArray<string>();
AlertDialog.Builder builder;
builder = new AlertDialog.Builder(Activity);
builder.SetTitle("Выбор ПРОМО-матералов");
builder.SetCancelable(false);
builder.SetMultiChoiceItems(items, checkedItems, MultiListClicked);
builder.SetPositiveButton(@"Сохранить",
delegate {
attendance.promos = tempPromos.ToArray<int>();
builder.Dispose();
RefreshPromos();
}
);
builder.SetNegativeButton(@"Отмена", delegate { builder.Dispose(); });
builder.Show();
};
RefreshPromos();
//.........这里部分代码省略.........
示例10: InternalSetPage
void InternalSetPage(Page page)
{
if (!Forms.IsInitialized)
throw new InvalidOperationException("Call Forms.Init (Activity, Bundle) before this");
if (_canvas != null)
{
_canvas.SetPage(page);
return;
}
var busyCount = 0;
MessagingCenter.Subscribe(this, Page.BusySetSignalName, (Page sender, bool enabled) =>
{
busyCount = Math.Max(0, enabled ? busyCount + 1 : busyCount - 1);
if (!Forms.SupportsProgress)
return;
SetProgressBarIndeterminate(true);
UpdateProgressBarVisibility(busyCount > 0);
});
UpdateProgressBarVisibility(busyCount > 0);
MessagingCenter.Subscribe(this, Page.AlertSignalName, (Page sender, AlertArguments arguments) =>
{
AlertDialog alert = new AlertDialog.Builder(this).Create();
alert.SetTitle(arguments.Title);
alert.SetMessage(arguments.Message);
if (arguments.Accept != null)
alert.SetButton((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult(true));
alert.SetButton((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult(false));
alert.CancelEvent += (o, args) => { arguments.SetResult(false); };
alert.Show();
});
MessagingCenter.Subscribe(this, Page.ActionSheetSignalName, (Page sender, ActionSheetArguments arguments) =>
{
var builder = new AlertDialog.Builder(this);
builder.SetTitle(arguments.Title);
string[] items = arguments.Buttons.ToArray();
builder.SetItems(items, (sender2, args) => { arguments.Result.TrySetResult(items[args.Which]); });
if (arguments.Cancel != null)
builder.SetPositiveButton(arguments.Cancel, delegate { arguments.Result.TrySetResult(arguments.Cancel); });
if (arguments.Destruction != null)
builder.SetNegativeButton(arguments.Destruction, delegate { arguments.Result.TrySetResult(arguments.Destruction); });
AlertDialog dialog = builder.Create();
builder.Dispose();
//to match current functionality of renderer we set cancelable on outside
//and return null
dialog.SetCanceledOnTouchOutside(true);
dialog.CancelEvent += (sender3, e) => { arguments.SetResult(null); };
dialog.Show();
});
_canvas = new Platform(this);
if (_application != null)
_application.Platform = _canvas;
_canvas.SetPage(page);
_layout.AddView(_canvas.GetViewGroup());
}
示例11: Button1_Click
// Handlers
private void Button1_Click(object sender, EventArgs e)
{
var alertDialog = new AlertDialog.Builder(this);
alertDialog.SetMessage(this.ViewModel.Data);
alertDialog.SetPositiveButton("OK", delegate { alertDialog.Dispose(); });
alertDialog.Show();
}
示例12: mClient_DownloadDataCompleted
void mClient_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
{
RunOnUiThread(() =>
{
string json = Encoding.UTF8.GetString(e.Result);
if (json == "Sem Registro")
{
lProduto = new List<RegistroProdutos>();
mProdutoAdapter = new ProdutosViewAdapter(this, Resource.Layout.ProdutosListItem, lProduto);
lstProdutoView.Adapter = mProdutoAdapter;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.SetMessage("Seleção sem Registro");
builder.SetCancelable(false);
builder.SetPositiveButton("OK", delegate {builder.Dispose(); });
builder.Show();
return;
} else {
lProduto = JsonConvert.DeserializeObject<List<RegistroProdutos>>(json);
mProdutoAdapter = new ProdutosViewAdapter(this, Resource.Layout.ProdutosListItem, lProduto);
lstProdutoView.Adapter = mProdutoAdapter;
mProgressBar.Visibility = ViewStates.Gone;
}
});
}
示例13: DisplayAlert
private void DisplayAlert(string v1, string v2, string v3)
{
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.SetTitle(v1);
alert.SetMessage(v2);
alert.SetNeutralButton(v3, (senderAlert, args) =>
{
alert.Dispose();
});
Dialog dialog = alert.Create();
dialog.Show();
}
示例14: mClient_DownloadDataCompleted
void mClient_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
{
RunOnUiThread(() =>
{
string json = Encoding.UTF8.GetString(e.Result);
if ((json == "Usuario ou Senha nao encontrado") || (json == "Usuario ou Senha sem preenchimento"))
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.SetMessage(json);
builder.SetCancelable(false);
builder.SetPositiveButton("OK", delegate {builder.Dispose(); });
builder.Show();
return;
} else {
lUsuario = JsonConvert.DeserializeObject<List<RegistroUsuario>>(json);
AlertCenter.Default.BackgroundColor = Color.White;
AlertCenter.Default.PostMessage ("Seja Bem Vindo", lUsuario[0].nome,Resource.Drawable.Icon);
StartActivity(typeof(MenuPrincipal));
this.Finish();
}
});
}
示例15: onDelete
private void onDelete() {
AlertDialog.Builder builder = new AlertDialog.Builder(ViewController.getInstance().mainActivity);
builder.SetTitle("Event löschen!")
.SetMessage("Sind sie sicher?")
.SetIcon(Android.Resource.Drawable.IcDialogAlert)
.SetNegativeButton("Ja", async (sender, e) => { //left button
JsonValue json = await DB_Communicator.getInstance().deleteEvent(_event.idEvent);
ViewController.getInstance().toastJson(ViewController.getInstance().mainActivity, json, ToastLength.Long, "Event delted");
await ViewController.getInstance().refreshEvents();
builder.Dispose();
ViewController.getInstance().mainActivity.popBackstack();
})
.SetPositiveButton("Abbrechen", (sender, e) => { //right button
})
.Show();
}