public void CloseProgressDialog() { if (alertDialog != null) { alertDialog.Dismiss(); alertDialog = null; builder = null; } }
void CloseProgressDialogue() { if (alert != null) { alertDialog.Dismiss(); alertDialog = null; alert = null; } }
private void CloseProgressDialogue() { if (_alert != null) { _alertDialog.Dismiss(); _alertDialog = null; _alert = null; } }
protected void ShowAlertDialog(Exception ex) { Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this); builder.SetMessage(ex.Message).SetTitle(Resource.String.errorDialogTitle); builder.SetNeutralButton(Resource.String.errorDialogButton, this); Android.Support.V7.App.AlertDialog dialog = builder.Create(); dialog.Show(); }
private void CloseProgressDialogue() { if (_alert == null) { return; } _alertDialog.Dismiss(); _alertDialog = null; _alert = null; }
private void SavePosData() { try { if (pos != null) { int quentity = Int32.Parse(quentityInput.Text); if (quentity > pos.Norm) { quentity = pos.Norm; } pos.Rate = quentity; if (pos.Weight != Double.Parse(weightInput.Text.Replace(".", ","))) { pos.IsWeight = true; } pos.Weight = Double.Parse(weightInput.Text.Replace(".", ",")); positionItem = positionsList.FindIndex(a => a.Id == pos.Id); foreach (var t in positionsList) { if (t.Code == pos.Code) { t.Weight = pos.Weight; } } RunOnUiThread(() => codeInput.Text = pos.Code); RunOnUiThread(() => quentityInput.Text = pos.Rate.ToString()); RunOnUiThread(() => weightInput.Text = pos.Weight.ToString()); MainThread.BeginInvokeOnMainThread(() => { adapterPosition = new PositionsAdapter(positionsList); adapterPosition.ItemClick += OnPositionClick; ordersRecyclerView.SetAdapter(adapterPosition); ordersRecyclerView.ScrollToPosition(positionItem); }); codeInput.ClearFocus(); quentityInput.ClearFocus(); weightInput.ClearFocus(); isEdit = true; } } catch (Exception ex) { RunOnUiThread(() => { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Ошибка сохранения"); alert.SetMessage("Ошибка: " + ex.Message); alert.Show(); return; }); } }
private void displayProgressDialog(string message) { LayoutInflater layoutInflater = LayoutInflater.From(this); View connectionErrorView = layoutInflater.Inflate(Resource.Layout.ProgressLayout, null); //mView.SetBackgroundColor(Color.Transparent); Android.Support.V7.App.AlertDialog.Builder alertProgress = new Android.Support.V7.App.AlertDialog.Builder(this); alertProgress.SetView(connectionErrorView).SetCancelable(false); connectionErrorView.FindViewById <TextView>(Resource.Id.displayLoading).Text = message; alertDialog = alertProgress.Show(); }
private void btnGeoWithAddress_Click(object sender, EventArgs e) { search_view = base.LayoutInflater.Inflate(Resource.Layout.search_alert_layout, null); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetView(search_view); builder.SetTitle("Search Location"); builder.SetNegativeButton("Cancel", (send, arg) => { builder.Dispose(); }); search_view.FindViewById <Button>(Resource.Id.btnSearch).Click += btnSearchClicked; alert = builder.Create(); alert.Show(); }
private void ProfilePic_Click(object sender, EventArgs e) { //Open Dialog AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetTitle("Add Photo"); alertBuilder.SetItems(Resource.Array.upload_photo, this); AlertDialog alertDialog = alertBuilder.Create(); alertDialog.Show(); }
protected override async void OnCreate(Bundle savedInstanceState) { string theme = SettingsHelper.GetTheme(this); if (theme == "dark") { SetTheme(Resource.Style.Dark_Theme); } base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.register_activity); Android.Support.V7.Widget.Toolbar toolbar = FindViewById(Resource.Id.toolbar).JavaCast <Android.Support.V7.Widget.Toolbar>(); toolbar.SetContentInsetsAbsolute(0, 0); SetSupportActionBar(toolbar); ImageView backButton = FindViewById <ImageView>(Resource.Id.MenuButton); backButton.Click += ((sender, e) => { OnBackPressed(); }); txtName = FindViewById <EditText>(Resource.Id.txtName); txtPhone = FindViewById <EditText>(Resource.Id.txtPhone); txtPassword = FindViewById <EditText>(Resource.Id.txtPassword); txtPasswordRepeat = FindViewById <EditText>(Resource.Id.txtPasswordRepeat); txtPricingScheme = FindViewById <EditText>(Resource.Id.txtPricingScheme); btnRegister = FindViewById <Button>(Resource.Id.btnRegister); txtPricingScheme.Click += TxtPricingScheme_Click; btnRegister.Click += BtnRegister_Click; schemes = await ServiceHelper.GetPricingCategories(); if (schemes != null) { var dialogView = LayoutInflater.Inflate(Resource.Layout.pricing_schemes_list, null); using (var dialog = new Android.Support.V7.App.AlertDialog.Builder(this)) { dialog.SetTitle(Resource.String.select_pricing_scheme); dialog.SetView(dialogView); dialog.SetNegativeButton("Cancel", (s, a) => { }); alertDialog = dialog.Create(); } var items = schemes.Select(x => x.Name).ToArray(); var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, items); ListView listView = dialogView.FindViewById <ListView>(Resource.Id.listView); listView.Adapter = adapter; listView.ItemClick += ListView_ItemClick; } }
/// <summary> /// Shows a dialog. /// </summary> /// <param name="title">A dialog title.</param> /// <param name="value">A dialog value.</param> /// <param name="canCopy">Indicates that "Copy value" is activated.</param> /// <param name="valueToCopy">Value to copy by button.</param> internal void ShowInfoDialog(string title, string value, bool canCopy, string valueToCopy) { // dialog builder using (Android.Support.V7.App.AlertDialog.Builder dialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(new ContextThemeWrapper(this, Resource.Style.AlertDialogTheme))) { // create button dialogBuilder.SetPositiveButton(Resources.GetString(Resource.String.ok_button), (EventHandler <DialogClickEventArgs>)null); if (canCopy) { dialogBuilder.SetNeutralButton(Resources.GetString(Resource.String.copy_value_button), (EventHandler <DialogClickEventArgs>)null); _infoDialogValueToCopy = valueToCopy; } // create dialog _infoDialog = dialogBuilder.Create(); _infoDialog.Window.SetBackgroundDrawableResource(Android.Resource.Drawable.ScreenBackgroundDarkTransparent); // set dialog title _infoDialog.SetTitle(title); // set dialog message _infoDialog.SetMessage(value); // show on screen _infoDialog.Show(); // get display size DisplayMetrics displayMetrics = new DisplayMetrics(); WindowManager.DefaultDisplay.GetMetrics(displayMetrics); int height = (int)(displayMetrics.HeightPixels * 3 / 4); // if dialog content height is greater than 3/4 of screen height if (_infoDialog.Window.Attributes.Height > height) { _infoDialog.Window.SetLayout(_infoDialog.Window.Attributes.Width, height); } TextView dialogTextView = _infoDialog.FindViewById <TextView>(Android.Resource.Id.Message); // allow to select dialog text dialogTextView.SetTextIsSelectable(true); // allow to click links dialogTextView.MovementMethod = LinkMovementMethod.Instance; dialogTextView.LinksClickable = true; // add links Utils.MyLinkify.AddLinks(dialogTextView, Patterns.EmailAddress, null); Utils.MyLinkify.AddLinks(dialogTextView, Patterns.WebUrl, null, new Utils.MyLinkify(), null); if (canCopy) { _infoDialogNeutralButton = _infoDialog.GetButton((int)DialogButtonType.Neutral); _infoDialogNeutralButton.Click += NeutralButton_Click; _infoDialogPositiveButton = _infoDialog.GetButton((int)DialogButtonType.Positive); _infoDialogPositiveButton.Click += PositiveButton_Click; } } }
private void OnTimedEvent(object sender, ElapsedEventArgs e) { RunOnUiThread(() => { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Вы давно не сохранялись"); alert.SetMessage("Возможно стоит нажать кнопку СОХРАНИТЬ? :)"); alert.Show(); return; }); }
private void ErrorMessage(string ex) { RunOnUiThread(() => { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Ошибка программы"); alert.SetMessage(ex); alert.Show(); return; }); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DeleteAccount_Click(object sender, EventArgs e) { LayoutInflater inflater = LayoutInflater.From(this); View view = inflater.Inflate(Resource.Layout.dialog_delete_account, null); AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetView(view); var email = view.FindViewById <EditText>(Resource.Id.dialog_delete_email); var password = view.FindViewById <EditText>(Resource.Id.dialog_delete_password); alertBuilder.SetTitle("Delete Account") .SetPositiveButton("Submit", delegate { try { //update current user var user = auth.CurrentUser; if (user != null) { uid = user.Uid; //delete from auth var reauth = auth.CurrentUser.ReauthenticateAsync(EmailAuthProvider .GetCredential(email.Text, password.Text)).ContinueWith(task => { if (task.IsCompletedSuccessfully) { Task result = user.Delete().AddOnCompleteListener(this); Toast.MakeText(this, "Yeah!", ToastLength.Short).Show(); } else { Toast.MakeText(this, "Failed to reauthenticate account.", ToastLength.Short).Show(); } }); } } catch (Exception ex) { Toast.MakeText(this, "Sorry, an error occured during delete", ToastLength.Short).Show(); } }) .SetNegativeButton("No", delegate { alertBuilder.Dispose(); }); AlertDialog alertDialog = alertBuilder.Create(); alertDialog.Show(); }
private void fabFunctions() { View view = null; Android.Support.V7.App.AlertDialog dialog = null; switch (fabfunctionidentifier) { case 1: if (view != null) { view = null; } if (dialog != null) { dialog = null; } view = LayoutInflater.Inflate(Resource.Layout.add_project_dialog, null); dialog = helpDialog.AddProjectDialog(this, core, view); dialog.Show(); break; case 2: if (view != null) { view = null; } if (dialog != null) { dialog = null; } view = LayoutInflater.Inflate(Resource.Layout.add_task_layout, null); //dialog = helpDialog.AddTaskDialog(this, core,view, pServer); //dialog.Show(); break; case 3: timesheetFragment.ShowAddLineDialog(); break; case 4: helpDialog.AddEnterpriseResource(this).Show(); break; case 5: break; } }
private void StartTraining_Click(object sender, EventArgs e) { switch (modelNumber) { case 0: flag = true; LayoutInflater layoutInflaterAndroid = LayoutInflater.From(this); View view = layoutInflaterAndroid.Inflate(Resource.Layout.trainingDate, null); Android.Support.V7.App.AlertDialog.Builder alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this); alertDialogBuilder.SetView(view); dateTraining = view.FindViewById <DatePicker>(Resource.Id.dateTraining); alertDialogBuilder.SetCancelable(false) .SetPositiveButton("Stwórz", delegate { var db = new SQLiteConnection(_dbPath); db.CreateTable <Training>(); var maxPk = db.Table <Training>().OrderByDescending(c => c.Id).FirstOrDefault(); Training training = new Training() { Id = (maxPk == null ? 1 : maxPk.Id + 1), Name = trainingName, UserId = userId, TrainingDone = true, TrainingDate = getDate() }; trainingIdCurrent = training.Id; db.Insert(training); startTraining.Visibility = ViewStates.Invisible; Toast.MakeText(this, trainingName + " rozpoczeto", ToastLength.Short).Show(); }) .SetNegativeButton("Anuluj", delegate { alertDialogBuilder.Dispose(); }); Android.Support.V7.App.AlertDialog alertDialogAndroid = alertDialogBuilder.Create(); alertDialogAndroid.Show(); break; case 1: Intent intent = new Intent(this, typeof(EditTraining)); intent.PutExtra("TrainingId", trainingId); StartActivity(intent); Finish(); break; } }
void CloseProgressDialog() { if (alert != null) { alertDialog.Dismiss(); alert.Dispose(); alertDialog = null; alert = null; player.Stop(); player.Dispose(); player = null; } }
/// <summary> /// Dialog for editing first and last name /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditName_Click(object sender, EventArgs e) { LayoutInflater inflater = LayoutInflater.From(this); View view = inflater.Inflate(Resource.Layout.dialog_profile_name, null); AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetView(view); var fName = view.FindViewById <EditText>(Resource.Id.dialog_edit_fname); var lName = view.FindViewById <EditText>(Resource.Id.dialog_edit_lname); //string[] fullName = name.Text.Split(" "); //fName.Text = fullName[0]; //lName.Text = fullName[1]; alertBuilder.SetTitle("Edit Name") .SetPositiveButton("Submit", delegate { try { //get current user if (auth.CurrentUser != null) { var document = db.Collection("users").Document(auth.CurrentUser.Uid); var data = new Dictionary <string, Java.Lang.Object>(); data.Add("FName", fName.Text); data.Add("LName", lName.Text); document.Update((IDictionary <string, Java.Lang.Object>)data); Toast.MakeText(this, "Done!", ToastLength.Long).Show(); } else { Toast.MakeText(this, "Something went wrong. Sorry.", ToastLength.Long).Show(); } } catch (Exception ex) { Toast.MakeText(this, "Failed to update. Sorry.", ToastLength.Long).Show(); } }) .SetNegativeButton("Cancel", delegate { alertBuilder.Dispose(); }); AlertDialog alertDialog = alertBuilder.Create(); alertDialog.Show(); }
/* * Creates an outgoing conversation UI dialog */ private void showCallDialog() { var participantEditText = new EditText(this); alertDialog = Dialog.CreateCallParticipantsDialog(participantEditText, delegate { /* * Make outgoing invite */ var participant = participantEditText.Text; if (!string.IsNullOrEmpty(participant) && conversationsClient != null) { stopPreview(); // Create participants set (we support only one in this example) var participants = new List <string> (); participants.Add(participant); // Create local media var localMedia = setupLocalMedia(); // Create outgoing invite outgoingInvite = conversationsClient.SendConversationInvite(participants, localMedia, new ConversationCallback { ConversationHandler = (c, err) => { if (err == null) { // Participant has accepted invite, we are in active conversation this.conversation = c; conversation.ConversationListener = conversationListener(); } else { Android.Util.Log.Error(TAG, err.Message); hangup(); reset(); } } }); setHangupAction(); } else { Android.Util.Log.Error(TAG, "invalid participant call"); conversationStatusTextView.Text = "call participant failed"; } }, delegate { setCallAction(); alertDialog.Dismiss(); }, this); alertDialog.Show(); }
private void ShowCalendarInDialog(string title, int layoutResId) { dialogView = (CalendarPickerView)LayoutInflater.Inflate(layoutResId, null, false); theDialog = new AlertDialog.Builder(this) .SetTitle(title) .SetView(dialogView) .SetNeutralButton("Dismiss", (sender, e) => theDialog.Dismiss()) .Create(); theDialog.ShowEvent += delegate { dialogView.FixDialogDimens(); }; theDialog.Show(); }
void Alerta(string title, string message) { alert.Builder adb = new alert.Builder(this); adb.SetTitle(title); adb.SetMessage(message); adb.SetNeutralButton("Aceptar", (senderAlert, args) => { }); alert dialog = adb.Create(); dialog.Show(); }
public void CheckForWaitingParty() { List <WaitingParty> list = library.GetWaitingParties(); if (list == null) { return; } WaitingParty party = null; foreach (WaitingParty wp in list) { if (wp.MobileUserId == mUserId) { party = wp; } } if (party != null) { Restaurant restaurant = library.GetRestaurant(party.RestaurantID); if (restaurant != null) { mSelection.Visibility = ViewStates.Visible; mLocationName.Visibility = ViewStates.Visible; mInfo.Visibility = ViewStates.Visible; mLocationName.Text = restaurant.Name; mInfo.Text = restaurant.Address; mSelection.Click += delegate { mBuilder = new Android.Support.V7.App.AlertDialog.Builder(this); mBuilder.SetTitle("Get InLine"); LayoutInflater inflater = this.LayoutInflater; CheckInCheckOutItem item = new CheckInCheckOutItem(mContext, mBuilder.Context, null); item.ID = party.PartyId; item.Address = restaurant.Address; mBuilder.SetView(item); mBuilder.SetCancelable(true); mBuilder.SetNegativeButton("Exit", (s, e) => { mAlertDialog.Dismiss(); }); mAlertDialog = mBuilder.Create(); mAlertDialog.Show(); }; } } DateTime date = DateTime.Now; string format = "ddd, dd MMM"; txtDate.Text = date.ToString(format); }
/* * Creates an connect UI dialog */ private void ShowConnectDialog() { EditText roomEditText = new EditText(this); alertDialog = dialog.Dialog.CreateConnectDialog(roomEditText, (sender, args) => { ConnectToRoom(roomEditText.Text); }, (sender, args) => { IntializeUi(); alertDialog.Dismiss(); }, this); alertDialog.Show(); }
private void Tie() { using (var builder = new Android.Support.V7.App.AlertDialog.Builder(this)) { string tieTitleString = "Remis. Czy chcesz zagrać ponownie?"; Android.Support.V7.App.AlertDialog myCustomDialog = null; builder.SetTitle(tieTitleString); builder.SetPositiveButton("Tak", OkAction); builder.SetNegativeButton("Nie", CancelAction); myCustomDialog = builder.Create(); myCustomDialog.Show(); } }
private void RepeatLayout_Click(object sender, EventArgs e) { var builder = new Android.Support.V7.App.AlertDialog.Builder(this); builder.SetTitle("Choose a repeat interval"); builder.SetSingleChoiceItems(_items, _selectedRepeatIndex, (s, ev) => { _selectedRepeatIndex = ev.Which; repeatSelectedTextView.Text = _items[ev.Which]; _dialog.Dismiss(); }); _dialog = builder.Create(); _dialog.Show(); }
public void ShowHelp() { Android.Support.V7.App.AlertDialog.Builder helpBuild = new Android.Support.V7.App.AlertDialog.Builder(this); helpBuild.SetTitle("Help"); helpBuild.SetMessage("Guess the word by selecting the letters.\n\n" + "You only have 6 wrong selections then it's game over!"); helpBuild.SetPositiveButton("OK", (c, v) => { helpAlert.Dismiss(); }); helpAlert = helpBuild.Create(); helpBuild.Show(); }
void CreateNewItem() { View dialogView = LayoutInflater.Inflate(Resource.Layout.ItemCreate, null); // Retrieve the components EditText name = dialogView.FindViewById <EditText>(Resource.Id.editText1); DatePicker datePicker = dialogView.FindViewById <DatePicker>(Resource.Id.datePicker1); TimePicker timePicker = dialogView.FindViewById <TimePicker>(Resource.Id.timePicker1); // Build the dialog Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this); builder.SetPositiveButton("Create", (sender, e) => CommitCreation(name.Text, datePicker, timePicker)); builder.SetNegativeButton("Cancel", (sender, e) => { }); Android.Support.V7.App.AlertDialog dialog = builder.Create(); dialog.SetView(dialogView); dialog.Show(); }
public bool OnActionItemClicked(ActionMode mode, IMenuItem item) { switch (item.ItemId) { //ifuserclickmenu print_me case Resource.Id.print_me: //createanalert dialog AlertDialog.Builder builder = new AlertDialog.Builder(parent); string msg = "Are you sure you want to print items?"; builder.SetMessage(msg) .SetCancelable(false) .SetPositiveButton("Yes", (or, er) => { SparseBooleanArray selected = parent.myAdapter.getSelectedIds(); List <string> list_item = new List <string>(); for (int i = (selected.Size() - 1); i >= 0; i--) { //checkisvaluecheckedby user if (selected.ValueAt(i)) { int selectedItem = (int)parent.myAdapter.GetItem(selected.KeyAt(i)); list_item.Add(selectedItem.ToString()); } } //print message Toast.MakeText(parent, "YouSelect" + parent.myAdapter.getSelectedCount() + "Item:[" + string.Join(",", list_item) + "]", ToastLength.Long).Show(); mode.Finish(); parent.below_layout.Visibility = ViewStates.Gone; // Gone }) .SetNegativeButton("No", (or, er) => { parent.below_layout.Visibility = ViewStates.Gone; // Gone ((Dialog)or).Cancel(); }); AlertDialog alert = builder.Create(); alert.Show(); return(true); default: return(false); } }
private void UpdateDataToServer() { try { int stopPosition = positionsList.Count - 1; for (int i = 0; i < stopPosition; i++) { if (positionsList[i].IsUpdate == true) { try { string link = positionsList[i].Id.ToString() + "a" + positionsList[i].Rate.ToString().Replace(".", ",") + "a" + positionsList[i].Weight.ToString().Replace(".", ","); new WebClient().DownloadString("http://192.168.1.33/CMOS/CMOSS/PostPositionsPreorderApi/" + link); } catch (Exception ex) { ordersRecyclerView.Visibility = ViewStates.Visible; RunOnUiThread(() => { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Сервер не отвечает"); alert.SetMessage("Повторите попытку" + " Ошибка: " + ex.Message); alert.Show(); return; }); } } } isEdit = false; CreateTimer(); RunOnUiThread(() => { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Сохранено"); alert.SetMessage(""); alert.Show(); return; }); } catch (Exception ex) { ErrorMessage("MainActivity - UpdateDataToServer:" + ex.Message); } }
private async void SetQuality(PopupWindow window, EZConstants.EZVideoLevel level) { window.Dismiss(); if (!ConnectionDetector.IsNetworkAvailable(this)) { // 提示没有连接网络 Utils.ShowToast(this, Resource.String.realplay_set_fail_network); return; } Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this); builder.SetCancelable(false); builder.SetMessage(Resource.String.setting_video_level); Android.Support.V7.App.AlertDialog dialog = builder.Show(); var result = await CameraHelpers.SetVideoLevel(camera.DeviceSerial, camera.CameraNo, level); dialog.Dismiss(); if (result.Model) { camera.SetVideoLevel(videoLevel.Ordinal()); if (level == EZConstants.EZVideoLevel.VideoLevelHd) { btnVideoLevel.Text = GetString(Resource.String.quality_hd); } else if (level == EZConstants.EZVideoLevel.VideoLevelBalanced) { btnVideoLevel.Text = GetString(Resource.String.quality_balanced); } else if (level == EZConstants.EZVideoLevel.VideoLevelFlunet) { btnVideoLevel.Text = GetString(Resource.String.quality_flunet); } else { btnVideoLevel.Text = GetString(Resource.String.quality_flunet); } } else if (result.HasError) { Toast.MakeText(this, result.Error.Description, ToastLength.Long).Show(); } player.StopPlay(); SystemClock.Sleep(500); player.StartPlay(); }