Beispiel #1
0
        private async Task DescifrarArchivos(byte[] keyMaterial, bool eliminarArchivos)
        {
            foreach (var archivo in adaptador.archivos)
            {
                string rutaDestino = Path.Combine(Path.GetDirectoryName(archivo.Nombre), Path.GetFileNameWithoutExtension(archivo.Nombre));

                AlertDialog.Builder mensajeInformacion = new AlertDialog.Builder(this);
                mensajeInformacion.SetTitle("Error al descifrar");
                try
                {
                    await Crypto.CifradoDescifradoAsincrono(keyMaterial, archivo.Nombre, rutaDestino, false);

                    if (eliminarArchivos)
                    {
                        File.Delete(archivo.Nombre);
                    }
                }
                catch (System.Security.Cryptography.CryptographicException)
                {
                    mensajeInformacion.SetMessage("Esto puede deberse a una de las siguientes razones:\n1-El archivo está dañado\n2-El archivo no fue cifrado con Encrypto");
                    mensajeInformacion.Show();
                    File.Delete(rutaDestino);
                }
                catch (FileNotFoundException)
                {
                    mensajeInformacion.SetMessage("El archivo " + Path.GetFileName(archivo.Nombre) + " no pudo ser encontrado");
                    mensajeInformacion.Show();
                    File.Delete(rutaDestino);
                }
                catch (DirectoryNotFoundException)
                {
                    mensajeInformacion.SetMessage("El directorio destino '" + Path.GetDirectoryName(archivo.Nombre) + "' no pudo ser encontrado");
                    mensajeInformacion.Show();
                    File.Delete(rutaDestino);
                }
                catch (Javax.Crypto.IllegalBlockSizeException)
                {
                    mensajeInformacion.SetMessage("El archivo " + Path.GetFileName(archivo.Nombre) + " no pudo ser cifrado. La contraseña es incorrecta");
                    mensajeInformacion.Show();
                    File.Delete(rutaDestino);
                }
                catch (Exception)
                {
                    mensajeInformacion.SetMessage("Error desconocido");
                    mensajeInformacion.Show();
                    File.Delete(rutaDestino);
                }
            }
        }
Beispiel #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.search_layout);

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

            try
            {
                var ingridients = Intent.GetStringArrayListExtra("Ingridients");
                StartSearch(GetSearchUrl(ingridients));
            }
            catch (Exception)
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Connetction Error");
                alert.SetMessage("Check your conection");
                alert.SetPositiveButton("OK", HandlePositiveButtonClick);
                alert.SetCancelable(false);
                alert.Show();
            }
        }
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
        private void BtnLogin_Click(object sender, EventArgs e)//login normal
        {
            try
            {
                string correo = correoLogin.Text;
                string pass   = passLogin.Text;
                int    aux    = 0;
                aux = bd.LoginNormal(correo, pass).Idusuario;

                if (aux != 0)
                {
                    Intent i = new Intent(this, typeof(MainActivity));
                    i.PutExtra("idUs", Convert.ToString(aux));
                    StartActivity(i);
                }
                else
                {
                    AlertDialog alerta = new AlertDialog.Builder(this).Create();
                    alerta.SetTitle("Error ");
                    alerta.SetMessage("El usuario o la contraseña son incorrectos. Compruebe su conexion a internet");
                    alerta.SetButton("Aceptar", (a, b) => { });
                    alerta.Show();
                }
            }
            catch (Exception ex)
            {
                AlertDialog alerta = new AlertDialog.Builder(this).Create();
                alerta.SetTitle("Error ");
                alerta.SetMessage(ex.Message);
                alerta.SetButton("Aceptar", (a, b) => { });
                alerta.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));
        }
        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();
        }
        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(); });
        }
Beispiel #8
0
        private void MprofileTracker_mOnProfileChanged(object sender, OnProfileChangedEventArgs e)
        {
            if (e.mProfile != null)
            {
                try
                {
                    Profile p    = e.mProfile;
                    int     idUS = bd.loginfacebook(p.Id);
                    if (idUS != 0)//consulta para iniciar sesion
                    {
                        Intent i   = new Intent(this, typeof(Inicio));
                        string aux = Convert.ToString(idUS);
                        i.PutExtra("idUs", aux);
                        StartActivity(i);
                    }
                    else
                    {
                        AlertDialog alerta = new AlertDialog.Builder(this).Create();
                        alerta.SetTitle("Error ");
                        alerta.SetMessage("FB no esta enlazado a ninguna cuenta de usuario");
                        alerta.SetButton("Aceptar", (a, b) => { });
                        alerta.Show();
                    }

                    // tengo que crear el layout del  config y pasar los datos a una sesion para almacenarlos entre pestañas
                }
                catch (Java.Lang.Exception ex) { }
            }
            else
            {
            }
        }
Beispiel #9
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);
            }
        }
Beispiel #10
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 #11
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 #12
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
            builder.SetPositiveButton(Android.Resource.String.Ok, (IDialogInterfaceOnClickListener)null);
            Bundle args = Arguments;

            if (args.ContainsKey(ArgMessageInt))
            {
                builder.SetMessage(args.GetInt(ArgMessageInt));
            }
            else if (args.ContainsKey(ArgMessageString))
            {
                builder.SetMessage(args.GetString(ArgMessageString));
            }
            return(builder.Create());
        }
Beispiel #13
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();
        }
Beispiel #14
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));
        }
Beispiel #15
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");
     }
 }
Beispiel #16
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();
        }
 private void pruebecita(object sender, EventArgs e)
 {
     AlertDialog.Builder ventanaEmergente = new AlertDialog.Builder(this);
     ventanaEmergente.SetTitle("Ejercicio 1");
     ventanaEmergente.SetMessage(_editText1.Text.ToString());
     ventanaEmergente.Show();
 }
        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 #19
0
        private async Task CifrarArchivos(byte[] keyMaterial, bool eliminarArchivos)
        {
            AlertDialog.Builder mensajeInformacion = new AlertDialog.Builder(this);
            mensajeInformacion.SetTitle("Error al cifrar");
            foreach (var archivo in adaptador.archivos)
            {
                string rutaDestino;
                try
                {
                    rutaDestino = Path.Combine(Path.GetDirectoryName(archivo.Nombre), Path.GetFileName(archivo.Nombre)) + ".crypt";
                    await Crypto.CifradoDescifradoAsincrono(keyMaterial, archivo.Nombre, rutaDestino, true);

                    if (eliminarArchivos)
                    {
                        File.Delete(archivo.Nombre);
                    }
                    archivosProcesados.Add(rutaDestino);
                }
                catch (System.Security.Cryptography.CryptographicException)
                {
                    mensajeInformacion.SetMessage("El archivo " + Path.GetFileName(archivo.Nombre) + " no pudo ser cifrado");
                    mensajeInformacion.Show();
                }
                catch (FileNotFoundException)
                {
                    mensajeInformacion.SetMessage("El archivo " + Path.GetFileName(archivo.Nombre) + " no pudo ser encontrado");
                    mensajeInformacion.Show();
                }
                catch (DirectoryNotFoundException)
                {
                    mensajeInformacion.SetMessage("El directorio destino '" + Path.GetDirectoryName(archivo.Nombre) + "' no pudo ser encontrado");
                    mensajeInformacion.Show();
                }
                catch (Javax.Crypto.IllegalBlockSizeException)
                {
                    mensajeInformacion.SetMessage("El archivo " + Path.GetFileName(archivo.Nombre) + " no pudo ser cifrado. La contraseña es incorrecta");
                    mensajeInformacion.Show();
                }
                catch (Exception)
                {
                    mensajeInformacion.SetMessage("Error desconocido");
                    mensajeInformacion.Show();
                }
            }
        }
Beispiel #20
0
        // Display that there's not enough questions to play the game and redirect to the `ListQuestionsActivity`.
        private void ShowNotEnoughQuestionsAlert()
        {
            AlertDialog notEnoughQuestionsAlert = new AlertDialog.Builder(this).Create();

            notEnoughQuestionsAlert.SetCanceledOnTouchOutside(false);
            notEnoughQuestionsAlert.SetMessage(string.Format("Sorry, you don't have enough questions to play this game! Please add at least {0} using the 'MANAGE QUESTIONS' section", minNumberOfQuestions));
            notEnoughQuestionsAlert.SetButton("Okay", (sender, args) => { StartActivity(typeof(ListQuestionsActivity)); Finish(); });
            notEnoughQuestionsAlert.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);
     }
 }
Beispiel #23
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 #24
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();
                }
            }
        }
        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();
                }
            };
        }
Beispiel #26
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            AlertDialog.Builder aboutAlert = new AlertDialog.Builder(this);
            aboutAlert.SetTitle("Sobre");

            aboutAlert.SetMessage("Desenvolvido por Mei Fagundes\nGNU General Public License v3.0, 2019");

            Dialog dialog = aboutAlert.Create();

            dialog.Show();

            return(base.OnOptionsItemSelected(item));
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.institutions_info);



            var toolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);


            // Create your application here
            FindViewById <FrameLayout>(Resource.Id.progressBarHolder).Visibility = ViewStates.Visible;


            model.db_select select = new model.db_select();

            list = await select.get_institutions(Preferences.Get("cypher1", "").ToString(), Preferences.Get("cypher2", "").ToString());

            //Toast.MakeText(ApplicationContext, list[0].DocAdSoyad, ToastLength.Long).Show();

            listView1 = FindViewById <ListView>(Resource.Id.listView1);
            FindViewById <SearchView>(Resource.Id.searchView1).QueryTextChange += search;
            AD = new List <string>();

            foreach (var item in list)
            {
                AD.Add(item.AD);
            }
            mAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, AD);
            if (!mAdapter.IsEmpty)
            {
                FindViewById <ListView>(Resource.Id.listView1).Adapter = mAdapter;
            }
            else
            {
                AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
                alertDialog.SetTitle("Bildiriş");
                alertDialog.SetMessage("Xəta baş verdi");
                alertDialog.SetNeutralButton("Geriyə", delegate {
                    alertDialog.Dispose();
                });
                alertDialog.Show();
            }

            FindViewById <FrameLayout>(Resource.Id.progressBarHolder).Visibility = ViewStates.Gone;
        }
Beispiel #28
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();
            }
        }
        private void DeleteListAlert(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            GroceryListClass toDeleteList = AppData.currentLists[e.Position];

            AlertDialog.Builder alert = new AlertDialog.Builder(this);

            if (toDeleteList.Owner.Uid == AppData.currentUser.Uid)
            {
                alert.SetTitle("Confirm Delete");
                alert.SetMessage("Are you sure you want to delete the list " + toDeleteList.Name + "?");
            }
            else
            {
                alert.SetTitle("Remove Invitation");
                alert.SetMessage("Are you sure you want to remove this invitation from " + toDeleteList.Owner.Name + "?");
            }

            alert.SetPositiveButton("Delete", (senderAlert, eAlert) => DeleteList(toDeleteList, e));
            alert.SetNegativeButton("Cancel", (senderAlert, eAlert) => { });
            Dialog dialog = alert.Create();

            dialog.Show();
        }
Beispiel #30
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);
     }
 }