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"); } }
// 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(); }); }
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 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 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; }
public void GetJsonData() { try { var assembly = typeof(MainActivity).GetTypeInfo().Assembly; Stream stream = assembly.GetManifestResourceStream($"{assembly.GetName().Name}.slangWordsList.json"); using (var reader = new StreamReader(stream)) { var json = reader.ReadToEnd(); var myDeserializedClass = JsonConvert.DeserializeObject <List <MatchedWord> >(json); if (editTextInput.Text.Equals(myDeserializedClass[0].SlangWord, StringComparison.OrdinalIgnoreCase)) { showResult.Text = myDeserializedClass[0].Description; } else if (editTextInput.Text.Equals(myDeserializedClass[1].SlangWord, StringComparison.OrdinalIgnoreCase)) { showResult.Text = myDeserializedClass[1].Description; } else if (editTextInput.Text.Equals(myDeserializedClass[2].SlangWord, StringComparison.OrdinalIgnoreCase)) { showResult.Text = myDeserializedClass[2].Description; } else { showResult.Text = Constants.NoMatch; } } } catch (Exception ex) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.SetTitle(Constants.Error); alertDialog.SetMessage(Constants.ErrorNotify + ex.Message); alertDialog.SetNeutralButton(Constants.Ok, delegate { alertDialog.Dispose(); }); alertDialog.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(); }
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(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.DetailServicioLayout); pedido = FindViewById <TextView>(Resource.Id.pedido); nombrecliente = FindViewById <TextView>(Resource.Id.pedidocliente); efectivo = FindViewById <TextView>(Resource.Id.efectivo); dinero = FindViewById <TextView>(Resource.Id.dinero); navegacion = FindViewById <Button>(Resource.Id.navegacionbtn); finalizar = FindViewById <Button>(Resource.Id.finalizarpedido); productoslist = FindViewById <ListView>(Resource.Id.listpedidos); pedidorecolectado = FindViewById <Button>(Resource.Id.pedidorecolectado); var id = Intent.GetStringExtra(IDPEDIDO); var cliente = Intent.GetStringExtra(CLIENTE); var lat = Intent.GetStringExtra(LATITUDDESTINO); var lng = Intent.GetStringExtra(LONGITUDDESTINO); var horad = Intent.GetStringExtra(HORACREADA); Console.WriteLine(id, cliente, lat, lng, horad); pedido.Text = id; nombrecliente.Text = cliente; string latt = lat; string longg = lng; string sql = string.Format("Select irrelevante, NombreProducto,NombreRestaurante,Cantidad from TapFood.Pedido where(IdPedido='{0}')", id); Console.WriteLine(sql); MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader rd; rd = cmd.ExecuteReader(); while (rd.Read()) { DetailProductos producto = new DetailProductos(); producto.irrelevante = (int)rd["irrelevante"]; producto.NombreProducto = (string)rd["NombreProducto"]; producto.NombreRestaurante = (string)rd["NombreRestaurante"]; producto.Cantidad = Convert.ToInt32(rd["Cantidad"]).ToString(); productos.Add(producto); } rd.Close(); productoslist.Adapter = new ProductoDetailAdapter(this, productos); pedidorecolectado.Click += async delegate { string sql1 = string.Format("Select Creada from TapFood.Pedido where(IdPedido='{0}') limit 1", id); MySqlCommand cm = new MySqlCommand(sql1, conn); MySqlDataReader re; re = cm.ExecuteReader(); re.Read(); string dato = re["Creada"].ToString(); string format = "MM/dd/yyyy hh:mm:ss"; bool result = DateTime.TryParseExact(dato, format, null, DateTimeStyles.None, out DateTime dt); if (result) { re.Close(); for (int i = 0; i < productos.Count; i++) { var location = await Geolocation.GetLastKnownLocationAsync(); string sql2 = string.Format("UPDATE `TapFood`.`Pedido` SET `LongitudRepartidor` = '{0}', `LatitudRepartidor` = '{1}', `Recolectada` = '{2}' WHERE (`irrelevante` = '{3}';", location.Longitude, location.Latitude, DateTime.Now, productos.ElementAt(i).irrelevante); MySqlCommand insert = new MySqlCommand(sql2, conn); insert.ExecuteNonQuery(); } } else { re.Close(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle("El resturant aun no ha confirmado la entrega, ¿estas seguro que ya recolectaste el pedido?"); builder.SetCancelable(false) .SetPositiveButton("Seguro", async(c, ev) => { for (int i = 0; i < productos.Count; i++) { var location = await Geolocation.GetLastKnownLocationAsync(); string sql2 = string.Format("UPDATE `TapFood`.`Pedido` SET `LongitudRepartidor` = '{0}', `LatitudRepartidor` = '{1}', `Recolectada` = '{2}' WHERE (`irrelevante` = '{3}')", location.Longitude, location.Latitude, DateTime.Now, productos.ElementAt(i).irrelevante); Console.WriteLine(sql2); MySqlCommand insert = new MySqlCommand(sql2, conn); insert.ExecuteNonQuery(); } }) .SetNegativeButton("Cancelar", (c, ev) => { builder.Dispose(); }); AlertDialog lala = builder.Create(); lala.Show(); } }; navegacion.Click += delegate { Intent intent = new Intent(this, typeof(MapaNavegacionPage)); //intent.PutExtra(MapaNavegacionPage.LATUSR, latt); //intent.PutExtra(MapaNavegacionPage.LONGUSR, longg); StartActivity(intent); }; }
private void ButtonClickDelegate(User user, bool isCheckd) { if (isCheckd) { assignUserList.Add((Integer)user.UserId); if (userListType == resources.GetString(Resource.String.verify)) { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetCancelable(false); alertBuilder.SetMessage("Do you want to send this report to " + user.FullName + " for verification?"); alertBuilder.SetTitle("Send for Verification"); alertBuilder.SetPositiveButton("Yes", (sender, args) => { Intent formActivity = new Intent(Application.Context, typeof(FormActivity)); formActivity.PutExtra(resources.GetString(Resource.String.assign_user_list_type), resources.GetString(Resource.String.verify)); formActivity.PutIntegerArrayListExtra( resources.GetString(Resource.String.assign_user_id_list), assignUserList); activity.SetResult(Result.Ok, formActivity); activity.Finish(); }); alertBuilder.SetNegativeButton("No", (sender, args) => { RemoveSelectedItem(user.UserId); alertBuilder.Dispose(); userListAdapter = new UserListAdapter(this, userCompanies, selectedUserList, userListType); userListAdapter.ButtonClickedOnAssignInvite += ButtonClickDelegate; expandableListView.SetAdapter(userListAdapter); }); alertBuilder.Show(); } else if (userListType == resources.GetString(Resource.String.change_ownership)) { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetCancelable(false); alertBuilder.SetMessage("Do you want to change ownership of this report to " + user.FullName + "?"); alertBuilder.SetTitle("Change Ownership"); alertBuilder.SetPositiveButton("Yes", (sender, args) => { Intent formActivity = new Intent(Application.Context, typeof(FormActivity)); formActivity.PutExtra(resources.GetString(Resource.String.assign_user_list_type), resources.GetString(Resource.String.change_ownership)); formActivity.PutIntegerArrayListExtra( resources.GetString(Resource.String.assign_user_id_list), assignUserList); activity.SetResult(Result.Ok, formActivity); activity.Finish(); }); alertBuilder.SetNegativeButton("No", (sender, args) => { RemoveSelectedItem(user.UserId); alertBuilder.Dispose(); userListAdapter = new UserListAdapter(this, userCompanies, selectedUserList, userListType); userListAdapter.ButtonClickedOnAssignInvite += ButtonClickDelegate; expandableListView.SetAdapter(userListAdapter); }); alertBuilder.Show(); } else { Utility.DisplayToast(Application.Context, user.FullName + " has been added to report"); } sharedPreferences.Edit().PutBoolean("ReportEditFlag", true).Commit(); } else { RemoveSelectedItem(user.UserId); Utility.DisplayToast(Application.Context, "Removed " + user.FullName + " from report"); sharedPreferences.Edit().PutBoolean("ReportEditFlag", false).Commit(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.axtarish_param); var toolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar2); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(false); if (!string.IsNullOrWhiteSpace(Intent.GetStringExtra("r_id"))) { FindViewById <Button>(Resource.Id.button2).Enabled = true; // Toast.MakeText(this, Intent.GetStringExtra("m_id"), ToastLength.Long).Show(); FindViewById <Button>(Resource.Id.button1).Text = Intent.GetStringExtra("r_name"); } if (!string.IsNullOrWhiteSpace(Intent.GetStringExtra("m_id"))) { FindViewById <Button>(Resource.Id.button2).Enabled = true; // Toast.MakeText(this, Intent.GetStringExtra("r_id")+" "+Intent.GetStringExtra("m_id"), ToastLength.Long).Show(); FindViewById <Button>(Resource.Id.button1).Text = Intent.GetStringExtra("r_name"); FindViewById <Button>(Resource.Id.button2).Text = Intent.GetStringExtra("m_name"); } FindViewById <Button>(Resource.Id.button1).Click += delegate { //Выбор города //FindViewById<Button>(Resource.Id.button2).Text = "Tibb müəssisəsini daxil edin..."; Finish(); Intent regionlar = new Intent(this, typeof(Regionlar)); regionlar.PutExtra("data", Intent.GetStringExtra("data")); StartActivity(regionlar); }; FindViewById <Button>(Resource.Id.button2).Click += delegate { //Выбор региона Finish(); Intent mues = new Intent(this, typeof(muessiseler)); mues.PutExtra("data", Intent.GetStringExtra("data")); mues.PutExtra("r_id", Intent.GetStringExtra("r_id")); mues.PutExtra("r_name", Intent.GetStringExtra("r_name")); StartActivity(mues); }; FindViewById <Button>(Resource.Id.button3).Click += delegate { //Кнопка поиска if (FindViewById <EditText>(Resource.Id.editText1).Text != "" || FindViewById <EditText>(Resource.Id.editText2).Text != "") { Intent hekimler = new Intent(this, typeof(hekimler)); hekimler.PutExtra("data", Intent.GetStringExtra("data")); hekimler.PutExtra("r_id", Intent.GetStringExtra("r_id")); hekimler.PutExtra("m_id", Intent.GetStringExtra("m_id")); hekimler.PutExtra("ad", FindViewById <EditText>(Resource.Id.editText1).Text); hekimler.PutExtra("soyad", FindViewById <EditText>(Resource.Id.editText2).Text); StartActivity(hekimler); } else { if (!string.IsNullOrWhiteSpace(Intent.GetStringExtra("r_id"))) { if (!string.IsNullOrWhiteSpace(Intent.GetStringExtra("m_id"))) { Intent vezifeler = new Intent(this, typeof(vezifeler)); vezifeler.PutExtra("data", Intent.GetStringExtra("data")); vezifeler.PutExtra("r_id", Intent.GetStringExtra("r_id")); vezifeler.PutExtra("m_id", Intent.GetStringExtra("m_id")); StartActivity(vezifeler); } else { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.SetTitle("Bildiriş"); alertDialog.SetMessage("Axtarışa başlamaq üçün minimum 2 axtarış parametri seçin"); alertDialog.SetNeutralButton("Yaxşı", delegate { alertDialog.Dispose(); }); alertDialog.Show(); } } else { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.SetTitle("Bildiriş"); alertDialog.SetMessage("Axtarışa başlamaq üçün regionu seçin"); alertDialog.SetNeutralButton("Yaxşı", delegate { alertDialog.Dispose(); }); alertDialog.Show(); } } }; }