void ReactToFieldEditEnding(DataGridRow Row, IIdentifiableElement FieldDefinitor) { var Record = Row.Item as TableRecord; if (Record == null) { return; } object Value = Record.GetStoredValue(FieldDefinitor.TechName); //T Console.WriteLine("Edited: Item={0}, Field={1}, Value={2}", Row.Item, FieldDefinitor.TechName, Value); }
public FindAndReplaceDialog(bool CanReplace, IIdentifiableElement StartRoot) { this.CanReplace = CanReplace; this.DataContext = this; InitializeComponent(); if (!this.CanReplace) { this.LsvResults.SelectionMode = SelectionMode.Single; this.LsvResults.Cursor = Cursors.Hand; } }
//------------------------------------------------------------------------------------------ /// <summary> /// Tries to populate the Name and Tech-Name values from themselves and Summary. /// Returns indication of Name populated (either previously or automatically). /// </summary> public static bool AutoPopulate(this IIdentifiableElement Target) { if (Target.Name.IsAbsent() && !Target.TechName.IsAbsent()) { Target.Name = Target.TechName.IdentifierToText(); } else if (Target.TechName.IsAbsent() && !Target.Name.IsAbsent()) // Only happens explicitly setting Tech-Name as empty { Target.TechName = Target.Name.TextToIdentifier(); } else if (Target.Name.IsAbsent() && !Target.Summary.IsAbsent()) { Target.Name = Target.Summary.GetLeft(255).TextToIdentifier(); // Tech-Name is autopopulated } return(!Target.Name.IsAbsent()); }
public static Tuple <SimplePresentationElement, string> GetRelDefVariantRepresentation(string NamePrefix, IIdentifiableElement RelDefVariant, IDictionary <SimplePresentationElement, string> PlugDefs, Pen Pencil) { var PlugCode = PlugDefs.GetMatchingOrFirst((key, value) => key.TechName == RelDefVariant.TechName); var Result = Tuple.Create(new SimplePresentationElement("[" + NamePrefix + "] " + RelDefVariant.Name, RelDefVariant.TechName, RelDefVariant.Summary), PlugCode); var AreaWidth = MasterDrawer.BASE_WIDTH; var TargetPosition = MasterDrawer.SAMPLE_CONN_TARGET; var SourcePosition = new Point(TargetPosition.X + AreaWidth, TargetPosition.Y); var ShowEmptyPlugLine = (PlugCode == Plugs.None); var PlugDraw = PlugDrawer.CreatePlug(PlugCode, Pencil, TargetPosition, SourcePosition, 0.75, ShowEmptyPlugLine, ShowEmptyPlugLine).ToDrawingImage(); Result.Item1.Pictogram = PlugDraw; return(Result); }
// ----------------------------------------------------------------------------------------- public IList <FrameworkElement> CreateContentCard(IIdentifiableElement Source, DisplayCard DispCard) { var Result = new List <FrameworkElement>(); var BasicInfo = new DockPanel(); if (DispCard.PropName) { var Expositor = CreateContentCardPropertyExpositor(FormalPresentationElement.__Name.Name, Source.Name.RemoveNewLines(), this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); BasicInfo.Children.Add(Expositor); DockPanel.SetDock(Expositor, Dock.Top); } if (DispCard.PropTechName) { var Expositor = CreateContentCardPropertyExpositor(FormalPresentationElement.__TechName.Name, Source.TechName, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); BasicInfo.Children.Add(Expositor); DockPanel.SetDock(Expositor, Dock.Top); } if (DispCard.PropSummary) { var Expositor = CreateContentCardPropertyExpositor(FormalPresentationElement.__Summary.Name, Source.Summary, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); BasicInfo.Children.Add(Expositor); DockPanel.SetDock(Expositor, Dock.Top); } var MainInfo = new Grid(); var ColDef = new ColumnDefinition(); MainInfo.ColumnDefinitions.Add(ColDef); // new ColumnDefinition { Width = new GridLength(0.8, GridUnitType.Star) }); // MainInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.2, GridUnitType.Star) }); MainInfo.Children.Add(BasicInfo); Grid.SetColumn(BasicInfo, 0); if (DispCard.PropPictogram && Source is IRecognizableElement) { ColDef.Width = new GridLength(0.8, GridUnitType.Star); MainInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.2, GridUnitType.Star) }); var LocalPicture = this.CurrentWorker.AtOriginalThreadInvoke <ImageSource>( () => { var Picture = ((IRecognizableElement)Source).Pictogram; if (Picture == null) { if (Source is IdeaDefinition) { Picture = ((IdeaDefinition)Source).Pictogram; } else if (Source is Idea && ((Idea)Source).IdeaDefinitor.DefaultSymbolFormat.UseDefinitorPictogramAsNullDefault) { Picture = ((Idea)Source).IdeaDefinitor.Pictogram; } } if (Picture != null && !Picture.IsFrozen) { Picture.Freeze(); } return(Picture); }); var PictureExpositor = CreateContentCardPropertyExpositor(FormalPresentationElement.__Pictogram.Name, LocalPicture, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground, ReportConfiguration.PICTOGRAM_MAX_WIDTH, ReportConfiguration.PICTOGRAM_MAX_HEIGHT); MainInfo.Children.Add(PictureExpositor); Grid.SetColumn(PictureExpositor, 1); } // .......................................................... var IdInfo = new List <FrameworkElement>(); var DefinitorAndGlobalIdPanel = new DockPanel(); if (DispCard.PropGlobalId && Source is IUniqueElement) { var Expositor = CreateContentCardPropertyExpositor(UniqueElement.__GlobalId.Name, ((IUniqueElement)Source).GlobalId, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); DefinitorAndGlobalIdPanel.Children.Add(Expositor); DockPanel.SetDock(Expositor, Dock.Right); } if (DispCard.Definitor && Source is Idea) { var Expositor = CreateContentCardPropertyExpositor(((Idea)Source).BaseKind.Name, ((Idea)Source).IdeaDefinitor.Name, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); DefinitorAndGlobalIdPanel.Children.Add(Expositor); } if (DispCard.Definitor && Source is View) { var Expositor = CreateContentCardPropertyExpositor(View.__ClassDefinitor.Name, ((Idea)Source).IdeaDefinitor.Name, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); DefinitorAndGlobalIdPanel.Children.Add(Expositor); } if (DefinitorAndGlobalIdPanel.Children.Count > 0) { IdInfo.Add(DefinitorAndGlobalIdPanel); } if (DispCard.Route & Source is Idea) { var Route = ((Idea)Source).GetContainmentRoute(); var Expositor = CreateContentCardPropertyExpositor("Route", Route, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); IdInfo.Add(Expositor); } // .......................................................... var Extras = new List <FrameworkElement>(); if (DispCard.PropDescription && Source is IFormalizedElement) { var Element = (IFormalizedElement)Source; // Description if (!Element.Description.IsAbsent()) { var TextDocument = Display.XamlRichTextToFlowDocument(Element.Description); /*T var Range = new TextRange(TextDocument.ContentStart, TextDocument.ContentEnd); * var PlainText = Range.Text; */ var Expositor = CreateContentCardPropertyExpositor(FormalElement.__Description.Name, TextDocument, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); Extras.Add(Expositor); } // Classification (Pending) // Versioning if (Element.Version != null) { var VerPanel = new List <FrameworkElement>(); var VerInfo = new Grid(); VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.13, GridUnitType.Star) }); // Version Number VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.13, GridUnitType.Star) }); // Version Sequence VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.13, GridUnitType.Star) }); // Creation VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.24, GridUnitType.Star) }); // Creator VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.13, GridUnitType.Star) }); // Last Modification VerInfo.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.24, GridUnitType.Star) }); // Last Modifier var Expositor = CreateContentCardPropertyExpositor(VersionCard.__VersionNumber.Name, Element.Version.VersionNumber, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerInfo.Children.Add(Expositor); Grid.SetColumn(Expositor, 0); Expositor = CreateContentCardPropertyExpositor(VersionCard.__VersionSequence.Name, Element.Version.VersionSequence, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerInfo.Children.Add(Expositor); Grid.SetColumn(Expositor, 1); Expositor = CreateContentCardPropertyExpositor(VersionCard.__Creation.Name, Element.Version.Creation, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerInfo.Children.Add(Expositor); Grid.SetColumn(Expositor, 2); Expositor = CreateContentCardPropertyExpositor(VersionCard.__Creator.Name, Element.Version.Creator, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerInfo.Children.Add(Expositor); Grid.SetColumn(Expositor, 3); Expositor = CreateContentCardPropertyExpositor(VersionCard.__LastModification.Name, Element.Version.LastModification, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerInfo.Children.Add(Expositor); Grid.SetColumn(Expositor, 4); Expositor = CreateContentCardPropertyExpositor(VersionCard.__LastModifier.Name, Element.Version.LastModifier, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerInfo.Children.Add(Expositor); Grid.SetColumn(Expositor, 5); VerPanel.Add(VerInfo); if (!Element.Version.Annotation.IsAbsent()) { Expositor = CreateContentCardPropertyExpositor(VersionCard.__Annotation.Name, Element.Version.Annotation, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); VerPanel.Add(Expositor); } Extras.AddRange(VerPanel); } } if (DispCard.PropTechSpec && Source is ITechSpecifier) { var Element = (ITechSpecifier)Source; if (!Element.TechSpec.IsAbsent()) { var Expositor = CreateContentCardPropertyExpositor(FormalPresentationElement.__TechSpec.Name, Element.TechSpec, this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground); Extras.Add(Expositor); } } // .......................................................... Result.Add(MainInfo); Result.AddRange(IdInfo); Result.AddRange(Extras); return(Result); }
public static void Find(bool CanReplace, IIdentifiableElement StartRoot) { DialogOptionsWindow Dialog = null; Display.OpenContentDialogWindow <FindAndReplaceDialog>(ref Dialog, "Find", null, double.NaN, double.NaN, CanReplace, StartRoot); }