protected virtual void CloseDialog(DialogClosingEventArgs e) { if (DialogClosing != null) { DialogClosing(this, e); } }
private void ConfirAddOrEditProjectEventHandler(object sender, DialogClosingEventArgs eventArgs) { if ((bool)eventArgs.Parameter == false) { return; } //cancel the close... eventArgs.Cancel(); DialogTitle = AddOrEditProjectDialog.DialogTitle; Project = AddOrEditProjectDialog.Project; try { bool IsSuccess = false; switch (DialogTitle) { case "新增项目": IsSuccess = AddProject(); break; case "编辑项目": IsSuccess = UpdProject(); break; default: break; } if (IsSuccess) { // 显示加载1s eventArgs.Session.UpdateContent(new SampleProgressDialog()); Task.Delay(TimeSpan.FromSeconds(0.3)) .ContinueWith((t, _) => eventArgs.Session.Close(false), null, TaskScheduler.FromCurrentSynchronizationContext()); } } catch (Exception ex) { ErrorDialogViewModel.getInstance().updateShow(ex, eventArgs.Session); return; } ToggleOwnershipTypeCommand = new DelegateCommand(ToggleOwnershipType); ToggleMappingTypeCommand = new DelegateCommand(ToggleMappingType); }
private void OnClosingAffectOptionToItem(object sender, DialogClosingEventArgs eventArgs) { if (rvm.Result) { try { var liste = (ItemModel)lv_items.SelectedItem; if (liste != null) { lv_itemsOptions.ItemsSource = mg.GetItemsOptionsByItem(liste.Id); } } catch (Exception ex) { } } }
private void OnClosingEditItem(object sender, DialogClosingEventArgs eventArgs) { if (rvm.Result) { try { var liste = (CategoryModel)lv_itemsCategory.SelectedItem; if (liste != null) { lv_items.ItemsSource = mg.GetItemsByCat(liste.Id); } } catch { } } }
private async void ExtendedClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { if ((bool)eventArgs.Parameter) { var dc = (eventArgs.Session.Content as Wizards.EditCostCategories); //Accept using (var db = new DB.DomenaDBContext()) { foreach (var cmd in dc.commandBuffer) { switch (cmd.CommandType) { default: break; case Helpers.CommandEnum.Add: db.CostCategories.Add(cmd.Item); db.SaveChanges(); break; case Helpers.CommandEnum.Remove: db.CostCategories.Where(x => x.BuildingChargeBasisCategoryId.Equals(cmd.Item.BuildingChargeBasisCategoryId)).FirstOrDefault().IsDeleted = true; db.SaveChanges(); break; case Helpers.CommandEnum.Update: db.CostCategories.Where(x => x.BuildingChargeBasisCategoryId.Equals(cmd.Item.BuildingChargeBasisCategoryId)).FirstOrDefault().CategoryName = cmd.Item.CategoryName; db.SaveChanges(); break; } } } } else if (!(bool)eventArgs.Parameter) { bool ynResult = await Helpers.YNMsg.Show("Czy chcesz anulować?"); if (!ynResult) { //eventArgs.Cancel(); var dc = (eventArgs.Session.Content as Wizards.EditCostCategories); var result = await DialogHost.Show(dc, "HelperDialog", ExtendedOpenedEventHandler, ExtendedClosingEventHandler); } } InitializeCategoriesList(); }
private void OnClosingAddIngredientItem(object sender, DialogClosingEventArgs eventArgs) { if (rvm.Result) { try { var liste = (ItemsCategoryModel)lv_ingredientCategory.SelectedItem; if (liste != null) { lv_ingredient.ItemsSource = mg.GetIngredientByCat(liste.Id); } } catch (Exception ex) { } } }
private async void DeletePathClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { if (Convert.ToBoolean(eventArgs.Parameter) == false) { _cts.Cancel(); return; } var dialogModel = (eventArgs.Session.Content as UserControl)?.DataContext as CommonDialogViewModel; var zkPath = dialogModel?.Name; _cts = new CancellationTokenSource(); //OK, lets cancel the close... eventArgs.Cancel(); //...now, lets update the "session" with some new content! eventArgs.Session.UpdateContent(new ProgressDialog()); //note, you can also grab the session when the dialog opens via the DialogOpenedEventHandler await Task.Run(async() => { using (var zkClient = new SolrZkClient($"{ZkHostConnected}:{ZkPortConnected}")) { try { await zkClient.clean(zkPath, _cts.Token); } catch (Exception ex) { //TODO: Show error; } } }).ContinueWith((t, _) => { }, null, TaskScheduler.FromCurrentSynchronizationContext()); if (!_cts.IsCancellationRequested) { eventArgs.Session.UpdateContent(new CheckDialog()); await Task.Delay(TimeSpan.FromMilliseconds(CheckDialogShowingTimeMillis)) .ContinueWith((t, _) => eventArgs.Session.Close(false), null, TaskScheduler.FromCurrentSynchronizationContext()); } //TODO: Do if ex was not throwen UpdateZkTree(ZkHostConnected, ZkPortConnected); }
public void CategoryDialogClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { if (!Equals(eventArgs.Parameter, "1")) { return; } var selectedCategory = Categories.GetDescendants().FirstOrDefault(_ => _.IsSelected); if (selectedCategory == null) { eventArgs.Cancel(); return; } SelectedCategoryId = selectedCategory.Id != EmptyCategoryId ? (int?)selectedCategory.Id : null; }
private void Sample1_DialogHost_OnDialogClosing(object sender, DialogClosingEventArgs eventArgs) { string qry_updt_lastLogin = "******" + user_ID + "'"; string qry_updt_isFirstLog = "UPDATE usuarios SET isFirstLogin = 0 WHERE ID ='" + user_ID + "'"; db.openConn(); using (db.setComm(qry_updt_lastLogin)) { db.getComm().ExecuteNonQuery(); } using (db.setComm(qry_updt_isFirstLog)) { db.getComm().ExecuteNonQuery(); } db.closeConn(); passChanged.IsOpen = true; }
public async void CloseHandle(object sender, DialogClosingEventArgs args) { var now = DateTime.Now; if (this.openedTime == null || (now - this.openedTime.Value) < TimeSpan.FromSeconds(this.openCloseMinInterval)) { args.Cancel(); return; } var confirmationViewModel = args.Session.Content as ConfirmationViewModel; this.ClearDialogContent(sender as DialogHost); if (this.confirmationAction != null && confirmationViewModel != null) { this.confirmationAction.Invoke(confirmationViewModel.ConfirmationContent); } }
private void Sample5_DialogHost_OnDialogClosing(object sender, DialogClosingEventArgs eventArgs) { Console.WriteLine($"SAMPLE 5: Closing dialog with parameter: {eventArgs.Parameter ?? string.Empty}"); //you can cancel the dialog close: //eventArgs.Cancel(); if (!Equals(eventArgs.Parameter, true)) { return; } if (!string.IsNullOrWhiteSpace(AnimalTextBox.Text)) { AnimalListBox.Items.Add(AnimalTextBox.Text.Trim()); } }
private void Sample1_DialogHost_OnDialogClosing(object sender, DialogClosingEventArgs eventArgs) { Console.WriteLine("SAMPLE 1: Closing dialog with parameter: " + (eventArgs.Parameter ?? "")); //you can cancel the dialog close: //eventArgs.Cancel(); if (!Equals(eventArgs.Parameter, true)) { return; } if (!string.IsNullOrWhiteSpace(FruitTextBox.Text)) { FruitListBox.Items.Add(FruitTextBox.Text.Trim()); } }
private void AddCakeDialogClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { if (eventArgs.Parameter is bool parameter && parameter == false) { return; } using (var db = new CAKESTOREEntities()) { var newCake = this._detailDialogViewModel.SelectedCake; db.CAKEs.Add(newCake); db.SaveChanges(); }; MainWindowViewModel.Instance.GetAutocompleteSource(); }
private void ClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { Console.WriteLine("You can intercept the closing event, and cancel here."); //if ((bool)eventArgs.Parameter == false) return; ////OK, lets cancel the close... //eventArgs.Cancel(); ////...now, lets update the "session" with some new content! //eventArgs.Session.UpdateContent(new SampleProgressDialog()); //note, you can also grab the session when the dialog opens via the DialogOpenedEventHandler ////lets run a fake operation for 3 seconds then close this baby. //Task.Delay(TimeSpan.FromSeconds(3)) // .ContinueWith((t, _) => eventArgs.Session.Close(false), null, // TaskScheduler.FromCurrentSynchronizationContext()); }
private void DialogHost_OnDialogClosing(object sender, DialogClosingEventArgs eventArgs) { if (!Equals(eventArgs.Parameter, true)) { return; } if (!string.IsNullOrWhiteSpace(CategoryNameTextBox.Text)) { TagCard tagCard = new TagCard { Margin = new Thickness(10), CategoryLabel = { Text = CategoryNameTextBox.Text } }; ContentPanel.Children.Add(tagCard); CategoryNameTextBox.Text = ""; } }
private void dialogHost_DialogClosing(object sender, DialogClosingEventArgs eventArgs) { if ((bool)eventArgs.Parameter == true) { try { foreach (DataRow row in MainWindow.selectedTableStatic.Rows) { string manv = row[0].ToString(); BUS.NguoiDungBUS.SetIsUpdated(Login.Account); BUS.BangLuongBUS.DeleteBangLuongByID(manv); } MessageBox.Show("Xoá bảng lương thành công!"); dataGridSalary.DataContext = null; } catch { } } }
private void dialogHost_DialogClosing(object sender, DialogClosingEventArgs eventArgs) { if ((bool)eventArgs.Parameter == true) { if (layOff == true) { BUS.NguoiDungBUS.SetIsUpdated(Login.Account); BUS.NhanVienBUS.LayoffNhanVien(dt); RefreshData(); } else { BUS.NguoiDungBUS.SetIsUpdated(Login.Account); BUS.NhanVienBUS.UnLayoffNhanVien(dt); RefreshData(); } } }
private void onCLosingSenderOrderDialog(object sender, DialogClosingEventArgs eventArgs) { if (cartList.Count == 0) { cvm.TotalPrice = 0; cvm.TotalRestPrice = 0; cvm.TotalPayed = 0; listPayement = cvm.Payement; lb_payement.ItemsSource = listPayement; foreach (Payement p in listPayement) { cvm.TotalPayed += p.PayementValue; } tb_totalRest.Text = cvm.TotalPrice - cvm.TotalPayed + "€"; tb_total.Text = cvm.TotalPrice + "€"; } }
private void ToDatePickerDialogClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { if (eventArgs.Parameter is bool parameter && parameter == false) { return; } if (IsValidDateRange(this.FromDate, this.CalendarPickerViewModel.SelectedDate)) { this.ToDate = this.CalendarPickerViewModel.SelectedDate; GetSeriesCollection(); } else { MessageBox.Show("Not valid date"); } }
private static void EnterThingNameClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { if (Equals(eventArgs.Parameter, false)) { return; } if (!(eventArgs.Parameter is InputThingViewModel inputDatViewModel)) { return; } if (!string.IsNullOrWhiteSpace(inputDatViewModel.ThingName)) { inputDatViewModel.ThingList.Add(inputDatViewModel.ThingName.Trim()); } }
private void Sample1_DialogHost_OnDialogClosing(object sender, DialogClosingEventArgs eventArgs) { if (!Equals(eventArgs.Parameter, true)) { return; } if (!string.IsNullOrWhiteSpace(FruitTextBox.Text)) { if (!IgnoreList.Items.Contains(FruitTextBox.Text)) { IgnoreList.Items.Add(FruitTextBox.Text); if (!Instance.Config.Ignored.Contains(FruitTextBox.Text)) { Instance.Config.Ignored.Add(FruitTextBox.Text); } } } }
private async void LinkConfigClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { if (Convert.ToBoolean(eventArgs.Parameter) == false) { return; } var dialogModel = (eventArgs.Session.Content as UserControl)?.DataContext as LinkConfigDialogViewModel; var configName = dialogModel?.ConfigName; var collectionName = dialogModel?.CollectionName; //OK, lets cancel the close... eventArgs.Cancel(); //...now, lets update the "session" with some new content! eventArgs.Session.UpdateContent(new ProgressDialog(false)); //note, you can also grab the session when the dialog opens via the DialogOpenedEventHandler await Task.Run(async() => { using (var zkClient = new SolrZkClient($"{ZkHostConnected}:{ZkPortConnected}")) { try { var manager = new ZkConfigManager(zkClient); await manager.linkConfSet(collectionName, configName); } catch (Exception ex) { //TODO: Show error; } } }).ContinueWith((t, _) => { }, null, TaskScheduler.FromCurrentSynchronizationContext()); //TODO: Do if ex was not throwen eventArgs.Session.UpdateContent(new CheckDialog()); await Task.Delay(TimeSpan.FromMilliseconds(CheckDialogShowingTimeMillis)) .ContinueWith((t, _) => eventArgs.Session.Close(false), null, TaskScheduler.FromCurrentSynchronizationContext()); UpdateZkTree(ZkHostConnected, ZkPortConnected); }
private void SettingsDialogHostClosing(object sender, DialogClosingEventArgs eventArgs) { CurrentDialog.IsOpen = false; bool needSave = false; if (Equals(eventArgs.Parameter, true)) { needSave = true; } if (needSave) { settings.Save(); } else { // rollback settings settings.Set(settings.PrevioslySettings); } }
private void ExtendedClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { if ((bool)eventArgs.Parameter == false) { return; } //OK, lets cancel the close... eventArgs.Cancel(); SR.ApplicationShutdown(); //...now, lets update the "session" with some new content! eventArgs.Session.UpdateContent(new SampleProgressDialog()); //note, you can also grab the session when the dialog opens via the DialogOpenedEventHandler //lets run a fake operation for 3 seconds then close this baby. Task.Delay(TimeSpan.FromSeconds(1)) .ContinueWith((t, _) => { eventArgs.Session.Close(false); Application.Current.Shutdown(); }, null, TaskScheduler.FromCurrentSynchronizationContext()); }
protected virtual void ClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { if ((bool)eventArgs.Parameter == false) { return; } // Получаем значение поля ввода string name = ((eventArgs.Session.Content as TableReferenceAddUpdDialog).DataContext as TableReferenceAddUpdDialogViewModel).Name; if (_dmlCurrent == DML.Insert) { Insert(name); } else if (_dmlCurrent == DML.Update) { Update(name); } ; }
private void DeleteRecordDialog_Closing(object sender, DialogClosingEventArgs e) { var record = (RecordViewModel)e.Parameter; MainDataContext.SelectedDialogRecord = null; if (record == null) { return; } DataManager.DeleteRecord(record); MainDataContext.Records.Remove(record); if (MainDataContext.SelectedRecord == record) { MainDataContext.SelectedRecord = null; } }
private void Search_DialogHost_OnDialogClosing(object sender, DialogClosingEventArgs eventArgs) { OperationsHistory = new ObservableCollection <OperationHistory> { new OperationHistory { Name = "张三", Operation = "删除了一批数据", OperationTime = DateTime.Now.ToString() }, new OperationHistory { Name = "李四", Operation = "增加了一批数据", OperationTime = DateTime.Now.ToString() }, new OperationHistory { Name = "王五", Operation = "添加和删除数据", OperationTime = DateTime.Now.ToString() }, new OperationHistory { Name = "张三", Operation = "更新了数据", OperationTime = DateTime.Now.ToString() } }; Console.WriteLine("Closing dialog with parameter: " + (eventArgs.Parameter ?? "")); }
private void VacationClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { if ((bool)eventArgs.Parameter == false) { return; } eventArgs.Cancel(); var dialogViewContent = (MonthOptionsDialogView)eventArgs.Content; var dialogData = (MonthOptionsDialogViewModel)dialogViewContent.DataContext; YearMonthModel tempYearMonth = new YearMonthModel { Year = dialogData.SelectedDate.Year, Month = dialogData.SelectedDate.Month, MonthsWorkingHours = dialogData.MonthsWorkingHours, MonthsWeekendDays = new HashSet <int>(Array.ConvertAll(dialogData.WeekendDays.Split(';'), int.Parse)) }; eventArgs.Session.UpdateContent(new ProgressDialog()); using (_dbContext = new WHTDbContext()) { if (_dbContext.YearMonths.Any(x => x.Year.Equals(tempYearMonth.Year) && x.Month.Equals(tempYearMonth.Month))) { _dbContext.Entry(tempYearMonth).State = System.Data.Entity.EntityState.Modified; } else { _dbContext.Entry(tempYearMonth).State = System.Data.Entity.EntityState.Added; } _dbContext.SaveChanges(); } Task.Delay(TimeSpan.FromSeconds(1)) .ContinueWith((t, _) => eventArgs.Session.Close(false), null, TaskScheduler.FromCurrentSynchronizationContext()); GetAndSetAllInfoFromDatabase(); NotifyOfPropertyChange(() => SelectedDate); }
private void AddCateDialogClosingEventHandler(object sender, DialogClosingEventArgs eventArgs) { if (eventArgs.Parameter is bool parameter && parameter == false) { return; } var tempIndex = this.SelectedIndex; using (var db = new CAKESTOREEntities()) { var newCate = this._categoryDialogViewModel.SelectedCakeType; db.CAKE_TYPE.Add(newCate); db.SaveChanges(); }; GetCakeCategories(tempIndex); MainWindowViewModel.Instance.GetAutocompleteSource(); }
/// <summary> /// 点击确认/取消 /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> private void ConfirExportRealEstateEventHandler(object sender, DialogClosingEventArgs eventArgs) { if ("False".Equals(eventArgs.Parameter.ToString())) { return; } // cancel the close eventArgs.Cancel(); var FileTextBox = eventArgs.Parameter as TextBox; String FullPath = FileTextBox.Text; // 开始导出 ExportRegistrationViewModel.FilePath = FullPath; ExportRegistrationViewModel.Project = Project; ExportRegistrationViewModel.ExportRegistrationCommand.Execute(); // 显示任务信息模态框 eventArgs.Session.UpdateContent(new TaskInfoDialog()); }
private async void DialogHost_DialogPersonClosing(object sender, DialogClosingEventArgs eventArgs) { if (!Equals(eventArgs.Parameter, true)) { return; } var gid = StringHelper.GetIdFromText(PersonGroupListBox.SelectedItem.ToString()).FirstOrDefault(); if (string.IsNullOrEmpty(gid)) { return; } if (!string.IsNullOrWhiteSpace(PersonName.Text)) { await FaceClient.PersonGroupPerson.CreateAsync(gid, PersonName.Text.Trim(), PersonData.Text.Trim()); } InitPersonListBox(gid); }
private void CloseDialog(object sender, DialogClosingEventArgs e) { DialogResult = e.DialogResult; }
/// <summary> /// Вызывает событие DialogClosing. /// </summary> protected virtual bool OnDialogClosing(DialogResult result) { if (_DialogClosing != null) { DialogClosingEventArgs args = new DialogClosingEventArgs(result); _DialogClosing.Raise(this, args); return args.Cancel; } return false; }
public void NotifyDialogClosed(DialogClosingEventArgs.ClosingActions action) { OnDialogClosed(this, new DialogClosingEventArgs { SelectedAction = action }); }