/* * public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) * { * menu.Add (0, 0, 0, "Login to Google"); * menu.Add (0, 1, 1, "Logout"); * base.OnCreateContextMenu(menu, v, menuInfo); * } * * public override bool OnContextItemSelected(IMenuItem item) * { * switch (item.ItemId) { * case 0: * UIAskLogon (); * break; * case 1: * UIConfirmLogout (); * break; * } * return base.OnContextItemSelected(item); * } */ void UIAskLogon() { var view = View.Inflate(this, Resource.Layout.LoginDialog, null); var db = new AlertDialog.Builder(this) .SetTitle("Login to Google") .SetView(view); AlertDialog dlg = null; var do_login = view.FindViewById <Button> (Resource.Id.loginExecuteButton); do_login.Click += delegate { var userEntry = view.FindViewById <EditText> (Resource.Id.userNameEntry); var pwdEntry = view.FindViewById <EditText> (Resource.Id.passwordEntry); var sp = GetSharedPreferences("tiny_gmusic", FileCreationMode.Private | FileCreationMode.Append); var editor = sp.Edit(); string user = userEntry.Text; string pwd = pwdEntry.Text; editor.PutString("username", user); editor.PutString("password", pwd); editor.Commit(); model.ProcessLoginCommand(user, pwd); dlg.Hide(); }; var do_cancel = view.FindViewById <Button> (Resource.Id.loginCancelButton); do_cancel.Click += delegate { dlg.Hide(); }; dlg = db.Show(); }
public void actualizar() { _bultos = _bultosWS.ActualizarInventarioPaquetes("", usuario, "001", txtCodigo.Text.Trim(), txtUbicacion.Text.Trim(), Chequear(), "1", ip); if (_bultos == null) { ReproducirAlertaError(); LimpiarCodigo(); return; } if (_bultos.BltNumero == 0) { ReproducirAlerta(); if (_noDisponibleAlertDialog != null && _noDisponibleAlertDialog.IsShowing) { _noDisponibleAlertDialog.Hide(); } MostrarMensaje(); } else { ReproducirAlertaError(); if (_noDisponibleAlertDialog != null && _noDisponibleAlertDialog.IsShowing) { _noDisponibleAlertDialog.Hide(); } MostrarMensaje(); } LimpiarCodigo(); }
public Task HideLoadingAsync() { // Based on https://github.com/redth-org/AndHUD/blob/master/AndHUD/AndHUD.cs lock (_progressDialogLock) { if (_progressDialog is null) { return(Task.CompletedTask); } void actionDismiss() { try { if (IsAlive(_progressDialog) && IsAlive(_progressDialog.Window)) { _progressDialog.Hide(); _progressDialog.Dismiss(); } } catch { // ignore } _progressDialog = null; } // First try the SynchronizationContext if (Application.SynchronizationContext != null) { Application.SynchronizationContext.Send(state => actionDismiss(), null); return(Task.CompletedTask); } // Otherwise try OwnerActivity on dialog var ownerActivity = _progressDialog?.OwnerActivity; if (IsAlive(ownerActivity)) { ownerActivity.RunOnUiThread(actionDismiss); return(Task.CompletedTask); } // Otherwise try get it from the Window Context if (_progressDialog?.Window?.Context is Activity windowActivity && IsAlive(windowActivity)) { windowActivity.RunOnUiThread(actionDismiss); return(Task.CompletedTask); } // Finally if all else fails, let's see if current activity is MainActivity if (CrossCurrentActivity.Current.Activity is MainActivity activity && IsAlive(activity)) { activity.RunOnUiThread(actionDismiss); return(Task.CompletedTask); } return(Task.CompletedTask); } }
private void btnSrvy4_Click(object sender, EventArgs e) { if ((radioGroup1.CheckedRadioButtonId != -1) && (radioGroup2.CheckedRadioButtonId != -1) && (radioGroup3.CheckedRadioButtonId != -1) && (radioGroup4.CheckedRadioButtonId != -1) && (radioGroup5.CheckedRadioButtonId != -1) && (radioGroup6.CheckedRadioButtonId != -1)) { var intent = new Intent(this, typeof(Survey4Activity)); StartActivity(intent); } else { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Selection Required"); alert.SetMessage("Your must select one from the options"); alert.SetButton("OK", (c, ev) => { alert.Hide(); }); alert.Show(); } }
void listViewItemClick(object sender, AdapterView.ItemClickEventArgs e) { alertDialog.Hide(); if (filesFolders.Count > 0) { CloudMetaData metaData = filesFolders[dataPosition]; if (e.Position == 0) { if (metaData.Folder) { Toast.MakeText(this, "Can only download files", ToastLength.Short).Show(); } else { DownloadFile(metaData); } } else if (e.Position == 1) { ShareLink(metaData); } else if (e.Position == 2) { DeleteFileFolder(metaData); } } }
private void Bt_Email_Click(object sender, EventArgs e) { alertDialog = builder.Create(); alertDialog.SetTitle("Enter your email"); if (txtEmail.Parent != null) { ((ViewGroup)txtEmail.Parent).RemoveView(txtEmail); } alertDialog.SetView(txtEmail); alertDialog.SetIcon(Resource.Color.transparent); alertDialog.SetButton("Email", (s, ev) => { ThreadPool.QueueUserWorkItem(o => Email(txtEmail.Text)); Keyboard.HideKeyboard(this, this.txtEmail); }); alertDialog.SetButton3("Cancel", (s, ev) => { alertDialog.Hide(); Keyboard.HideKeyboard(this, this.txtEmail); }); alertDialog.Show(); Keyboard.ShowKeyboard(this, txtEmail); }
public bool TryGetAllSongs(out List <GoogleMusicSong> results) { results = null; try { using (var ifs = IsolatedStorageFile.GetUserStoreForApplication()) { if (!ifs.FileExists("all_songs.lst")) { return(false); } var fs = ifs.OpenFile("all_songs.lst", FileMode.Open); results = (List <GoogleMusicSong>) new DataContractJsonSerializer(typeof(List <GoogleMusicSong>)).ReadObject(fs); return(true); } } catch (Exception ex) { Log.Error("TinyGMusic", ex.ToString()); AlertDialog dlg = null; var db = new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("Could not load cached song list. It is ignored") .SetPositiveButton("OK", delegate { dlg.Hide(); }); this.RunOnUiThread(() => dlg = db.Show()); return(false); } }
public void Hide() { dlg.Hide(); if (onHide != null) { onHide(); } }
public void Hide() { if (dialog != null) { dialog.Hide(); dialog = null; } }
public void Hide() { if (_dialog == null) { throw new MissingMemberException("You need call Setup before hiding screen lock"); } _context.RunOnUiThread(() => _dialog.Hide()); }
public void Show() { alertDialog.Show(); new Handler().PostDelayed(() => { alertDialog.Hide(); }, 3000); }
public static void ShowAlertWithTwoButtons(Activity self, string title, string message, string buttonText1, string buttonText2, Action but1Callback, Action but2Callback) { Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(self); AlertDialog alert = dialog.Create(); alert.SetTitle(title); alert.SetMessage(message); alert.SetButton(buttonText1, (c, ev) => { but1Callback(); alert.Hide(); }); alert.SetButton2(buttonText2, (c, ev) => { but2Callback(); alert.Hide(); }); alert.Show(); }
public void ShowApiError(Exception ex) { AlertDialog dlg = null; var db = new AlertDialog.Builder(this) .SetTitle("Error") .SetMessage("App error: " + ex.Message) .SetPositiveButton("OK", (o, e) => dlg.Hide()); this.RunOnUiThread(() => dlg = db.Show()); }
public void ShowLogoutPopup() { AlertDialog myCustomDialog = null; var activity = Forms.Context as Activity; using (var layoutInflater = (LayoutInflater)activity.GetSystemService(Context.LayoutInflaterService)) { if (layoutInflater != null) { var view = layoutInflater.Inflate(Resource.Layout.LogoutPopup, null); var header = view.FindViewById <TextView>(Resource.Id.titleLogin); header.Text = "Log out"; var message = view.FindViewById <TextView>(Resource.Id.lblMessage); message.Text = "Are you sure to log out from Application?"; var btnYesClick = view.FindViewById <TextView>(Resource.Id.btnYes); var btnNoClick = view.FindViewById <TextView>(Resource.Id.btnNo); using (var builder = new AlertDialog.Builder(activity)) { builder.SetView(view); builder.SetCancelable(false); myCustomDialog = builder.Create(); myCustomDialog.Show(); btnNoClick.Click += delegate { myCustomDialog.Hide(); }; } btnYesClick.Click += delegate { myCustomDialog.Hide(); //if (HttpRequest.CheckConnection()) //{ // App.Database.ClearLoginDetails(); //} App.Current.MainPage = new Login(); }; } } }
private async void RegisterButton_ClickAsync(object sender, EventArgs e) { TextView errorTextView = FindViewById <TextView>(Resource.Id.errorTextView); if (CrossConnectivity.Current.IsConnected) { errorTextView.Visibility = ViewStates.Gone; if (!dataValid || EmptyField()) { errorTextView.Text = "Wypełnij dane poprawnie..."; errorTextView.Visibility = ViewStates.Visible; } else { registerUser.UserName = registerUser.Email.Split('@').ElementAt(0); var registerSuceed = await WebApiDataController.RegisterUser(this, registerUser); if (!registerSuceed) { errorTextView.Text = "Konto o podanym adresie już istnieje"; errorTextView.Visibility = ViewStates.Visible; } else { Toast.MakeText(this, "Zarejestrowano pomyślnie", ToastLength.Short); AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Ważne!"); alert.SetMessage("Aktywuj konto linkiem wysłanym w wiadomości e-mail. Link wygasa za 6 godzin."); alert.SetButton("OK", (c, ev) => { alert.Hide(); Bundle extras = new Bundle(); extras.PutString("email", emailEditText.Text); extras.PutBoolean("registered", true); FinishActivity(1); Intent intent = new Intent(this, typeof(SignInActivity)); intent.PutExtras(extras); StartActivity(intent); }); alert.Show(); errorTextView.Visibility = ViewStates.Gone; } } } else { errorTextView.Text = "Brak połączenia z internetem"; errorTextView.Visibility = ViewStates.Visible; } }
public static void ShowAlert(Activity activity, string title, string message) { AlertDialog.Builder dialog = new AlertDialog.Builder(activity); AlertDialog alert = dialog.Create(); alert.SetTitle(title); alert.SetMessage(message); alert.SetButton("OK", (c, ev) => { alert.Hide(); }); alert.Show(); }
public static void ShowAlertWithSingleButton(Activity self, string title, string message, string buttonText) { Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(self); AlertDialog alert = dialog.Create(); alert.SetTitle(title); alert.SetMessage(message); alert.SetButton(buttonText, (c, ev) => { alert.Hide(); }); alert.Show(); }
internal override void OnFocusChangeRequested(object sender, VisualElement.FocusRequestArgs e) { base.OnFocusChangeRequested(sender, e); if (e.Focus) CallOnClick(); else if (_dialog != null) { _dialog.Hide(); ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); _dialog = null; } }
public void ShowAlert(string message) { var dialog = new AlertDialog.Builder(CrossCurrentActivity.Current.Activity); AlertDialog alert = dialog.Create(); alert.SetTitle("Alert"); alert.SetMessage(message); alert.SetButton("Ok", (c, ev) => { alert.Hide(); }); alert.Show(); }
private void dismissPermissionsDialogs() { if (mDialogLocationPermissions != null) { mDialogLocationPermissions.Hide(); mDialogLocationPermissions = null; } if (mDialogLastTryLocationPermissions != null) { mDialogLastTryLocationPermissions.Hide(); mDialogLastTryLocationPermissions = null; } }
public Alert(Context context, string title, string message) { Android.App.AlertDialog.Builder builder = new AlertDialog.Builder(context); alertDialog = builder.Create(); alertDialog.SetTitle(title); //alertDialog.SetIcon(Resource.Drawable.Icon); alertDialog.SetMessage(message); //YES //NO alertDialog.SetButton3("Ok", (s, ev) => { alertDialog.Hide(); }); }
private void SetBusy(bool isBusy = true) { // This function toggles running of the 'progress' control feedback status to denote if // the viewshed analysis is executing as a result of the user click on the map. if (isBusy) { // Show the busy alert dialog. _alert.Show(); } else { // Remove the busy alert dialog. _alert.Hide(); } }
protected override void OnFocusChangeRequested(object sender, VisualElement.FocusRequestArgs e) { base.OnFocusChangeRequested(sender, e); if (e.Focus) { CallOnClick(); } else if (_dialog != null) { _dialog.Hide(); ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); Control.ClearFocus(); _dialog = null; } }
private void OnDrawStatusChanged(object sender, DrawStatusChangedEventArgs e) { // Make sure that the UI changes are done in the UI thread RunOnUiThread(() => { // Show the activity indicator if the map is drawing if (e.Status == DrawStatus.InProgress) { _progressDialog.Show(); } else { _progressDialog.Hide(); } }); }
static public void Hide() { if (alertDialog == null) { return; } if (alertDialog.IsShowing == false) { return; } alertDialog.Hide(); alertDialog.Dispose(); alertDialog = null; }
private void UpdateInterfaceState(SampleState newState) { // Manage the UI state for the sample. _currentSampleState = newState; switch (_currentSampleState) { case SampleState.NotReady: _addStopButton.Enabled = false; _addBarrierButton.Enabled = false; _resetButton.Enabled = false; _reorderStopsCheckbox.Enabled = false; _preserveLastStopCheckbox.Enabled = false; _preserveFirstStopCheckbox.Enabled = false; _directionsButton.Enabled = false; _routeButton.Enabled = false; _statusLabel.Text = "Preparing sample..."; break; case SampleState.AddingBarriers: _statusLabel.Text = "Tap the map to add a barrier."; break; case SampleState.AddingStops: _statusLabel.Text = "Tap the map to add a stop."; break; case SampleState.Ready: _addStopButton.Enabled = true; _addBarrierButton.Enabled = true; _resetButton.Enabled = true; _reorderStopsCheckbox.Enabled = true; _preserveLastStopCheckbox.Enabled = true; _preserveFirstStopCheckbox.Enabled = true; _directionsButton.Enabled = true; _routeButton.Enabled = true; _busyIndicator.Hide(); _statusLabel.Text = "Click 'Add stop' or 'Add barrier', then tap on the map to add stops and barriers."; break; case SampleState.Routing: _busyIndicator.Show(); break; } }
/// <summary> /// Input the title and message for alert /// </summary> /// <param name="title"></param> /// <param name="message"></param> public void ShowAlert(String title, string message) { Android.App.AlertDialog.Builder alertDiaglog = new Android.App.AlertDialog.Builder(context); AlertDialog alert = alertDiaglog.Create(); alert.SetTitle(title); alert.SetMessage(message); alert.SetButton("OK", (c, ev) => { // Ok button click task alert.Hide(); }); alert.SetButton2("Cancel", (c, ev) => { // Ok button click task alert.Cancel(); }); alert.Show(); }
private void expandableListView_ChildClick(object sender, ExpandableListView.ChildClickEventArgs e) { InstructionNotificationDialog.Hide(); var childSelected = (InstructionGroupedListObject)e.Parent.ExpandableListAdapter.GetChild(e.GroupPosition, e.ChildPosition); childSelected.Instructions[e.ChildPosition].OpenMessageModal((result) => { if (result) { var childList = (InstructionGroupedListObject)e.Parent.ExpandableListAdapter.GetChild(e.GroupPosition, e.ChildPosition); var child = childList.Instructions[e.ChildPosition]; child.MobileData.ProgressState = InstructionProgress.Complete; CurrentPopInstructions.Remove(child); } InstructionNotificationDialog.Show(); }); }
public void GetLoginCredential(Action <string, string> loginCallback) { var sp = GetSharedPreferences("tiny_gmusic", FileCreationMode.Private | FileCreationMode.Append); var user = sp.GetString("username", null); var pwd = sp.GetString("password", null); if (user == null || pwd == null) { //UIAskLogon (); AlertDialog dlg = null; var db = new AlertDialog.Builder(this) .SetTitle("Welcome to Tiny GMusic") .SetMessage("First of all, you have to log in to Google to retrieve song list") .SetPositiveButton("OK", (o, e) => dlg.Hide()); dlg = db.Show(); } else { loginCallback(user, pwd); } }
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 = null; } }