/// <summary> /// Exposes to the user a data editor, for the the supplied Detail Table, Designator and Custom-Look, and returns indication of change. /// </summary> public static bool Edit(Table DetailTable, TableDetailDesignator Designator, TableAppearance CustomLook = null, bool ForceSingleRecord = false) { if (DetailTable.Definition.FieldDefinitions.Count < 1) { if (Display.DialogMessage("Warning!", "No declared fields in the '" + DetailTable.Definition.Name + "' Table-Structure.\n\n" + "Do you want to declare them for " + (Designator.Owner.IsGlobal ? "all Ideas of type '" : "the Idea '") + ((IIdentifiableElement)Designator.Owner.Owner).Name + "' ?", EMessageType.Warning, MessageBoxButton.YesNo) != MessageBoxResult.Yes) { return(false); } var EditResult = DomainServices.EditDetailDesignator(Designator, Designator.Owner.IsGlobal, Designator.EditEngine); if (!EditResult.Item1.IsTrue()) { return(false); } } var WorkTable = DetailTable.CreateClone(ECloneOperationScope.Deep, null); var Editor = new DetailTableEditor(WorkTable, Designator, CustomLook.NullDefault(new TableAppearance()), ForceSingleRecord); DialogOptionsWindow EditingWindow = null; // Do not declare as static to allow multiple dialogs open! var Changed = Display.OpenContentDialogWindow <DetailTableEditor>(ref EditingWindow, "Edit data of table '" + WorkTable.Designation.Name + "'", Editor).IsTrue(); if (Editor.ApplyChanges) { DetailTable.UpdateContentFrom(WorkTable); } return(Editor.ApplyChanges); //? || Changed); }
private void DetailsToolPanel_EditClicked(object arg1, RoutedEventArgs arg2) { if (!this.DetailsListBox.HasItems || !this.DetailsListBox.SelectedIndex.IsInRange(0, this.DetailsListBox.Items.Count)) { return; } var SelectedDefCard = this.DetailsListBox.SelectedItem as DetailDefinitionCard; if (SelectedDefCard == null) { return; } /*- if (!ProductDirector.ConfirmImmediateApply("Detail Designator", "IdeaEditing.DetailDesignatorEdit", "ApplyDialogChangesDirectly")) * return; */ SelectedDefCard.Designator.Value.Name = SelectedDefCard.Name; var EditResult = DomainServices.EditDetailDesignator(SelectedDefCard.Designator.Value, true, this.SourceEngine); if (EditResult.Item1.IsTrue()) { SelectedDefCard.Name = SelectedDefCard.Designator.Value.Name; SelectedDefCard.Summary = SelectedDefCard.Designator.Value.Summary; } }
private void BtnEditDesignator_Click(object sender, RoutedEventArgs e) { var Row = (sender is ListBoxItem ? (ListBoxItem)sender : ((FrameworkElement)e.OriginalSource).GetNearestVisualDominantOfType <ListBoxItem>(true)); if (Row == null || Row.Content == null) { return; } var SelectedEditCard = Row.Content as DetailEditingCard; if (SelectedEditCard == null) { return; } /*? if (!ProductDirector.ConfirmImmediateApply("Detail Designator", "IdeaEditing.DetailDesignatorEdit", "ApplyDialogChangesDirectly")) * return; */ SelectedEditCard.Designator.Value.Name = SelectedEditCard.Name; var EditResult = DomainServices.EditDetailDesignator(SelectedEditCard.Designator.Value, false, this.SourceEngine, true); if (EditResult.Item1.IsTrue()) { SelectedEditCard.Name = SelectedEditCard.Designator.Value.Name; SelectedEditCard.Summary = SelectedEditCard.Designator.Value.Summary; if (EditResult.Item2 != null && SelectedEditCard.Designator.Value is TableDetailDesignator) { var DetailTable = SelectedEditCard.DetailContent as Table; if (DetailTable != null) { Table.UpdateTableFrom(DetailTable, EditResult.Item2); } else { DetailTable = Table.CreateTableFrom(SelectedEditCard.Designator, EditResult.Item2, SourceIdea); SelectedEditCard.DetailContent = DetailTable; SelectedEditCard.DetailContent.UpdateDesignatorIdentification(); SelectedEditCard.SetContent(); // Not needed? this.SourceIdea.Details.AddNew(DetailTable); } } } }