private void NewListAlertMethod(object sender, System.EventArgs e)
        {
            AlertDialog.Builder newListAlert = new AlertDialog.Builder(this);
            newListAlert.SetTitle("New List");
            newListAlert.SetMessage("Please enter the name of your new list");
            EditText input = new EditText(this)
            {
                TextSize = 22,
                Gravity  = GravityFlags.Center,
                Hint     = "List Name",
            };

            input.SetSingleLine(true);

            newListAlert.SetView(input);
            newListAlert.SetPositiveButton("OK", (senderAlert, arg) =>
            {
                NewListSave(input.Text);
            });

            newListAlert.SetNegativeButton("Cancel", (senderAlert, arg) => { });

            Dialog dialog = newListAlert.Create();

            dialog.Show();
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.EditProfile:
                Intent newActivity = new Intent(this, typeof(ProfileActivity));
                newActivity.PutExtra("data", bundle);


                StartActivity(newActivity);
                return(true);

            case Resource.Id.Logout:
                AlertDialog.Builder builder = new AlertDialog.Builder(this);

                builder.SetTitle("Logout?");
                builder.SetMessage("Are you sure you want to log out of the app?\n(Go to the Login page after the logout.)");
                builder.SetPositiveButton("OK", (c, ev) =>
                {
                    Intent LoginActivity = new Intent(this, typeof(LoginActivity));
                    StartActivity(LoginActivity);
                    FinishAffinity();
                });
                builder.SetNegativeButton("Cancel", (c, ev) =>
                {
                    builder.Dispose();
                });
                builder.Create().Show();
                return(true);
            }

            return(base.OnOptionsItemSelected(item));
        }
Beispiel #3
0
        private void MMultipleDelete_Click(object sender, EventArgs e)
        {
            AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);

            alertDialog.SetTitle("Are you sure?");
            alertDialog.SetMessage("Do you want to delete this item?");
            alertDialog.SetPositiveButton("yes", delegate
            {
                // throw new NotImplementedException();
                List <Product> listaNouaProduse = new List <Product>(); //construim o noua lista de produse

                listaNouaProduse.AddRange(mProducts);                   //populez lista noua
                foreach (Product product in mProductsCD)                //luam fiecare produs din lista copiata-> daca produsul respectiv are Id-ul magazinului egal cu ceea ce am selectat in spinner-> in lista noua de produse se adauga produsul

                {
                    if (product.Checked) //am inclus Checked ca si coloana[Ignore] in clasa Produse
                    {
                        listaNouaProduse.Remove(product);
                        db.deleteProduct(product);
                        mProductsCopy.Remove(product); //ca sa sterg produsele din lista copie de la filtrare
                        Toast.MakeText(this, "The selected products were deleted!", ToastLength.Long).Show();
                    }
                }

                mProducts = listaNouaProduse;   //la lista noastra initiala de produse se adauga listaNouaProduse(am sters din ea elemente)

                mAdapter.mProducts = mProducts; //se actualizeaza adapterul cu lista noua
                mAdapter.NotifyDataSetChanged();
            });

            alertDialog.SetNegativeButton("NO", (IDialogInterfaceOnClickListener)null);
            alertDialog.Create();
            alertDialog.Show();
        }
Beispiel #4
0
        public static AlertDialog.Builder Build(Activity activity, PromptConfig config)
        {
            var txt = new EditText(activity)
            {
                Hint = config.Placeholder
            };

            if (config.Text != null)
            {
                txt.Text = config.Text;
            }

            SetInputType(txt, config.InputType);

            var builder = new AlertDialog
                          .Builder(activity)
                          .SetCancelable(false)
                          .SetMessage(config.Message)
                          .SetTitle(config.Title)
                          .SetView(txt)
                          .SetPositiveButton(config.OkText, (s, a) =>
                                             config.OnResult(new PromptResult(true, txt.Text.Trim()))
                                             );

            if (config.IsCancellable)
            {
                builder.SetNegativeButton(config.CancelText, (s, a) =>
                                          config.OnResult(new PromptResult(false, txt.Text.Trim()))
                                          );
            }
            return(builder);
        }
Beispiel #5
0
        // Alert Dialog box-if you want to delete something press Yes - then the product is deleted
        private void MAdapter_CellClick_ButtonDelete(object sender, Product e)
        {
            // throw new NotImplementedException();
            this.RunOnUiThread(() =>
            {
                AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);

                alertDialog.SetTitle("Are you sure?");
                alertDialog.SetMessage("Do you want to delete this item?");
                alertDialog.SetPositiveButton("yes", delegate
                {
                    alertDialog.Dispose();

                    //e.Position = mAdapter.mProducts.IndexOf(e);
                    db.deleteProduct(e);
                    mAdapter.mProducts.Remove(e);
                    mProductsCopy.Remove(e);
                    mAdapter.NotifyItemRemoved(e.Position);

                    Toast.MakeText(this, " The product " + e.ToString() + " was deleted! ", ToastLength.Long).Show();
                });
                alertDialog.SetNegativeButton("NO", (IDialogInterfaceOnClickListener)null);
                alertDialog.Create();
                alertDialog.Show();
            });
        }
Beispiel #6
0
        protected override void OnListItemClick(ListView l, View v, int position, long id) // checked item click
        {
            base.OnListItemClick(l, v, position, id);

            RunOnUiThread(() =>
            {
                AlertDialog.Builder builder;
                builder = new AlertDialog.Builder(this);
                builder.SetTitle(" Confirm ");
                builder.SetMessage(" Are you done with this item ?");
                builder.SetCancelable(true);

                builder.SetPositiveButton(" OK ", delegate
                {
                    //remove item from listview
                    var item = Items[position];
                    Items.Remove(item);
                    adapter.Remove(item);

                    //reset listview l
                    l.ClearChoices();
                    l.RequestLayout();

                    UpdatedStoredData();
                });

                builder.SetNegativeButton(" Cancel ", delegate
                                          { return; });

                builder.Show(); //Launches the popup!
            }
                          );
        }
Beispiel #7
0
 private void ConfirmSelectedCollaborators(object sender, EventArgs e)
 {
     if (assignUserList.Count > 0)
     {
         AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
         alertBuilder.SetCancelable(false);
         alertBuilder.SetMessage("Do you want to share this report with this selected users?");
         alertBuilder.SetTitle("Share Report");
         alertBuilder.SetPositiveButton("Yes", (sender1, args) =>
         {
             Intent formActivity = new Intent(this, typeof(FormActivity));
             formActivity.PutExtra(Resources.GetString(Resource.String.assign_user_list_type), Resources.GetString(Resource.String.add_collaborators));
             formActivity.PutIntegerArrayListExtra(Resources.GetString(Resource.String.assign_user_id_list), assignUserList);
             SetResult(Result.Ok, formActivity);
             Finish();
         });
         alertBuilder.SetNegativeButton("No", (sender1, args) =>
         {
             assignUserList.Clear();
             alertBuilder.Dispose();
             userListAdapter = new UserListAdapter(this, userCompanies, selectedUserList, userListType);
             userListAdapter.ButtonClickedOnAssignInvite += ButtonClickDelegate;
             expandableListView.SetAdapter(userListAdapter);
         });
         alertBuilder.Show();
     }
     else
     {
         Utility.DisplayToast(this, "Please select a user to share report");
     }
 }
        private void LoadPrintWebVIew()
        {
            // PrescriptionView is the design view
            var printView = LayoutInflater.Inflate(Resource.Layout.print_view, null);

            CreatePrintWebView(printView);
            Android.App.AlertDialog dialog = null;
            AlertDialog.Builder     alert  = new AlertDialog.Builder(this);

            alert.SetView(printView);

            alert.SetPositiveButton("Print", (senderAlert, args) =>
            {
                var webView     = printView.FindViewById <WebView>(Resource.Id.printWebView);
                string fileName = "MyPrintFile_" + Guid.NewGuid().ToString() + ".pdf";
                var printMgr    = (PrintManager)GetSystemService(MainActivity.PrintService);
                printMgr.Print("MyPrintJob", webView.CreatePrintDocumentAdapter(fileName), new PrintAttributes.Builder().Build());
            });

            alert.SetNegativeButton("Close", (senderAlert, args) =>
            {
                dialog.Dismiss();
            });

            dialog = alert.Create();
            dialog.Show();
            // dialogPrescription.Window.SetLayout(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
        }
Beispiel #9
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            // Handle presses on the action bar items
            try
            {
                switch (item.ItemId)
                {
                case Resource.Id.action_settings:
                    Intent i = new Intent(this, typeof(SettingsActivity));
                    StartActivityForResult(i, SETTINGS_ACTIVITY_CODE);
                    return(true);

                case Resource.Id.action_goto:
                    AlertDialog.Builder builder = new AlertDialog.Builder(this);
                    builder.SetTitle("Go To ... %");
                    EditText inputGoTo = new EditText(this);
                    inputGoTo.InputType = InputTypes.ClassNumber;
                    IInputFilter[] fa = new IInputFilter[1];
                    fa[0] = new InputFilterLengthFilter(2);
                    inputGoTo.SetFilters(fa);
                    inputGoTo.Text    = Convert.ToString((int)(Math.Min(linesRecyclerView.progress * 100, 99)));
                    inputGoTo.Gravity = GravityFlags.Center;
                    inputGoTo.SetSelection(inputGoTo.Text.Length);
                    builder.SetView(inputGoTo);
                    builder.SetPositiveButton("Go", (sender, e) =>
                    {
                        int newPercent = 0;

                        try
                        {
                            newPercent = Math.Max(0, Math.Min(int.Parse(inputGoTo.Text.ToString()), 100));
                            int newPos = (int)Math.Round((double)textLen * newPercent / 100);
                            Annotate(newPos);
                            ((AlertDialog)sender).Dismiss();
                        }
                        catch (System.FormatException)
                        {
                            Toast.MakeText(this, "Invalid percent number", ToastLength.Long).Show();
                        }
                    });
                    builder.SetNegativeButton("Cancel", (sender, e) =>
                    {
                        ((AlertDialog)sender).Cancel();
                    });

                    AlertDialog dialog = builder.Create();
                    dialog.Window.SetSoftInputMode(SoftInput.StateVisible);

                    dialog.Show();
                    break;
                }
            }
            catch (Exception e)
            {
                Toast.MakeText(this, "Error: " + e.Message, ToastLength.Long).Show();
            }

            return(false);
        }
Beispiel #10
0
        public Dialog Build(Activity activity, PromptConfig config)
        {
            var txt = new EditText(activity)
            {
                Id   = Int32.MaxValue,
                Hint = config.Placeholder
            };

            if (config.Text != null)
            {
                txt.Text = config.Text;
                txt.SetSelection(config.Text.Length);
            }

            if (config.MaxLength != null)
            {
                txt.SetFilters(new [] { new InputFilterLengthFilter(config.MaxLength.Value) });
            }

            SetInputType(txt, config.InputType);

            if (config.AutoCorrectionConfig != AutoCorrectionConfig.Default)
            {
                switch (config.AutoCorrectionConfig)
                {
                case AutoCorrectionConfig.No:
                    txt.InputType |= InputTypes.TextFlagNoSuggestions;     // Add Flag
                    break;

                case AutoCorrectionConfig.Yes:
                    txt.InputType &= ~InputTypes.TextFlagNoSuggestions;     // Remove Flag
                    break;

                default:
                    break;
                }
            }

            var builder = new AlertDialog.Builder(activity, config.AndroidStyleId ?? 0)
                          .SetCancelable(false)
                          .SetMessage(config.Message)
                          .SetTitle(config.Title)
                          .SetView(txt)
                          .SetPositiveButton(config.OkText, (s, a) =>
                                             config.OnAction(new PromptResult(true, txt.Text.Trim()))
                                             );

            if (config.IsCancellable)
            {
                builder.SetNegativeButton(config.CancelText, (s, a) =>
                                          config.OnAction(new PromptResult(false, txt.Text.Trim()))
                                          );
            }
            var dialog = builder.Create();

            this.HookTextChanged(dialog, txt, config);

            return(dialog);
        }
        private async void CheckAndGetLocation()
        {
            try
            {
                if (!LocationManager.IsProviderEnabled(LocationManager.GpsProvider))
                {
                    if (ShowAlertDialogGps)
                    {
                        ShowAlertDialogGps = false;

                        RunOnUiThread(() =>
                        {
                            try
                            {
                                // Call your Alert message
                                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                                alert.SetTitle(GetString(Resource.String.Lbl3_Use_Location) + "?");
                                alert.SetMessage(GetString(Resource.String.Lbl3_GPS_is_disabled) + "?");

                                alert.SetPositiveButton(GetString(Resource.String.Lbl_Ok), (senderAlert, args) =>
                                {
                                    //Open intent Gps
                                    new IntentController(this).OpenIntentGps(LocationManager);
                                });

                                alert.SetNegativeButton(GetString(Resource.String.Lbl_Cancel), (senderAlert, args) => { });

                                Dialog gpsDialog = alert.Create();
                                gpsDialog.Show();
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e);
                            }
                        });
                    }
                }
                else
                {
                    var locator = CrossGeolocator.Current;
                    locator.DesiredAccuracy = 50;
                    var position = await locator.GetPositionAsync(TimeSpan.FromMilliseconds(10000));

                    Console.WriteLine("Position Status: {0}", position.Timestamp);
                    Console.WriteLine("Position Latitude: {0}", position.Latitude);
                    Console.WriteLine("Position Longitude: {0}", position.Longitude);

                    UserDetails.Lat = position.Latitude.ToString(CultureInfo.InvariantCulture);
                    UserDetails.Lng = position.Longitude.ToString(CultureInfo.InvariantCulture);

                    var dd = locator.StopListeningAsync();
                    Console.WriteLine(dd);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #12
0
        public void ShowDialog(Context contxt, int id, DateTime sessionDate, bool isWorkshop)
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(contxt);
            builder.SetTitle("Set Notifications");
            builder.SetMultiChoiceItems(items.Select(x => x.title).ToArray(), items.Select(x => x.selected).ToArray(), new MultiClickListener());
            var clickListener = new ActionClickListener(contxt, id, sessionDate, isWorkshop);

            builder.SetPositiveButton("OK", clickListener);
            builder.SetNegativeButton("Cancel", clickListener);
            builder.Create().Show();
        }
 private void change_user()
 {
     AlertDialog.Builder builder = new AlertDialog.Builder(this);
     builder.SetTitle("Предупреждение");
     builder.SetMessage("Вы уверены, что хотите сменить учетную запись?");
     builder.SetCancelable(true);
     builder.SetNegativeButton("Нет", (s, ev) =>
     {
     });
     try
     {
         builder.SetPositiveButton("Да", (s, ev) =>
         {
             AccountsController.mainAccP = null;
             AccountsController.instance.CreateTable();
             //находить по id только текущего пользователя (тоже самое в EditProfile)
             var acc     = AccountsController.instance.deviceAccsP.Find(x => x.isMainP == true);
             acc.isMainP = false;
             AccountsController.instance.SaveItem(acc);
             FirebaseController.instance.initFireBaseAuth();
             FirebaseController.instance.LogOut();
             ContactsController.instance.CreateTable();
             foreach (var item in ContactsController.instance.GetItems())
             {
                 ContactsController.instance.DeleteItem(item.Id);
             }
             DialogsController.instance.CreateTable();
             foreach (var d in DialogsController.instance.GetItems().ToList())
             {
                 DialogsController.instance.DeleteItem(d.Id);
             }
             MessagesController.instance.CreateTable();
             foreach (var m in MessagesController.instance.GetItems().ToList())
             {
                 if (m.decodedP == null)
                 {
                     MessagesController.instance.DeleteItem(m.Id);
                 }
             }
             Finish();
             Intent intent = new Intent(this, typeof(SignUp));
             intent.SetFlags(ActivityFlags.ClearTask);
             StartActivity(intent);
         });
         Dialog dialog = builder.Create();
         dialog.Show();
         return;
     }
     catch (Exception ex)
     {
         Utils.MessageBox(ex.Message, this);
     }
 }
Beispiel #14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            //if launched from history, don't re-use the task. Proceed to FileSelect instead.
            if (Intent.Flags.HasFlag(ActivityFlags.LaunchedFromHistory))
            {
                Kp2aLog.Log("Forwarding to FileSelect. QueryCredentialsActivity started from history.");
                RestartApp();
                return;
            }

            string requestedUrl = Intent.GetStringExtra(ExtraQueryString);

            if (requestedUrl == null)
            {
                Toast.MakeText(this, "Cannot execute query for null.", ToastLength.Long).Show();
                RestartApp();
                return;
            }
            if (Intent.HasExtra(ExtraDisplayWarning))
            {
                AutofillServiceBase.DisplayWarning warning =
                    (AutofillServiceBase.DisplayWarning)Intent.GetIntExtra(ExtraDisplayWarning, (int)AutofillServiceBase.DisplayWarning.None);
                if (warning != AutofillServiceBase.DisplayWarning.None)
                {
                    AlertDialog.Builder builder = new AlertDialog.Builder(this);
                    builder.SetTitle(this.GetString(Resource.String.AutofillWarning_title));

                    builder.SetMessage(
                        GetString(Resource.String.AutofillWarning_Intro, new Java.Lang.Object[] { Intent.GetStringExtra(ExtraQueryDomainString), Intent.GetStringExtra(ExtraQueryPackageString) })
                        + " " +
                        this.GetString(Resource.String.AutofillWarning_FillDomainInUntrustedApp, new Java.Lang.Object[] { Intent.GetStringExtra(ExtraQueryDomainString), Intent.GetStringExtra(ExtraQueryPackageString) }));

                    builder.SetPositiveButton(this.GetString(Resource.String.Continue),
                                              (dlgSender, dlgEvt) =>
                    {
                        Proceed();
                    });

                    builder.SetNegativeButton(this.GetString(Resource.String.cancel), (dlgSender, dlgEvt) =>
                    {
                        Finish();
                    });

                    Dialog dialog = builder.Create();
                    dialog.Show();
                    return;
                }
            }
            Proceed();
        }
Beispiel #15
0
 //Delete All View <Reset>
 private void ImgDeleteAllOnClick(object sender, EventArgs e)
 {
     try
     {
         AlertDialog.Builder builder = new AlertDialog.Builder(this);
         builder.SetMessage(GetText(Resource.String.Lbl_Are_you_want_to_delete_all_changed));
         builder.SetPositiveButton(GetText(Resource.String.Lbl_Yes), delegate(object o, DialogClickEventArgs args) { MNiceArtEditor.SetFilterEffect(PhotoFilter.None); MNiceArtEditor.ClearAllViews(); MNiceArtEditorView.GetSource().ClearColorFilter(); });
         builder.SetNegativeButton(GetText(Resource.String.Lbl_No), delegate(object o, DialogClickEventArgs args) { });
         builder.Create().Show();
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
Beispiel #16
0
 private void ShowSaveDialog()
 {
     try
     {
         AlertDialog.Builder builder = new AlertDialog.Builder(this);
         builder.SetMessage(GetText(Resource.String.Lbl_Are_you_want_to_exit_without_saving_image));
         builder.SetPositiveButton(GetText(Resource.String.Lbl_Save), delegate(object sender, DialogClickEventArgs args) { SaveImage(); });
         builder.SetNegativeButton(GetText(Resource.String.Lbl_Cancel), delegate(object sender, DialogClickEventArgs args) { });
         builder.SetNeutralButton(GetText(Resource.String.Lbl_Discard), delegate(object sender, DialogClickEventArgs args) { var resultIntent = new Intent(); SetResult(Result.Canceled, resultIntent); Finish(); });
         builder.Create().Show();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
        private void ProfileAction(object sender, System.EventArgs e)
        {
            AlertDialog.Builder profileAlert = new AlertDialog.Builder(this);
            profileAlert.SetTitle("Profile");
            profileAlert.SetMessage("What would you like to do?");


            profileAlert.SetPositiveButton("Register", (senderAlert, arg) => RegisterClass.Alert(this));
            profileAlert.SetNeutralButton("Login", (sendingAlert, arg) => LoginClass.Alert(this));
            profileAlert.SetNegativeButton("Logout", async(sendingAlert, arg) => await LogoutClass.Logout(this));


            Dialog dialog = profileAlert.Create();

            dialog.Window.SetGravity(GravityFlags.Bottom);
            dialog.Show();
        }
        public new Dialog Build(Activity activity, PromptConfig config)
        {
            var txt = new EditText(activity)
            {
                Id   = Int32.MaxValue,
                Hint = config.Placeholder
            };

            if (config.Text != null)
            {
                txt.Text         = config.Text;
                txt.FocusChange += (o, e) => { if (e.HasFocus)
                                               {
                                                   txt.SelectAll();
                                               }
                };                                                                 // modify
            }

            if (config.MaxLength != null)
            {
                txt.SetFilters(new[] { new InputFilterLengthFilter(config.MaxLength.Value) });
            }

            SetInputType(txt, config.InputType);

            var builder = new AlertDialog.Builder(activity, config.AndroidStyleId ?? 0)
                          .SetCancelable(false)
                          .SetMessage(config.Message)
                          .SetTitle(config.Title)
                          .SetView(txt)
                          .SetPositiveButton(config.OkText, (s, a) =>
                                             config.OnAction(new PromptResult(true, txt.Text))
                                             );

            if (config.IsCancellable)
            {
                builder.SetNegativeButton(config.CancelText, (s, a) =>
                                          config.OnAction(new PromptResult(false, txt.Text))
                                          );
            }
            var dialog = builder.Create();

            this.HookTextChanged(dialog, txt, config);

            return(dialog);
        }
        public Dialog Build(Activity activity, ActionSheetConfig config)
        {
            var dialog = new AlertDialog.Builder(activity, config.AndroidStyleId ?? 0)
                         .SetTitle(config.Title);

            if (config.Cancel != null)
            {
                dialog.SetNeutralButton(config.Cancel.Text, (s, a) =>
                {
                    config.Cancel.Action?.Invoke();
                });
            }

            if (config.Destructive != null)
            {
                dialog.SetNegativeButton(config.Destructive.Text, (s, a) =>
                {
                    config.Destructive.Action?.Invoke();
                });
            }

            if (config.Items != null && config.Items.Count > 0)
            {
                if (config.Items.Any(t => t.ItemIcon != null))
                {
                    var array = config.Items.Select(t => t.Text).ToArray();

                    dialog.SetItems(array, (s, a) =>
                    {
                        config.Items[a.Which].Action?.Invoke();
                    });
                }
                else
                {
                    var adapter = new ActionSheetListAdapter(activity, global::Android.Resource.Layout.SelectDialogItem, global::Android.Resource.Id.Text1, config);

                    dialog.SetAdapter(adapter, (s, a) =>
                    {
                        config.Items[a.Which].Action?.Invoke();
                    });
                }
            }

            return(dialog.Create());
        }
        public Dialog Build(Activity activity, PromptConfigMultiInput config)
        {
            _activity = activity;

            LinearLayout container = new LinearLayout(activity);

            container.Id          = Int32.MaxValue - 1000;
            container.Orientation = Orientation.Vertical;
            foreach (PromptInput item in config.Inputs)
            {
                var editText = new EditText(activity)
                {
                    Id   = Int32.MaxValue,
                    Hint = item.Placeholder
                };

                SetInputType(editText, item.InputType);

                container.AddView(editText);
            }



            var builder = new AlertDialog.Builder(activity, config.AndroidStyleId ?? 0)
                          .SetCancelable(false)
                          .SetMessage(config.Message)
                          .SetTitle(config.Title)
                          .SetView(container)
                          .SetPositiveButton(config.OkText, (s, a) =>
                                             ExecutePromptResultMultiInput(config, container)
                                             );

            if (config.IsCancellable)
            {
                builder.SetNegativeButton(config.CancelText, (s, a) =>
                                          config.OnAction(new PromptResultMultiInput(false, config.Inputs))
                                          );
            }
            var dialog = builder.Create();

            //this.HookTextChanged(dialog, txt, config.OnTextChanged);

            return(dialog);
        }
Beispiel #21
0
        public void ShowInputDialog(string title, string message, string defaultInput, Android.Text.InputTypes inputTypes, Action <string> acceptAction)
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetTitle(title);
            builder.SetMessage(message);

            var inputText = new EditText(this);

            inputText.SetRawInputType(inputTypes);
            inputText.Text          = defaultInput;
            inputText.TextAlignment = TextAlignment.Center;
            builder.SetView(inputText);

            builder.SetPositiveButton("OK", delegate { acceptAction(inputText.Text); });
            builder.SetNegativeButton("Cancel", delegate { });
            Dialog dialog = builder.Create();

            dialog.Show();
        }
 public void ShowSaveDialog()
 {
     try
     {
         var builder = new AlertDialog.Builder(this);
         builder.SetMessage(GetText(Resource.String.Lbl_Are_you_want_to_exit_without_saving_image));
         builder.SetPositiveButton(GetText(Resource.String.Lbl_Save), delegate
         {
             SaveImage();
         });
         builder.SetNegativeButton(GetText(Resource.String.Lbl_Cancel), delegate { });
         builder.SetNeutralButton(GetText(Resource.String.Lbl_Discard), delegate { var resultIntent = new Intent(); SetResult(Result.Canceled, resultIntent); Finish(); });
         builder.Create().Show();
     }
     catch (Exception e)
     {
         Methods.DisplayReportResultTrack(e);
     }
 }
 private void delete_user()
 {
     AlertDialog.Builder builder = new AlertDialog.Builder(this);
     builder.SetTitle("Предупреждение");
     builder.SetMessage("Вы уверены, что хотите удалить учетную запись?");
     builder.SetCancelable(true);
     builder.SetNegativeButton("Нет", (s, ev) =>
     {
     });
     try
     {
         builder.SetPositiveButton("Да", (s, ev) =>
         {
             //pbar.Visibility = ViewStates.Visible;
             AccountsController.instance.CreateTable();
             AccountsController.instance.DeleteItem(AccountsController.mainAccP.Id);
             AccountsController.mainAccP = null;
             foreach (var item in ContactsController.instance.GetItems())
             {
                 ContactsController.instance.DeleteItem(item.Id);
             }
             DialogsController.instance.CreateTable();
             foreach (var d in DialogsController.instance.GetItems().ToList())
             {
                 DialogsController.instance.DeleteItem(d.Id);
             }
             MessagesController.instance.CreateTable();
             foreach (var m in MessagesController.instance.GetItems().ToList())
             {
                 MessagesController.instance.DeleteItem(m.Id);
             }
             FirebaseController.instance.initFireBaseAuth();
             FirebaseController.instance.DeleteUser(this);
         });
         Dialog dialog = builder.Create();
         dialog.Show();
         return;
     }
     catch (Exception ex)
     {
         Utils.MessageBox(ex.Message, this);
     }
 }
Beispiel #24
0
        private async void Upload_btn_Click(object sender, System.EventArgs e)
        {
            var result = await FilePicker.PickAsync(new PickOptions
            {
                PickerTitle = "Select a .csv file"
            });

            if (result != null)
            {
                if (SQLiteHelper.CheckTableExistance(result.FileName))
                {
                    AlertDialog.Builder alert = new AlertDialog.Builder(this);

                    alert.SetTitle("Survey already exists");
                    alert.SetMessage("This survey has been uploaded before.\nDo you want to continue?\nNote: This will not overwrite the existing file.");
                    alert.SetPositiveButton("Yes", async(senderAlert, args) =>
                    {
                        // Read contents of CSV file into byte stream
                        var stream = await result.OpenReadAsync();
                        // creates a new database table for the survey but the
                        SurveyHelper.LoadSurveyFromCSV(result.FileName, stream, out string message);

                        textview_status.Text = message;
                    });
                    alert.SetNegativeButton("No", (senderAlert, args) =>
                    {
                        return;
                    });

                    Dialog dialog = alert.Create();
                    dialog.Show();
                }
                else
                {
                    // Read contents of CSV file into byte stream
                    var stream = await result.OpenReadAsync();

                    SurveyHelper.LoadSurveyFromCSV(result.FileName, stream, out string message);

                    textview_status.Text = message;
                }
            }
        }
        private async void BtnLogin_Click(object sender, System.EventArgs e)
        {
            EditText edtUser = FindViewById <EditText>(Resource.Id.edtUser);
            EditText edtPass = FindViewById <EditText>(Resource.Id.edtPass);

            if (!string.IsNullOrEmpty(edtUser.Text.ToString()) && !string.IsNullOrEmpty(edtPass.Text.ToString()))
            {
                VerificarUser();
            }
            else if (string.IsNullOrEmpty(edtUser.Text.ToString()) || string.IsNullOrEmpty(edtPass.Text.ToString()))
            {
                AlertDialog.Builder alertDiag = new AlertDialog.Builder(this);
                alertDiag.SetTitle("ERROR");
                alertDiag.SetMessage("Los Campos de USER y PASSWORD no pueden estas vacios");
                alertDiag.SetNegativeButton("OK", (senderAlert, args) => {
                });
                Dialog diag = alertDiag.Create();
                diag.Show();
            }
        }
Beispiel #26
0
        private void LoginCancel_Click(object sender, EventArgs e)
        {
            var builder = new AlertDialog.Builder(Activity);

            builder.SetTitle("Are you sure?");
            builder.SetMessage("Are you sure you want to exit?");
            builder.SetPositiveButton("Yes", (s, e) =>
            {
                Activity.Finish();
            });
            builder.SetNegativeButton("No", (s, e) =>
            {
                builder.Dispose();
                return;
            });

            var dialog = builder.Create();

            dialog.Show();
        }
        private void Cancel_Click(object sender, EventArgs e)
        {
            var builder = new AlertDialog.Builder(Activity);

            builder.SetTitle("Are you sure?");
            builder.SetMessage("Cancel adding this Contact?");
            builder.SetPositiveButton("Yes", (s, e) =>
            {
                Dismiss();
            });
            builder.SetNegativeButton("No", (s, e) =>
            {
                builder.Dispose();
                return;
            });

            var dialog = builder.Create();

            dialog.Show();
        }
Beispiel #28
0
        public Task <string> DisplayConfirmationNotice(string reason)
        {
            var tcs = new TaskCompletionSource <string>();

            AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.SetTitle("Open Phone Dialer");
            alert.SetMessage("You are trying to call the " + reason + ".\nIf this is correct, press Call.\nIf not, press Cancel.");
            alert.SetPositiveButton("Call", (senderAlert, args) =>
            {
                tcs.SetResult("OK");
            });
            alert.SetNegativeButton("Cancel", (senderAlert, args) =>
            {
                tcs.SetResult("Cancel");
            });
            Dialog dialog = alert.Create();

            dialog.Show();

            return(tcs.Task);
        }
Beispiel #29
0
        public static AlertDialog.Builder Build(Activity activity, ActionSheetConfig config)
        {
            var dlg = new AlertDialog
                      .Builder(activity)
                      .SetCancelable(false)
                      .SetTitle(config.Title);

            //.SetCustomTitle(new TextView(activity) {
            //    Text = config.Title,
            //    TextSize = 18.0f
            //});

            if (config.ItemIcon != null || config.Options.Any(x => x.ItemIcon != null))
            {
                var adapter = new ActionSheetListAdapter(activity, Android.Resource.Layout.SelectDialogItem,
                                                         Android.Resource.Id.Text1, config);
                dlg.SetAdapter(adapter, (s, a) => config.Options[a.Which].Action?.Invoke());
            }
            else
            {
                var array = config
                            .Options
                            .Select(x => x.Text)
                            .ToArray();

                dlg.SetItems(array, (s, args) => config.Options[args.Which].Action?.Invoke());
            }

            if (config.Destructive != null)
            {
                dlg.SetNegativeButton(config.Destructive.Text, (s, a) => config.Destructive.Action?.Invoke());
            }

            if (config.Cancel != null)
            {
                dlg.SetNeutralButton(config.Cancel.Text, (s, a) => config.Cancel.Action?.Invoke());
            }

            return(dlg);
        }
        public override void ActionSheet(ActionSheetConfig config)
        {
            var array = config
                .Options
                .Select(x => x.Text)
                .ToArray();

            var dlg = new AlertDialog
                .Builder(this.GetTopActivity())
                .SetCancelable(false)
                .SetTitle(config.Title);

            dlg.SetItems(array, (s, args) => config.Options[args.Which].Action?.Invoke());

            if (config.Destructive != null)
                dlg.SetNegativeButton(config.Destructive.Text, (s, a) => config.Destructive.Action?.Invoke());

            if (config.Cancel != null)
                dlg.SetNeutralButton(config.Cancel.Text, (s, a) => config.Cancel.Action?.Invoke());

            Utils.RequestMainThread(() => dlg.ShowExt());
        }
        public void displayAlertDialog(String title, String message)
        {
            AlertDialog.Builder alert = new AlertDialog.Builder(this);


            alert.SetTitle(title);
            alert.SetMessage(message);


            alert.SetPositiveButton("Yes", (senderAlert, args) =>
            {
                System.Console.WriteLine("Yes Button Clicked");
            });

            alert.SetNegativeButton("NO", (senderAlert, args) =>
            {
                System.Console.WriteLine("NO Button Clicked");
            });

            Dialog dialog = alert.Create();

            dialog.Show();
        }
        public override void Prompt(PromptConfig config)
        {
            Utils.RequestMainThread(() => {
                var activity = this.GetTopActivity();

                var txt = new EditText(activity) {
                    Hint = config.Placeholder
                };
                if (config.Text != null)
                    txt.Text = config.Text;

                this.SetInputType(txt, config.InputType);

                var builder = new AlertDialog
                    .Builder(activity)
                    .SetCancelable(false)
                    .SetMessage(config.Message)
                    .SetTitle(config.Title)
                    .SetView(txt)
                    .SetPositiveButton(config.OkText, (s, a) =>
                        config.OnResult(new PromptResult {
                            Ok = true,
                            Text = txt.Text
                        })
                    );

                if (config.IsCancellable) {
                    builder.SetNegativeButton(config.CancelText, (s, a) =>
                        config.OnResult(new PromptResult {
                            Ok = false,
                            Text = txt.Text
                        })
                    );
                }

                builder.Show();
            });
        }
Beispiel #33
0
 public void ShowDialog(Context contxt, int id, DateTime sessionDate, bool isWorkshop)
 {
     AlertDialog.Builder builder = new AlertDialog.Builder(contxt);
     builder.SetTitle("Set Notifications");
     builder.SetMultiChoiceItems(items.Select(x => x.title).ToArray(), items.Select(x => x.selected).ToArray(), new MultiClickListener());
     var clickListener = new ActionClickListener(contxt, id, sessionDate, isWorkshop);
     builder.SetPositiveButton("OK", clickListener);
     builder.SetNegativeButton("Cancel", clickListener);
     builder.Create().Show();
 }