static public void Show(Context _context, string _msg) { if (alertDialog != null) { alertDialog.Dispose(); alertDialog = null; } alertDialog = new AlertDialog.Builder(_context).Create(); alertDialog.RequestWindowFeature((int)WindowFeatures.NoTitle); View view = new View(_context); LinearLayout linearLayout = new LinearLayout(_context); ProgressBar progressBar = new ProgressBar(_context); linearLayout.AddView(progressBar); TextView textView = new TextView(_context); textView.Text = _msg; linearLayout.AddView(textView); alertDialog.SetView(linearLayout); linearLayout.SetGravity(GravityFlags.Center); //不能用倒退鍵或點窗體外部關閉 alertDialog.SetCancelable(false); alertDialog.Show(); }
public void OnClick(View v) { string tag = (string)v.Tag; string[] split = tag.Split(null); alertUspesno = new AlertDialog.Builder(this.activity).Create(); alertUspesno.SetTitle("Obavestenje!"); alertUspesno.SetMessage("Uspesno ste zapratili korisnika: " + split[1] + " " + split[2]); alertUspesno.SetButton("U redu", delegate(object sender, DialogClickEventArgs args) { alertUspesno.Dispose(); }); alertObrada = new AlertDialog.Builder(this.activity).Create(); alertObrada.SetTitle("Obrada!"); alertObrada.SetMessage("Molimo sacekajte!"); alertObrada.Show(); vecPrati = new AlertDialog.Builder(this.activity).Create(); vecPrati.SetTitle("Obavestenje!"); vecPrati.SetMessage("Izabranog korisnika vec pratite."); vecPrati.SetButton("U redu", (sender, args) => vecPrati.Dispose()); Thread novaNit = new Thread(() => FuncijaNoveNiti(split[0])); novaNit.Start(); }
void OnClick() { Picker model = Element; if (_dialog == null) { using (var builder = new AlertDialog.Builder(Context)) { builder.SetTitle(model.Title ?? ""); string[] items = model.Items.ToArray(); builder.SetItems(items, (s, e) => ((IElementController)model).SetValueFromRenderer(Picker.SelectedIndexProperty, e.Which)); builder.SetNegativeButton(global::Android.Resource.String.Cancel, (o, args) => { }); ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true); _dialog = builder.Create(); } _dialog.SetCanceledOnTouchOutside(true); _dialog.DismissEvent += (sender, args) => { ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); _dialog.Dispose(); _dialog = null; }; _dialog.Show(); } }
public async Task <bool> MostrarMensaje(string p_titulo, string p_mensaje) { objDialog = new AlertDialog.Builder(this) .SetTitle(p_titulo) .SetMessage(p_mensaje) .SetCancelable(false) .Create(); bool respuesta = false; await Task.Run(() => { var waitHandle = new AutoResetEvent(false); objDialog.SetButton((int)(DialogButtonType.Positive), "yes", (sender, e) => { respuesta = true; waitHandle.Set(); }); objDialog.SetButton((int)DialogButtonType.Negative, "no", (sender, e) => { respuesta = false; waitHandle.Set(); }); RunOnUiThread(() => { objDialog.Show(); }); waitHandle.WaitOne(); }); objDialog.Dispose(); return(respuesta); }
public string ShowKeyboardInput(string defaultText) { var waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset); var kbi = new CCIMEKeyboardNotificationInfo(); OnKeyboardWillShow(); IsVisible = true; var context = Android.App.Application.Context; var alert = new AlertDialog.Builder(context); var input = new EditText(context) { Text = defaultText }; if (defaultText != null) { input.SetSelection(defaultText.Length); } alert.SetView(input); alert.SetPositiveButton("Ok", (dialog, whichButton) => { ContentText = input.Text; waitHandle.Set(); IsVisible = false; OnKeyboardWillHide(); }); alert.SetNegativeButton("Cancel", (dialog, whichButton) => { ContentText = null; waitHandle.Set(); IsVisible = false; OnKeyboardWillHide(); }); alert.SetCancelable(false); alertDialog = alert.Create(); alertDialog.Show(); OnKeyboardDidShow(); waitHandle.WaitOne(); if (alertDialog != null) { alertDialog.Dismiss(); alertDialog.Dispose(); alertDialog = null; } OnReplaceText(new CCIMEKeybardEventArgs(contentText, contentText.Length)); IsVisible = false; return(contentText); }
private void Easypaisa_Click(object sender, EventArgs e) { radiocard.Checked = false; radiobank.Checked = false; radioeasy.Checked = true; radiojazz.Checked = false; try { Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Easypaisa Account Information"); alert.SetMessage("Please Transfer your Funds to the Easypaisa Account" + "\nAccount Number:" + paymentInfo.easypaisanumber + "\n" + "Account Title:" + paymentInfo.easypaisatitle + "\nPlease give this code Number in Refrence:" + Control.UserInfoHolder.User_id.ToString() + Control.UserInfoHolder.currentIssueContext.ToString()); alert.SetButton("OK", delegate { alert.Dispose(); }); alert.Show(); } catch (Exception) { } }
public async Task LoginHandler() { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetTitle("Login") .SetMessage("Please wait while logging in...") .SetCancelable(false); AlertDialog dialog = null; RunOnUiThread(() => { dialog = alertBuilder.Show(); }); try { azureResourceManager = await AuthenticationManager.Authenticate(platformParam); } catch (Exception e) { } finally { if (dialog != null) { dialog.Dismiss(); dialog.Dispose(); } if (alertBuilder != null) { alertBuilder.Dispose(); } } }
public static void SDL_Main() { if (string.IsNullOrEmpty(Instance.GameExe)) { AlertDialog dialog = null; Instance.RunOnUiThread(() => { using (AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(Instance)) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("Game not found: ").AppendLine(Instance.GameName); stringBuilder.AppendLine(Instance.GameExe); dialogBuilder.SetMessage(stringBuilder.ToString().Trim()); dialogBuilder.SetCancelable(true); dialogBuilder.SetPositiveButton(Android.Resource.String.Ok, (s, e) => { dialog.Dismiss(); }); dialog = dialogBuilder.Show(); } }); while (dialog == null || dialog.IsShowing) { System.Threading.Thread.Sleep(0); } dialog.Dispose(); return; } // Replace the following with whatever was in your Program.Main method. /*/ * using (TestGame game = new TestGame()) * { * game.Run(); * } * /*/ // Assembly.LoadFrom(Instance.GameExe).EntryPoint.Invoke(null, new object[] { new string[] { /*args*/ } }); System.AppDomainSetup domainSetup = new System.AppDomainSetup() { ApplicationName = Path.GetFileName(Instance.GameExe), ApplicationBase = Path.GetDirectoryName(Instance.GameExe), }; System.AppDomain domain = System.AppDomain.CreateDomain( Path.GetDirectoryName(Instance.GameExe), System.AppDomain.CurrentDomain.Evidence, domainSetup ); domain.AssemblyResolve += ChildDomainAssemblyResolve; domain.ExecuteAssembly(Instance.GameExe); System.AppDomain.Unload(domain); /**/ }
private void _Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { if (_CurDialog != null && _CurDialogCreateTime.AddSeconds(15) <= DateTime.Now) { _CurDialog.Dismiss(); _CurDialog.Dispose(); _CurDialog = null; _Timer.Stop(); } else if (_CurDialog == null) { _Timer.Stop(); } } catch (Exception) { } }
/// <summary> /// Event Name : OnBackPressed /// Author : Sanket Prajapati /// Creation Date : 2 Dec 2017 /// Purpose : backup button avoid verification code screen /// Revision : /// </summary> public override void OnBackPressed() { alert = dialogue.Create(); alert.SetMessage(StringResource.msgBackButtonDisable); alert.SetButton(StringResource.msgOK, (c, ev) => { alert.Dispose(); }); alert.Show(); }
/// <summary> /// Method : OnBackPressed /// Author : Sanket Prajapati /// Creation Date : 2 Dec 2017 /// Purpose : backup button avoid Login screen /// Revision : /// </summary> public override void OnBackPressed() { dialogue = new AlertDialog.Builder(new ContextThemeWrapper(this, Resource.Style.AlertDialogCustom)); alert = dialogue.Create(); alert.SetMessage(StringResource.msgBackButtonDisable); alert.SetButton(StringResource.msgOK, (c, ev) => { alert.Dispose(); }); alert.Show(); }
/// <summary> /// Method Name : AlertMessage /// Author : Sanket prajapati /// Creation Date : 5 Jan 2018 /// Purpose : Show alert message /// Revision : /// </summary> public void AlertMessage(String StrErrorMessage) { dialogue = new AlertDialog.Builder(new ContextThemeWrapper(Activity, Resource.Style.AlertDialogCustom)); alert = dialogue.Create(); alert.SetMessage(StrErrorMessage); alert.SetButton(StringResource.msgOK, (c, ev) => { alert.Dispose(); }); alert.Show(); }
void CreateDialog() { if (_TextPickerCell.Items == null || _TextPickerCell.Items.Count == 0) { return; } var displayValues = _TextPickerCell.Items.Cast <object>().Select(x => x.ToString()).ToArray(); _picker = new APicker(_context); _picker.DescendantFocusability = DescendantFocusability.BlockDescendants; _picker.MinValue = 0; _picker.MaxValue = _TextPickerCell.Items.Count - 1; _picker.SetDisplayedValues(displayValues); _picker.Value = Math.Max(_TextPickerCell.Items.IndexOf(_TextPickerCell.SelectedItem), 0); _picker.WrapSelectorWheel = _TextPickerCell.IsCircularPicker; if (_dialog == null) { using (var builder = new AlertDialog.Builder(_context)) { builder.SetTitle(_title); Android.Widget.FrameLayout parent = new Android.Widget.FrameLayout(_context); parent.AddView(_picker, new Android.Widget.FrameLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Center)); builder.SetView(parent); builder.SetNegativeButton(global::Android.Resource.String.Cancel, (o, args) => { ClearFocus(); }); builder.SetPositiveButton(global::Android.Resource.String.Ok, (o, args) => { _TextPickerCell.SelectedItem = _TextPickerCell.Items[_picker.Value]; _command?.Execute(_TextPickerCell.Items[_picker.Value]); ClearFocus(); }); _dialog = builder.Create(); } _dialog.SetCanceledOnTouchOutside(true); _dialog.DismissEvent += (ss, ee) => { _dialog.Dispose(); _dialog = null; _picker.RemoveFromParent(); _picker.Dispose(); _picker = null; }; _dialog.Show(); } }
/// <summary> /// Ons the dismiss. /// </summary> /// <param name="dialog">Dialog.</param> public void OnDismiss(IDialogInterface dialog) { _dialog.SetOnShowListener(null); _dialog.SetOnDismissListener(null); _dialog.Dispose(); _dialog = null; _adapter?.Dispose(); _adapter = null; _listView.Dispose(); _listView = null; this.Selected = false; }
private void AttachSocketEvents(AlertDialog alert) { // Whenever the server emits "login", log the login message socket.On("login", data => { if (alert != null) { alert.Dismiss(); alert.Dispose(); alert = null; } var d = Data.FromData(data); connected = true; // Display the welcome message AddMessage("Welcome to Socket.IO Chat – ", true); AddParticipantsMessage(d.numUsers); }); // Whenever the server emits "new message", update the chat body socket.On("new message", data => { var d = Data.FromData(data); AddMessage(d.message, username: d.username); }); // Whenever the server emits "user joined", log it in the chat body socket.On("user joined", data => { var d = Data.FromData(data); AddMessage(d.username + " joined"); AddParticipantsMessage(d.numUsers); }); // Whenever the server emits "user left", log it in the chat body socket.On("user left", data => { var d = Data.FromData(data); AddMessage(d.username + " left"); AddParticipantsMessage(d.numUsers); UpdateChatTyping(d.username, true); }); // Whenever the server emits "typing", show the typing message socket.On("typing", data => { var d = Data.FromData(data); UpdateChatTyping(d.username, false); }); // Whenever the server emits "stop typing", kill the typing message socket.On("stop typing", data => { var d = Data.FromData(data); UpdateChatTyping(d.username, true); }); }
public bool DetachWithIME() { if (CanDetachWithIME()) { if (alertDialog != null && alertDialog.IsShowing) { alertDialog.Dismiss(); alertDialog.Dispose(); alertDialog = null; } } return(true); }
public void AlertDialogActions() { tlog.Debug(tag, $"AlertDialogActions START"); var testingTarget = new AlertDialog(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <AlertDialog>(testingTarget, "Should return AlertDialog instance."); View tc = new View() { Size = new Size(100, 20), Position = new Position(0, 0), BackgroundColor = Color.Green }; testingTarget.TitleContent = tc; testingTarget.TitleContent = tc; List <View> actions = new List <View>(); ViewStyle style1 = new ViewStyle() { BackgroundColor = Color.Red, }; View action1 = new View(style1); ButtonStyle style2 = new ButtonStyle() { BackgroundColor = Color.Yellow, }; View action2 = new Button(style2); actions.Add(action1); actions.Add(action2); testingTarget.Actions = actions; View ac = new View() { Size = new Size(100, 80), Position = new Position(0, 20) }; testingTarget.ActionContent = ac; testingTarget.Actions = actions; testingTarget.Dispose(); tlog.Debug(tag, $"AlertDialogActions END (OK)"); }
protected override void OnDetached() { if (!IsDisposed) { _view.Touch -= _view_Touch; } if (_dialog != null) { _dialog.Dispose(); _dialog = null; } _view = null; _command = null; }
public void OnError(FacebookException error) { var fbSignupErrorDialogHandler = new EventHandler <DialogClickEventArgs>((alertDialog, clicked) => { AlertDialog phoneNumberAlertDialog = alertDialog as AlertDialog; phoneNumberAlertDialog.Dismiss(); phoneNumberAlertDialog.Dispose(); }); AlertDialog fbSignupErrorAlert = new AlertDialog.Builder(this) .SetTitle(GetString(Resource.String.fb_signup_error)) .SetPositiveButton(GetString(Resource.String.ok_text), fbSignupErrorDialogHandler) .SetMessage(error.Message) .Show(); }
private void DisposeDialog(object sender, EventArgs e) { AlertDialog dialog = Dialogs.Pop(); if (!ReferenceEquals(sender, dialog)) { DisposeDialog(sender, e); Dialogs.Push(dialog); } else { dialog.Dispose(); } }
/// <summary> /// Dispose the specified disposing. /// </summary> /// <returns>The dispose.</returns> /// <param name="disposing">If set to <c>true</c> disposing.</param> protected override void Dispose(bool disposing) { if (disposing) { _dialog?.Dispose(); _dialog = null; _listView?.Dispose(); _listView = null; _adapter?.Dispose(); _adapter = null; _context = null; } base.Dispose(disposing); }
void OnClick(object?sender, EventArgs e) { if (_dialog == null && VirtualView != null) { using (var builder = new AlertDialog.Builder(Context)) { if (VirtualView.TitleColor == null) { builder.SetTitle(VirtualView.Title ?? string.Empty); } else { var title = new SpannableString(VirtualView.Title ?? string.Empty); #pragma warning disable CA1416 // https://github.com/xamarin/xamarin-android/issues/6962 title.SetSpan(new ForegroundColorSpan(VirtualView.TitleColor.ToPlatform()), 0, title.Length(), SpanTypes.ExclusiveExclusive); #pragma warning restore CA1416 builder.SetTitle(title); } string[] items = VirtualView.GetItemsAsArray(); builder.SetItems(items, (s, e) => { var selectedIndex = e.Which; VirtualView.SelectedIndex = selectedIndex; base.PlatformView?.UpdatePicker(VirtualView); }); builder.SetNegativeButton(AResource.String.Cancel, (o, args) => { }); _dialog = builder.Create(); } if (_dialog == null) { return; } _dialog.SetCanceledOnTouchOutside(true); _dialog.DismissEvent += (sender, args) => { _dialog?.Dispose(); _dialog = null; }; _dialog.Show(); } }
protected override void OnFocusChangeRequested(object sender, VisualElement.FocusRequestArgs e) { base.OnFocusChangeRequested(sender, e); if (e.Focus) { if (Clickable) { CallOnClick(); } else { ((IPickerRenderer)this)?.OnClick(); } } else if (_dialog != null) { _dialog.Hide(); ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); _dialog?.Dispose(); _dialog = null; } }
/// <summary> /// Method Name : AlertMessage /// Author : Sanket prajapati /// Creation Date : 5 Jan 2018 /// Purpose : Show alert message /// Revision : /// </summary> public void AlertMessage(String StrErrorMessage) { dialogue = new AlertDialog.Builder(new ContextThemeWrapper(this, Resource.Style.AlertDialogCustom)); alert = dialogue.Create(); alert.SetMessage(StrErrorMessage); alert.SetButton(StringResource.msgOK, (c, ev) => { if (!string.IsNullOrEmpty(txtQuestion.Text.Trim())) { txtQuestion.Text = string.Empty; } alert.Dispose(); }); alert.Show(); }
public void HideProgress() { lock (Locker) { if (_progressAlertDialog != null) { Device.BeginInvokeOnMainThread(() => { _progressAlertDialog.Dismiss(); _progressAlertDialog.Dispose(); _progressAlertDialog = null; }); } } }
protected override void OnDetached() { var renderer = Container as IVisualElementRenderer; if (renderer?.Element != null) { _view.Click -= _view_Click; } if (_dialog != null) { _dialog.Dispose(); _dialog = null; } _view = null; _command = null; }
protected override void OnDetachedOverride() { if (!IsDisposed) { _view.Touch -= _view_Touch; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached Disposing"); } if (_dialog != null) { _dialog.Dispose(); _dialog = null; } _view = null; _command = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); }
void CreateDialog() { _picker = new APicker(_context); _picker.MinValue = _min; _picker.MaxValue = _max; _picker.Value = _NumberPikcerCell.Number; if (_dialog == null) { using (var builder = new AlertDialog.Builder(_context)) { builder.SetTitle(_title); Android.Widget.FrameLayout parent = new Android.Widget.FrameLayout(_context); parent.AddView(_picker, new Android.Widget.FrameLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Center)); builder.SetView(parent); builder.SetNegativeButton(global::Android.Resource.String.Cancel, (o, args) => { ClearFocus(); }); builder.SetPositiveButton(global::Android.Resource.String.Ok, (o, args) => { _NumberPikcerCell.Number = _picker.Value; _command?.Execute(_picker.Value); ClearFocus(); }); _dialog = builder.Create(); } _dialog.SetCanceledOnTouchOutside(true); _dialog.DismissEvent += (ss, ee) => { _dialog.Dispose(); _dialog = null; _picker.RemoveFromParent(); _picker.Dispose(); _picker = null; }; _dialog.Show(); } }
void CreateDialog() { if (_dialog != null) { return; } var picker = new APicker(_view.Context); picker.MinValue = _min; picker.MaxValue = _max; picker.Value = _number; using (var builder = new AlertDialog.Builder(_view.Context)) { builder.SetTitle(AddNumberPicker.GetTitle(Element)); Android.Widget.FrameLayout parent = new Android.Widget.FrameLayout(_view.Context); parent.AddView(picker, new Android.Widget.FrameLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Center)); builder.SetView(parent); builder.SetNegativeButton(global::Android.Resource.String.Cancel, (o, args) => { }); builder.SetPositiveButton(global::Android.Resource.String.Ok, (o, args) => { AddNumberPicker.SetNumber(Element, picker.Value); _command?.Execute(picker.Value); }); _dialog = builder.Create(); } _dialog.SetCanceledOnTouchOutside(true); _dialog.DismissEvent += (ss, ee) => { _dialog.Dispose(); _dialog = null; picker.RemoveFromParent(); picker.Dispose(); picker = null; }; _dialog.Show(); }
public Task DisplayAlert(string message) { return(Task.Run(() => { _activity.RunOnUiThread(() => { AlertDialog.Builder dialog = new AlertDialog.Builder(Context); AlertDialog alert = dialog.Create(); alert.SetTitle("Scoreboard Tracker"); alert.SetMessage(message); alert.SetButton("OK", (c, ev) => { alert.Dispose(); }); alert.Show(); }); })); }