public override ValidationResult Validate(object value, CultureInfo cultureInfo) { Type t = (Type)value; if (t == null) { return(new ValidationResult(false, "Type has to be selected")); } return(new ValidationResult(true, null)); }
private void EditTypeCommand_Executed(object sender, ExecutedRoutedEventArgs e) { int toEdit = EnlargenedTypes.First(); Type m = this.Types.SingleOrDefault(x => x.Id == toEdit); EditType dialog = new EditType(m, this.EditTypeCallback); dialog.Owner = Application.Current.MainWindow; dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner; dialog.Height = 490; dialog.Width = 350; dialog.MinHeight = 420; dialog.MinWidth = 280; dialog.ShowDialog(); }
private void EditButton_Click(object sender, RoutedEventArgs e) { var obj = new models.Type(this.Id, this.TypeName, this.Icon, this.Description); EditType editTypeDialog = new emlekmu.EditType(obj, this.editTypeCallbackFun); MainWindow window = (MainWindow)Application.Current.MainWindow; if (window.MainContent.DemonAlive) { window.TypeSectionDemonDialog.EditTypeDemonDialog = editTypeDialog; } editTypeDialog.Height = 590; editTypeDialog.Width = 450; editTypeDialog.Owner = Application.Current.MainWindow; editTypeDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner; editTypeDialog.ShowDialog(); }
private void DeleteTypeCommand_Executed(object sender, ExecutedRoutedEventArgs e) { int toRemove = this.EnlargenedTypes.First(); MainContent mc = ((MainWindow)Application.Current.MainWindow).MainContent; List <Monument> conflicting = mc.typeConflictingMonuments(toRemove); if (conflicting == null) { AreYouSure ars = new AreYouSure("Are you sure you want to delete this type?"); ars.ShowDialog(); if (ars.DialogResult.HasValue && !ars.DialogResult.Value) { return; } } else { DeleteTypeDialog dtDialog = new DeleteTypeDialog(new ObservableCollection <Monument>(conflicting)); dtDialog.ShowDialog(); if (dtDialog.DialogResult.HasValue && dtDialog.DialogResult.Value) { mc.removeTypeAndMonuments(toRemove); } else { return; } } Type t = this.Types.SingleOrDefault(x => x.Id == toRemove); this.RemoveTypeCallback(toRemove); this.EnlargenedTypes.Remove(toRemove); }