private async void BtnConfirm_Click(object sender, RoutedEventArgs e) { popup = ConfigurePopup.Configure(popup, "Fill all the fields first!", BtnConfirm, PlacementMode.Top); popup.IsOpen = false; texts = ListTextBoxesHelper.GetText(SP.Children); if (ListTextBoxesHelper.StringsNotEmpty(texts)) { try { if (!DecimalNumberChecker.Check(texts[1])) { popup = ConfigurePopup.Configure(popup, "Only decimal numbers in price are allowed in price field!", BtnConfirm, PlacementMode.Top); popup.IsOpen = true; return; } await Task.Run(() => AdminInterface.UpdateAsync(Attraction.Id, Attraction)); this.Close(); } catch (Exception ex) { popup = ConfigurePopup.Configure(popup, ex.Message, BtnConfirm, PlacementMode.Top); popup.IsOpen = true; } } else { popup.IsOpen = true; } }
private async void BtnConfirm_Click(object sender, RoutedEventArgs e) { if (picRef.Equals(defPicture)) { this.Close(); } if (!string.IsNullOrWhiteSpace(picRef)) { try { Dispatcher.Invoke(new Action(() => { Picture.Picture1 = picRef; })); await Task.Run(() => adminInterfacePictures.UpdateAsync(Picture.Id, Picture)); this.Close(); } catch (Exception ex) { popup = ConfigurePopup.Configure(popup, ex.Message, BtnConfirm, PlacementMode.Top); popup.IsOpen = true; } } else { popup = ConfigurePopup.Configure(popup, "No picture was selected", BtnConfirm, PlacementMode.Top); popup.IsOpen = true; } }
private async void BtnConfirm_Click(object sender, RoutedEventArgs e) { popup = ConfigurePopup.Configure(popup, "Fill all fields first and select picture!", BtnConfirm, PlacementMode.Top); popup.IsOpen = false; texts.Clear(); texts.Add((SP.Children[0] as TextBox).Text); if (!ListTextBoxesHelper.StringsNotEmpty(texts) || !Hotel.Pictures.Any()) { popup.IsOpen = true; } else { City c = CB.SelectedItem as City; Hotel.City = c; try { await Task.Run(() => AdminInterface.UpdateAsync(Hotel.Id, Hotel)); this.Close(); } catch (Exception ex) { popup = ConfigurePopup.Configure(popup, ex.Message, BtnConfirm, PlacementMode.Top); popup.IsOpen = true; } } }
private async void TryUpdate() { try { await Task.Run(() => AdminInterface.UpdateAsync(City.Id, City)); this.Close(); } catch (Exception ex) { popup = ConfigurePopup.Configure(popup, ex.Message, BtnConfirm, PlacementMode.Top); } }