private void ConfirmSelectedCollaborators(object sender, EventArgs e) { if (assignUserList.Count > 0) { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetCancelable(false); alertBuilder.SetMessage("Do you want to share this report with this selected users?"); alertBuilder.SetTitle("Share Report"); alertBuilder.SetPositiveButton("Yes", (sender1, args) => { Intent formActivity = new Intent(this, typeof(FormActivity)); formActivity.PutExtra(Resources.GetString(Resource.String.assign_user_list_type), Resources.GetString(Resource.String.add_collaborators)); formActivity.PutIntegerArrayListExtra(Resources.GetString(Resource.String.assign_user_id_list), assignUserList); SetResult(Result.Ok, formActivity); Finish(); }); alertBuilder.SetNegativeButton("No", (sender1, args) => { assignUserList.Clear(); alertBuilder.Dispose(); userListAdapter = new UserListAdapter(this, userCompanies, selectedUserList, userListType); userListAdapter.ButtonClickedOnAssignInvite += ButtonClickDelegate; expandableListView.SetAdapter(userListAdapter); }); alertBuilder.Show(); } else { Utility.DisplayToast(this, "Please select a user to share report"); } }
private void 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(); }); }
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(); }
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(); } }
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! } ); }
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); } }
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 Promocionbtn_Click(object sender, EventArgs e) { LayoutInflater inflater = LayoutInflater.From(this); View vv = inflater.Inflate(Resource.Layout.propinapopup, null); AlertDialog.Builder kola = new AlertDialog.Builder(this); kola.SetView(vv); kola.SetTitle("Por favor agrega tu promocion"); var promo = vv.FindViewById <EditText>(Resource.Id.lineapropina); kola.SetCancelable(false) .SetPositiveButton("Agregar", (c, ev) => { string sql = string.Format("Select * from TapFood.Promociones where(IdPromociones = '{0}')", promo.ToString()); MySqlCommand loginverid = new MySqlCommand(sql, conn); MySqlDataReader usr; usr = loginverid.ExecuteReader(); if (usr.HasRows) { promocion.Text = (string)usr["IdPromocion"]; string x = (string)usr["Descuento"]; float cosumel = float.Parse(x); AddData(cosumel); Toast.MakeText(this, "Hemos agregado la promocion correctamente", ToastLength.Long).Show(); usr.Close(); } else { AddData(0); Toast.MakeText(this, "No hemos encontrado el codigo que introduciste, intenta de nuevo por favor", ToastLength.Long).Show(); usr.Close(); promocionagregada.Text = "$0.00"; } }) .SetNegativeButton("Cancelar", (c, ev) => { AddData(0); promocionagregada.Text = "0.00"; Finish(); }); AlertDialog cma = kola.Create(); cma.Show(); }
private void delete_user() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle("Предупреждение"); builder.SetMessage("Вы уверены, что хотите удалить учетную запись?"); builder.SetCancelable(true); builder.SetNegativeButton("Нет", (s, ev) => { }); try { builder.SetPositiveButton("Да", (s, ev) => { //pbar.Visibility = ViewStates.Visible; AccountsController.instance.CreateTable(); AccountsController.instance.DeleteItem(AccountsController.mainAccP.Id); AccountsController.mainAccP = null; foreach (var item in ContactsController.instance.GetItems()) { ContactsController.instance.DeleteItem(item.Id); } DialogsController.instance.CreateTable(); foreach (var d in DialogsController.instance.GetItems().ToList()) { DialogsController.instance.DeleteItem(d.Id); } MessagesController.instance.CreateTable(); foreach (var m in MessagesController.instance.GetItems().ToList()) { MessagesController.instance.DeleteItem(m.Id); } FirebaseController.instance.initFireBaseAuth(); FirebaseController.instance.DeleteUser(this); }); Dialog dialog = builder.Create(); dialog.Show(); return; } catch (Exception ex) { Utils.MessageBox(ex.Message, this); } }
//============================================================== private void Cmd_adivinhar_Click(object sender, EventArgs e) { //analisa os dados inseridos versus o valor sorteado if (edit_valor.Text == "") { return; } string mensagem; int valor_inserido = int.Parse(edit_valor.Text); if (valor_inserido < valor_sorteado) { mensagem = "O valor inserido é inferior ao sorteado."; numero_tentativas++; } else if (valor_inserido > valor_sorteado) { mensagem = "O valor inserido é superior ao sorteado."; numero_tentativas++; } else { //acertou mensagem = "Acertou."; } text_tentativas.Text = "Tentativas: " + numero_tentativas.ToString(); AlertDialog.Builder caixa = new AlertDialog.Builder(this); caixa.SetTitle("Adivinha o Número"); caixa.SetMessage(mensagem); caixa.SetPositiveButton("OK", delegate { }); caixa.SetCancelable(false); caixa.Show(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); this.babyEmotion = FindViewById <ImageView>(Resource.Id.babyEmotion); btn_voix_1 = FindViewById <Button>(Resource.Id.btn_voix_1); btn_voix_2 = FindViewById <Button>(Resource.Id.btn_voix_2); btn_voix_off = FindViewById <Button>(Resource.Id.btn_voix_off); initListeners(); //Initialisation du référentiel AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.SetTitle("Info"); alertDialog.SetMessage("Posez le téléphone sur une surface plane, face vers le haut, et parallèle au sol"); alertDialog.SetPositiveButton("C'est fait !", start); alertDialog.SetCancelable(false); alertDialog.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 async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); try { //TextView name = FindViewById<TextView>(Resource.Id.nav_bar_name); //name.Text = AccountsController.mainAccP.loginP; //TextView ml = FindViewById<TextView>(Resource.Id.nav_bar_addr); //ml.Text = AccountsController.mainAccP.emailP; //CryptoProvider c = new CryptoProvider(); //CryptoProvider.Encrupt("privet", AccountsController.mainAccP.openKeyRsaP, //AccountsController.mainAccP.privateKeyRsaP, c); connectivityManager = (ConnectivityManager)GetSystemService(ConnectivityService); networkInfo = null; DialogsController.instance.CreateTable(); oldDialogs = DialogsController.instance.GetItems().ToList(); SetContentView(Resource.Layout.main_page); tb = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.tooolbarCommon); drawer = FindViewById <DrawerLayout>(Resource.Id.drawerLayout1); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, Resource.String.openDrawer, Resource.String.closeDrawer); toggle.SyncState(); navigation = FindViewById <NavigationView>(Resource.Id.navigationMain); navigation.SetNavigationItemSelectedListener(this); var header = navigation.GetHeaderView(0); TextView name = header.FindViewById <TextView>(Resource.Id.nav_bar_name); name.Text = AccountsController.mainAccP.loginP; TextView ml = header.FindViewById <TextView>(Resource.Id.nav_bar_addr); ml.Text = AccountsController.mainAccP.emailP; checkProgress = FindViewById <ProgressBar>(Resource.Id.checkProgress); dialogs = FindViewById <ListView>(Resource.Id.dialogsList); oldDialogsList = FindViewById <ListView>(Resource.Id.oldDialogsList); SetSupportActionBar(tb); Android.Support.V7.App.ActionBar abar = SupportActionBar; abar.SetHomeButtonEnabled(true); abar.SetDisplayShowTitleEnabled(true); abar.SetHomeAsUpIndicator(Resource.Drawable.menu); abar.SetDisplayHomeAsUpEnabled(true); check = FindViewById <Button>(Resource.Id.check); check.Text = "Проверить запросы"; check.Click += async delegate { networkInfo = connectivityManager.ActiveNetworkInfo; if (networkInfo != null && networkInfo.IsConnected == true) { try { Task <List <MyDialog> > sizeTask = FirebaseController.instance.FindDialogs("Dialog " + AccountsController.mainAccP.emailP + "+", this); checkProgress.Visibility = ViewStates.Visible; check.Enabled = false; dialogs.Enabled = false; oldDialogsList.Enabled = false; dialogg = await sizeTask; if (dialogg == null) { Utils.MessageBox("Нет новых запросов!", this); } else { refresh_dialogs(); } checkProgress.Visibility = ViewStates.Invisible; check.Enabled = true; dialogs.Enabled = true; oldDialogsList.Enabled = true; } catch (Exception ex) { Utils.MessageBox("Невозможно загрузить запросы. Проверьте подключение к интернету", this); checkProgress.Visibility = ViewStates.Invisible; check.Enabled = true; dialogs.Enabled = true; oldDialogsList.Enabled = true; } } else { Utils.MessageBox("Невозможно загрузить запросы. Проверьте подключение к интернету", this); } }; dialogs.ItemClick += (sender, e) => { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle("Предупреждение"); builder.SetMessage("Разрешить начать диалог с данным пользователем?"); builder.SetCancelable(true); builder.SetNegativeButton("Нет", async(s, ev) => { Message c = adapter[Convert.ToInt32(e.Id)]; MyDialog temp = dialogg.Find(x => x.lastMessage == c); Task <bool> denialTask = FirebaseController.instance.SendDialogDenial(temp.dialogName, c.senderP); bool answer = await denialTask; checkProgress.Visibility = ViewStates.Visible; if (answer) { dialogg.Remove(temp); messages.Remove(c); refresh_dialogs(); Utils.MessageBox("Успешно!", this); } else { Utils.MessageBox("Ошибка! Повторите позже.", this); } checkProgress.Visibility = ViewStates.Invisible; }); builder.SetPositiveButton("Да", async(s, ev) => { Message c = adapter[Convert.ToInt32(e.Id)]; MyDialog temp = dialogg.Find(x => x.lastMessage == c); Task <bool> responseTask = FirebaseController.instance.SendDialogResponse(temp.dialogName, c.senderP); checkProgress.Visibility = ViewStates.Visible; bool _answer = await responseTask; if (_answer) { dialogg.Remove(temp); messages.Remove(c); refresh_dialogs(); ContactsController.instance.CreateTable(); ContactsController.instance.SaveItem(new Contact { contactAddressP = c.senderP, dialogNameP = temp.dialogName, contactNameP = "user name", contactRsaOpenKeyP = "no key" }, false); Task <int> firstIdtask = FirebaseController.instance.ReturnLastId(AccountsController.mainAccP.emailP, this); int firstId = await firstIdtask; FirebaseController.instance.AddContact(c.senderP, AccountsController.mainAccP.emailP, firstId + 1, temp.dialogName); Task <int> secondIdtask = FirebaseController.instance.ReturnLastId(c.senderP, this); int secondId = await secondIdtask; FirebaseController.instance.AddContact(AccountsController.mainAccP.emailP, c.senderP, secondId + 1, temp.dialogName); Utils.MessageBox("Успешно!", this); } else { Utils.MessageBox("Ошибка! Повторите позже.", this); } checkProgress.Visibility = ViewStates.Invisible; }); Dialog dialog = builder.Create(); dialog.Show(); return; }; checkProgress.Visibility = ViewStates.Visible; await fillOld(); if (oldDialogs != null) { /**/ oldDialogs = oldDialogs.OrderByDescending(x => x.accessFlag).ToList().OrderByDescending(x => Convert.ToDateTime(x.timeP)).ToList(); adapterOld = new OldDialogItemAdapter(oldDialogs); } else { /**/ oldDialogs = oldDialogs.OrderByDescending(x => x.accessFlag).ToList().OrderByDescending(x => Convert.ToDateTime(x.timeP)).ToList(); oldDialogs = new List <MyDialog>(); adapterOld = new OldDialogItemAdapter(oldDialogs); } oldDialogsList.Adapter = adapterOld; checkProgress.Visibility = ViewStates.Invisible; oldDialogsList.ItemClick += (sender, e) => { Intent i = new Intent(this, typeof(DialogActivity)); i.SetFlags(ActivityFlags.NoAnimation); MyDialog temp = adapterOld[Convert.ToInt32(e.Id)]; DialogsController.currDialP = temp; i.PutExtra("dialogName", temp.dialogName); i.PutExtra("receiver", temp.receiverP == AccountsController.mainAccP.emailP ? temp.senderP : temp.receiverP); //изменил (убрал .lastMessage) возможно поэтому что-то сломалось i.PutExtra("flag", 1); StartActivity(i); }; } catch (Exception ex) { //Utils.MessageBox(ex.Message, this); } }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.menuItem1: { // add your code return(true); } case Resource.Id.menuItem2: { // Create a Popup that will allow the user to choose a new color for there Location Dot. AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Change Icon Color"); View view = LayoutInflater.Inflate(Resource.Layout.ColorLayout, null); ColorAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItemSingleChoice, mainsave.ColorsAvailable); ColorList = (ListView)view.FindViewById(Resource.Id.ColorListView); ColorList.Adapter = ColorAdapter; ColorList.ItemClick += colorSelected; ColorList.SetItemChecked(mainsave.IndexColors(), true); // Get the currently selected color and have it selected alert.SetPositiveButton("OK", OkColorAction); // Assign what happens when the user clicks ok. alert.SetCancelable(false); alert.SetView(view); alert.Show(); // Show Popup return(true); } case Resource.Id.menuItem3: { // Create popup for if the user wants the units in MPH/Feet or KPH/Meters AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Change Measurement System"); View view = LayoutInflater.Inflate(Resource.Layout.ColorLayout, null); List <string> temp = new List <string> { "Imperial", "Metric" }; MeasurementAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItemSingleChoice, temp); // Determine currently selected unit system ColorList = (ListView)view.FindViewById(Resource.Id.ColorListView); ColorList.Adapter = MeasurementAdapter; if (mainsave.Measurement == MySettings.MeasurementSystem.Imperial) { ColorList.SetItemChecked(0, true); } else { ColorList.SetItemChecked(1, true); } ColorList.ItemClick += colorSelected; alert.SetPositiveButton("OK", OkMeasurementAction); alert.SetCancelable(false); alert.SetView(view); alert.Show(); return(true); } } return(base.OnOptionsItemSelected(item)); }
public override bool OnOptionsItemSelected(IMenuItem item) { try { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle("Предупреждение"); builder.SetMessage("Вы уверены, что хотите изменить данные учетной записи?"); builder.SetCancelable(true); builder.SetNegativeButton("Нет", (s, ev) => { }); FirebaseController.instance.initFireBaseAuth(); switch (item.ItemId) { case Android.Resource.Id.Home: Finish(); return(true); case Resource.Id.okay: if (text.Text.Contains("имя")) { if (Utils.IsCorrectLogin(data.Text)) { builder.SetPositiveButton("Да", (s, ev) => { AccountsController.mainAccP.loginP = data.Text; AccountsController.instance.CreateTable(); AccountsController.instance.SaveItem(AccountsController.mainAccP); progress.Visibility = ViewStates.Visible; turnOnControls(false); change_login(); }); Dialog dialog = builder.Create(); dialog.Show(); return(true); } } if (text.Text.Contains("адрес")) { if (Utils.IsCorrectEmail(data.Text)) { builder.SetPositiveButton("Да", (s, ev) => { AccountsController.mainAccP.emailP = data.Text; AccountsController.instance.CreateTable(); AccountsController.instance.SaveItem(AccountsController.mainAccP); progress.Visibility = ViewStates.Visible; turnOnControls(false); change_mail(); }); Dialog dialog = builder.Create(); dialog.Show(); return(true); } } if (text.Text.Contains("пароля")) { builder.SetPositiveButton("Да", (s, ev) => { if (oldpass.Text == AccountsController.mainAccP.passwordP) { if (oldpass.Text != data.Text) { AccountsController.mainAccP.passwordP = data.Text; AccountsController.instance.CreateTable(); AccountsController.instance.SaveItem(AccountsController.mainAccP); progress.Visibility = ViewStates.Visible; turnOnControls(false); change_pass(); } else { Utils.MessageBox("Новый пароль не должен совпадать со старым!", this); } } else { oldpass.Text = ""; data.Text = ""; Utils.MessageBox("Некорректный пароль учетной записи!", this); } }); Dialog dialog = builder.Create(); dialog.Show(); return(true); } return(true); default: return(base.OnOptionsItemSelected(item)); } } catch (Exception ex) { Utils.MessageBox(ex.Message, this); return(false); } }