Example #1
0
        private void ShowPauseDialog()
        {
            View dialogView = LayoutInflater.Inflate(Resource.Layout.spinner_dialog, null);

            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetView(dialogView);
            builder.SetCancelable(false);
            builder.SetTitle(INFECTION_STATUS_PAUSE_DIALOG_TITLE);
            builder.SetMessage(INFECTION_STATUS_PAUSE_DIALOG_MESSAGE);
            _picker          = dialogView.FindViewById(Resource.Id.picker) as NumberPicker;
            _picker.MinValue = 0;
            _picker.MaxValue = 4;
            _picker.DescendantFocusability = DescendantFocusability.BlockDescendants;
            _picker.SetDisplayedValues(
                new[]
            {
                INFECTION_STATUS_PAUSE_DIALOG_OPTION_NO_REMINDER,
                INFECTION_STATUS_PAUSE_DIALOG_OPTION_ONE_HOUR,
                INFECTION_STATUS_PAUSE_DIALOG_OPTION_TWO_HOURS,
                INFECTION_STATUS_PAUSE_DIALOG_OPTION_FOUR_HOURS,
                INFECTION_STATUS_PAUSE_DIALOG_OPTION_EIGHT_HOURS,
            });

            builder.SetPositiveButton(INFECTION_STATUS_PAUSE_DIALOG_OK_BUTTON, (sender, args) =>
            {
                switch (_picker.Value)
                {
                case 1:
                case 2:
                case 3:
                case 4:
                    StartReminderService((int)Math.Pow(2, _picker.Value - 1));
                    break;
                }
                StopGoogleAPI();
                (sender as AlertDialog)?.Dismiss();
            });

            if (Android.OS.Build.VERSION.SdkInt > Android.OS.BuildVersionCodes.M)
            {
                AlertDialog alertDialog = builder.Create();
                alertDialog.Window.DecorView.LayoutDirection = LayoutUtils.GetLayoutDirection();
                alertDialog.Show();
            }
            else
            {
                builder.Create();
                builder.Show();
            }
        }
Example #2
0
        void wonAlert(string winner)
        {
            string title = "Oops!";

            if (winner == "O")
            {
                title  = "Congratulations!";
                winner = "Circle";
            }
            else if (winner == "X")
            {
                title  = "Congratulations!";
                winner = "Cross";
            }

            foreach (var button in buttons)
            {
                button.Clickable = false;
            }

            string message = winner + " is winner";

            //Toast.MakeText(this, winner + " won!", ToastLength.Long).Show();

            AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.SetTitle(title);
            alert.SetMessage(message);
            alert.SetPositiveButton("Ok", (senderAlert, args) => {
                Toast.MakeText(this, "Start new game", ToastLength.Short).Show();
            });

            Dialog dialog = alert.Create();

            dialog.Show();
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.category_dialog, null);

            Dialog.SetTitle("Выберите категории");
            var mainLayout = view.FindViewById <LinearLayout>(Resource.Id.category_dialog_main);

            _checkBoxList = new List <CheckBox>();

            for (var index = 0; index < ServicesCategory.ServicesCategoryList.Count; index++)
            {
                var check    = ServicesCategory.ServicesCategoryList[index];
                var checkbox = new CheckBox(Context)
                {
                    Text             = check,
                    Checked          = _firstMasterViewModel.SelectedCategories.Exists(s => s.ToLower().Equals(check.ToLower())),
                    LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                     ViewGroup.LayoutParams.WrapContent)
                };
                _checkBoxList.Add(checkbox);
                mainLayout.AddView(checkbox);
            }

            _closeButton        = view.FindViewById <Button>(Resource.Id.category_dialog_closeButton);
            _closeButton.Click += CloseButtonOnClick;

            var builder = new AlertDialog.Builder(Activity);

            builder.SetView(view);

            _createdDialog = builder.Create();
            return(view); // base.OnCreateView(inflater, container, savedInstanceState);
        }
Example #4
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();
            });
        }
Example #5
0
        private void Btnavis(object sender, EventArgs e)
        {
            string aviso = "Con fundamento en la Ley Federal de Protección de Datos Personales en Posesión de Particulares hacemos de su conocimiento" +
                           " que GO FOR LIFE MÉXICO / JULIO CESAR MAGALLANES DEL ANGEL con domicilio Calle 3 Manzana 4 Lote 5, Col. Jorge Jiménez Cantú, Estado" +
                           " de México, C.P. 56589, es responsable de recabar sus datos personales, del uso que se le dé a los mismos y de su protección. " +
                           "Sus datos personales incluso los sensibles, patrimoniales o financieros que usted proporcione en el Contrato del Servicio o en " +
                           "cualquier otro documento o medio físico o electrónico, serán utilizados únicamente con motivo de la operación que nos relaciona y " +
                           "se tratarán para todos los fines vinculados con dicha relación, tales como: proveer los servicios que ha solicitado; notificarle" +
                           " sobre nuevos servicios o productos que tengan relación con los ya contratados o adquiridos; comunicarle sobre cambios en los mismos;" +
                           " realizar evaluaciones periódicas de nuestros servicios a efecto de mejorar la calidad de los mismos; evaluar la calidad del servicio" +
                           " que brindamos, y en general, para dar cumplimiento a las obligaciones que hemos contraído con usted. Es importante informarle que " +
                           "usted tiene derecho al Acceso, Rectificación y Cancelación de sus datos personales, a Oponerse al tratamiento de los mismos o a " +
                           "revocar el consentimiento que para dicho fin nos haya otorgado.Para ello, es necesario que envíe la solicitud, en los términos que " +
                           "marca la Ley en su Art. 29, a nuestra Área Administrativa, ubicada en las instalaciones de la Empresa: Paseo de los Volcanes Manzana" +
                           " 66 Lote 474, Col.San Buenaventura, Ixtapaluca, Estado de México, C.P. 56536, o bien, vía correo electrónico a [email protected], el " +
                           "cual solicitamos confirme vía telefónica para garantizar su correcta recepción; El responsable dará respuesta de acuerdo a lo " +
                           "establecido en el Art. 32 aplicándose las restricciones establecidas en el Art. 34. Por otra parte, hacemos de su conocimiento que " +
                           "sus datos seguirán siendo utilizados mientras usted decida seguir con el servicio contratado; con el objetivo general de cumplir con" +
                           " las finalidades para las cuales ha proporcionado sus datos, y de acuerdo a lo establecido en el Art.37.En caso de que no obtengamos" +
                           " su oposición expresa para que sus datos personales sean transferidos en la forma y términos antes descrita, entenderemos que ha " +
                           "otorgado su consentimiento en forma tácita para ello. En caso de que no esté en de acuerdo con el presente aviso de privacidad y de" +
                           " que no desee recibir mensajes de nuestra parte, puede enviarnos su solicitud por medio de la dirección electrónica: info @gflmex.com. " +
                           "El presente aviso así como sus modificaciones estarán a su disposición en la página de internet http://www.goforlifemexico.com";

            AlertDialog.Builder av = new AlertDialog.Builder(this);
            av.SetMessage(aviso);
            av.SetTitle("AVISO DE PRIVACIDAD ");
            av.SetPositiveButton("Aceptar", PositiveButton);

            AlertDialog dialog = av.Create();

            dialog.Show();
        }
Example #6
0
        private void LoginBtn_Click(object sender, EventArgs e)
        {
            string sTitulo = string.Empty;
            string sCuerpo = string.Empty;

            var bValidado = ValidarLogin();

            if (bValidado)
            {
                sTitulo = "Ingreso exitoso";
                sCuerpo = "Bienvenido nuevamente";
            }
            else
            {
                sTitulo = "Error en el ingreso";
                sCuerpo = "Verifique su contraseña";
            }
            AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.SetTitle(sTitulo);
            alert.SetMessage(sCuerpo);

            Dialog dialog = alert.Create();

            dialog.Show();

            if (bValidado)
            {
                Intent i = new Intent(this, typeof(MainActivity));
                i.PutExtra("Usuario", usuariosSpn.SelectedItem.ToString());
                StartActivity(i);
            }
        }
        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);
        }
Example #8
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            var id = item.ItemId;

            if (id == Resource.Id.action_about)
            {
                var alert = new AlertDialog.Builder(this);
                alert.SetTitle("关于");
                alert.SetMessage("七天网络第三方查分 App.");
                alert.SetPositiveButton("确定", (senderAlert, args) => { });

                alert.SetNeutralButton("Github",
                                       (senderAlert, args) => { Toast.MakeText(this, "已开源在 Github!", ToastLength.Short).Show(); });


                Dialog dialog = alert.Create();
                dialog.Show();
                return(true);
            }

            if (id == Resource.Id.action_logout)
            {
                GetSharedPreferences("config", FileCreationMode.Private)
                .Edit().PutString("token", "").Apply();
                ShowLoginDialog();
            }

            return(base.OnOptionsItemSelected(item));
        }
Example #9
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            // Si selecciona icon exit
            if (item.ItemId == Resource.Id.exit)
            {
                AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                AlertDialog         alert  = dialog.Create();
                alert.SetTitle("Salir");
                alert.SetMessage("¿Estás seguro?");
                alert.SetIcon(Resource.Drawable.logo);
                alert.SetButton("Si", (c, ev) =>
                {
                    this.FinishAffinity();
                    Finish();
                    Android.OS.Process.KillProcess(Android.OS.Process.MyPid());

                    GC.Collect();
                });

                alert.SetButton2("no", (c, ev) => { });
                alert.Show();
            }

            return(base.OnOptionsItemSelected(item));
        }
Example #10
0
        /**
         * Dialog menu displaying the virtual objects we can place in the real world.
         */
        public void showPopup()
        {
            var builder   = new AlertDialog.Builder(this);
            var itemsList = new[] { "Coffee mug", "Flowers", "Smile Emoji" };

            builder.SetTitle("Choose an object")
            .SetItems(itemsList,
                      (s, e) =>
            {
                switch (e.Which)
                {
                case 0:
                    placeObject("file:///android_asset/object_coffee_mug.vrx");
                    break;

                case 1:
                    placeObject("file:///android_asset/object_flowers.vrx");
                    break;

                case 2:
                    placeObject("file:///android_asset/emoji_smile.vrx");
                    break;
                }
            });
            Dialog d = builder.Create();

            d.Show();
        }
Example #11
0
 public void OnComplete(Task task)
 {
     if (task.IsSuccessful == false)
     {
         Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
         AlertDialog alert = dialog.Create();
         alert.SetTitle("Failed");
         alert.SetMessage("Request failed, something went wrong");
         alert.SetButton("OK", (c, ev) =>
         {
             // Ok button click task
         });
         alert.SetButton2("CANCEL", (c, ev) => { });
         alert.Show();
     }
     else
     {
         Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
         AlertDialog alert = dialog.Create();
         alert.SetTitle("Success");
         alert.SetMessage("Request success, please check your email");
         alert.SetButton("OK", (c, ev) =>
         {
             // Ok button click task
         });
         alert.Show();
     }
 }
        private void CreateLayout()
        {
            // Create the layout.
            LinearLayout layout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical
            };

            // Add the generate button.
            _takeMapOfflineButton = new Button(this)
            {
                Text = "Take map offline"
            };
            _takeMapOfflineButton.Click += TakeMapOfflineButton_Click;
            layout.AddView(_takeMapOfflineButton);

            // Add the mapview.
            _mapView = new MapView(this);
            layout.AddView(_mapView);

            // Add the layout to the view.
            SetContentView(layout);

            // Create the progress dialog display.
            _progressIndicator = new ProgressBar(this);
            _progressIndicator.SetProgress(40, true);
            AlertDialog.Builder builder = new AlertDialog.Builder(this).SetView(_progressIndicator);
            builder.SetCancelable(true);
            builder.SetMessage("Generating offline map ...");
            _alertDialog = builder.Create();
            _alertDialog.SetButton("Cancel", (s, e) => { _generateOfflineMapJob.Cancel(); });
        }
Example #13
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();
        }
Example #14
0
        private void Propinabtn_Click(object sender, EventArgs e)
        {
            LayoutInflater layoutInflater = LayoutInflater.From(this);
            View           view           = layoutInflater.Inflate(Resource.Layout.propinapopup, null);

            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetView(view);
            builder.SetTitle("¿Caunto deseas agregar de propina?");
            var propinaa = view.FindViewById <EditText>(Resource.Id.lineapropina);

            builder.SetCancelable(false)
            .SetPositiveButton("Donar", (c, ev) =>
            {
                string lo            = propinaa.Text;
                propina.Text         = "$" + lo + ".00";
                propinaagregada.Text = "$" + lo + ".00";
                float gamesa         = float.Parse(lo);
                AddData(gamesa);
            })
            .SetNegativeButton("Cancelar", (c, ev) =>
            {
                propina.Text         = "$0.00";
                propinaagregada.Text = "$0.00";
            });
            AlertDialog lala = builder.Create();

            lala.Show();
        }
Example #15
0
        private void OnSelectButtonClick(string playlistId)
        {
            if (_state.Value != State.Waiting && _state.Value != State.Failed)
            {
                return;
            }

            AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this, Resource.Style.DialogTheme);
            LayoutInflater      inflater      = (LayoutInflater)GetSystemService(LayoutInflaterService);
            View popupView = inflater.Inflate(Resource.Layout.popup, null);

            dialogBuilder.SetView(popupView);
            AlertDialog dialog = dialogBuilder.Create();

            dialog.Show();

            popupView.FindViewById <Button>(Resource.Id.shuffle_button).Click += (sender, e) =>
            {
                dialog.Dismiss();
                OnShuffleButtonClick(playlistId, ShuffleMode.Shuffle, popupView);
            };
            popupView.FindViewById <Button>(Resource.Id.restrict_button).Click += (sender, e) =>
            {
                dialog.Dismiss();
                OnShuffleButtonClick(playlistId, ShuffleMode.Restrict, popupView);
            };
            popupView.FindViewById <EditText>(Resource.Id.restrict_value).Text =
                GetSharedPreferences("SPOTIFY", 0).GetString("RESTRICT_VALUE", "10");
        }
        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();
        }
Example #17
0
        public void ReceiveDetections(Detections detections)
        {
            SparseArray qrcodes = detections.DetectedItems;

            if (qrcodes.Size() != 0)
            {
                _txtResult.Post(() => {
                    _txtResult.Text            = ((Barcode)qrcodes.ValueAt(0)).RawValue;
                    AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                    AlertDialog alert          = dialog.Create();
                    alert.SetTitle("Código de Barras");
                    alert.SetMessage(((Barcode)qrcodes.ValueAt(0)).RawValue);
                    alert.SetIcon(Resource.Drawable.logo);
                    alert.SetButton("Volver", (c, ev) =>
                    {
                        // Para actualizar una actividad desde dentro de sí mismo
                        Finish(); StartActivity(Intent);

                        GC.Collect();
                    });

                    alert.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));
        }
Example #19
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);
        }
Example #20
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);
        }
        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);
            }
        }
Example #22
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();
        }
Example #23
0
        public void showInternetConnectionError()
        {
            AlertDialog.Builder alert = mDialog.CreateErrorDialog("Connection error", "Unable to connect with the server.\nCheck your internet connection.",
                                                                  "TRAY AGAIN");
            alert.SetPositiveButton("TRAY AGAIN", (senderAlert, args) => {
                StartActivityForResult(new Intent(Settings.ActionWifiSettings), 0);
            });
            Dialog dialog = alert.Create();

            dialog.Show();
        }
        private void ShowError(Exception error)
        {
            var builder = new AlertDialog.Builder(this);

            builder.SetTitle(GetString(Resource.String.error_title));
            builder.SetMessage(error.Message);
            builder.SetPositiveButton("OK", (sender, args) => (sender as Dialog)?.Dismiss());
            var dialog = builder.Create();

            dialog.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);
     }
 }
Example #26
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetTitle("顏色");
            View view = LayoutInflater.From(this).Inflate(Resource.Layout.color, null);

            builder.SetView(view);
            adColor = builder.Create();

            bColor        = FindViewById <Button>(Resource.Id.b_color);
            etText        = FindViewById <EditText>(Resource.Id.et_text);
            fontMetrics   = paint.GetFontMetrics();
            ivCanvas      = FindViewById <ImageView>(Resource.Id.iv_canvas);
            llPaint       = FindViewById <LinearLayout>(Resource.Id.ll_paint);
            rbEraser      = FindViewById <RadioButton>(Resource.Id.rb_eraser);
            rbFill        = FindViewById <RadioButton>(Resource.Id.rb_fill);
            rbHandwriting = FindViewById <RadioButton>(Resource.Id.rb_handwriting);
            rbPencil      = FindViewById <RadioButton>(Resource.Id.rb_pencil);
            rbText        = FindViewById <RadioButton>(Resource.Id.rb_text);
            sbAlpha       = view.FindViewById <SeekBar>(Resource.Id.sb_alpha);
            sbBlue        = view.FindViewById <SeekBar>(Resource.Id.sb_blue);
            sbGreen       = view.FindViewById <SeekBar>(Resource.Id.sb_green);
            sbRed         = view.FindViewById <SeekBar>(Resource.Id.sb_red);
            sbSize        = FindViewById <SeekBar>(Resource.Id.sb_size);
            sbWidth       = FindViewById <SeekBar>(Resource.Id.sb_width);

            adColor.DismissEvent += AdColor_DismissEvent;
            FindViewById <Button>(Resource.Id.b_clear).Click += BClear_Click;
            bColor.Click += BSolidColor_Click;
            FindViewById <Button>(Resource.Id.b_red).Click     += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_green).Click   += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_blue).Click    += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_yellow).Click  += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_cyan).Click    += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_magenta).Click += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_black).Click   += BMaterialDesignColor_Click;
            FindViewById <Button>(Resource.Id.b_white).Click   += BMaterialDesignColor_Click;
            ivCanvas.Touch += IvCanvas_Touch;
            FindViewById <RadioGroup>(Resource.Id.rg_tool).CheckedChange += RgTool_CheckedChange;
            sbAlpha.ProgressChanged += SbColor_ProgressChanged;
            sbBlue.ProgressChanged  += SbColor_ProgressChanged;
            sbGreen.ProgressChanged += SbColor_ProgressChanged;
            sbRed.ProgressChanged   += SbColor_ProgressChanged;
            sbSize.ProgressChanged  += SbSize_ProgressChanged;
            sbWidth.ProgressChanged += SbWidth_ProgressChanged;

            Handwriting.blackBrush = BitmapFactory.DecodeResource(Resources, Resource.Mipmap.brush);
            Handwriting.brush      = Handwriting.blackBrush.Copy(Bitmap.Config.Argb8888, true);
        }
Example #27
0
        protected override void OnRestart()
        {
            base.OnRestart();
            SetContentView(Resource.Layout.activity_main);

            SQLiteDatabase db2 = new SQLiteDatabase();

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;

            Button btn = FindViewById <Button>(Resource.Id.btn_Add);

            btn.Click += btnOnClick;

            ListView listView = FindViewById <ListView>(Resource.Id.listView);

            db2.CopyDatabase(); //kopiuje baze na telefon z apki

            List <Gas>    gass = null;
            List <string> abc  = null;

            try
            {
                using (var conn = db2.SQLiteConnection)
                {
                    gass = conn.Table <Gas>().ToList();
                    abc  = gass.ConvertAll(x => x.ToString());
                }

                ArrayAdapter <string> arrayAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, abc);
                listView.Adapter = arrayAdapter;
            }
            catch (Exception ex)
            {
                var         dialog = new AlertDialog.Builder(this);
                AlertDialog alert  = dialog.Create();
                alert.SetTitle("Exception");
                alert.SetMessage(ex.ToString());
                alert.SetButton("OK", (c, ev) =>
                {
                    // Ok button click task
                });
                alert.Show();
            }

            Button btnNewPage = FindViewById <Button>(Resource.Id.btn_NewPage);

            btnNewPage.Click += btnNewPageClick;
        }
Example #28
0
        private async void LoginOK_Click(object sender, EventArgs e)
        {
            var passwordBytes = Sodium.GenericHash.Hash(userPassword.Text, deviceId, 32);
            var keyPair       = Sodium.PublicKeyBox.GenerateKeyPair(passwordBytes);

            if (string.IsNullOrWhiteSpace(publicKey))
            {
                // No Public Key Present - Store
                await encryptionService.SetPublicKey(Convert.ToBase64String(keyPair.PublicKey));

                await encryptionService.SetPassword(userPassword.Text);

                Toast.MakeText(Activity, "Encryption Keys Generated", ToastLength.Long).Show();
                NavigateToWelcome();
            }
            else
            {
                // Public Key Present - Generate and Check
                var generatedPublicKeyBase64 = Convert.ToBase64String(keyPair.PublicKey);

                if (publicKey.Equals(generatedPublicKeyBase64))
                {
                    await encryptionService.SetPassword(userPassword.Text);

                    Toast.MakeText(Activity, "Login Successful", ToastLength.Long).Show();

                    if (string.IsNullOrEmpty(incomingSMSContent))
                    {
                        NavigateToWelcome();
                    }
                    else
                    {
                        var readerFragment = new ReaderFragment(incomingSMSContent);
                        NavigateToReader(readerFragment);
                    }
                }
                else
                {
                    // TODO: Display Failure Alert
                    var builder = new AlertDialog.Builder(Activity);
                    builder.SetTitle("Login Failure");
                    builder.SetMessage("Incorrect password/passphrase - please try again.");
                    builder.SetPositiveButton("OK", (s, e) =>
                    {
                        builder.Dispose();
                    });

                    var dialog = builder.Create();
                    dialog.Show();
                }
            }
        }
Example #29
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();
        }
Example #30
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            DroidGameApp.CurrentContext = this;

            var bootstrapper = new DroidAppBootstrapper();

            bootstrapper.SetupApplication();

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.LoginActivityLayout);

            _viewModel = Resolver.Resolve <ILoginViewModel>();

            var editText = FindViewById <EditText>(Resource.Id.editTextUsername);

            editText.Text         = _viewModel.Username;
            editText.TextChanged += (sender, args) =>
            {
                _viewModel.Username = ((EditText)sender).Text;
            };

            editText              = FindViewById <EditText>(Resource.Id.editTextPassword);
            editText.Text         = _viewModel.Password;
            editText.TextChanged += (sender, args) =>
            {
                _viewModel.Password = ((EditText)sender).Text;
            };

            var loginButton = FindViewById <Button>(Resource.Id.buttonLogin);

            loginButton.Click += (sender, args) =>
            {
                _viewModel.LoginCommand.Execute(null);
            };

            _viewModel.PropertyChanged += (sender, args) =>
            {
                loginButton.Enabled = _viewModel.CanLogin;
                if (args.PropertyName.Equals(nameof(_viewModel.ErrorMessage)))
                {
                    var alert = new AlertDialog.Builder(this);
                    alert.SetTitle("Error");
                    alert.SetMessage("Could not login.");
                    alert.SetPositiveButton("OK", (senderAlert, arg) => {
                    });
                    Dialog dialog = alert.Create();
                    dialog.Show();
                }
            };
        }
 private Dialog createDialog(int titleId, int messageId)
 {
     AlertDialog.Builder builder = new AlertDialog.Builder(this);
     builder.SetTitle(titleId)
         .SetIcon(Resource.Drawable.Icon)
         .SetMessage(messageId);
         //.SetPositiveButton(Resource.String.ok, null);
     return builder.Create();
 }
Example #32
0
 public void ShowFontSize(Context cntext)
 {
     AlertDialog.Builder builder = new AlertDialog.Builder(cntext);
     builder.SetTitle("Change Font Size");
     builder.Create().Show();
 }
Example #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();
 }