/// <summary> /// Opens the entity related view from content, view-instance and other parameters. /// </summary> protected bool?OpenView <TForm>(TForm Content, IEntityView ViewInstance, string Title, bool OpenAsDialog = false, Window Owner = null, double InitialWidth = double.NaN, double InitialHeight = double.NaN) where TForm : UIElement { bool?Result = null; this.ViewInstance = ViewInstance; DialogOptionsWindow Dialog = null; if (OpenAsDialog) { Result = Display.OpenContentDialogWindow <TForm>(ref Dialog, Title, Content, InitialWidth, InitialHeight); } else { Display.OpenContentWindow <TForm>(ref this.ViewWindow_, Content, Title, Owner); if (this.ViewWindow_ != null) { this.ViewWindow_.Width = InitialWidth; this.ViewWindow_.Height = InitialHeight; } } return(Result); }
/// <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); }
public static void ShowGenerationFilePreview(Idea Source) { if (Source == null || Source.EditEngine == null) { return; } if (!ProductDirector.ValidateEditionPermission(AppExec.LIC_EDITION_PROFESSIONAL, "Generate Files", false, new DateTime(2013, 6, 22))) { return; } try { EntityEditEngine.ActiveEntityEditor.ReadTechNamesAsProgramIdentifiers = Source.OwnerComposition.CompositeContentDomain.GenerationConfiguration.UseTechNamesAsProgramIdentifiers;; var Language = Source.IdeaDefinitor.OwnerDomain.ExternalLanguages.FirstOrDefault() .NullDefault(Source.IdeaDefinitor.OwnerDomain.CurrentExternalLanguage); if (Source.IdeaDefinitor.OwnerDomain.ExternalLanguages.Count > 1) { var LangTechName = Display.DialogMultiOption("Language selection", "Select the Language used to generate the preview", null, null, true, Source.IdeaDefinitor.OwnerDomain.CurrentExternalLanguage.TechName, Source.IdeaDefinitor.OwnerDomain.ExternalLanguages.ToArray()); if (LangTechName.IsAbsent()) { return; } Language = Source.IdeaDefinitor.OwnerDomain.ExternalLanguages.First(lang => lang.TechName == LangTechName); Source.IdeaDefinitor.OwnerDomain.CurrentExternalLanguage = Language; } var Preview = FileGenerator.GenerateFilePreview(Source, Language); DialogOptionsWindow GenDialog = null; var Previewer = new FileGenerationPreviewer(Preview.FileName, Preview.GeneratedText); Display.OpenContentDialogWindow(ref GenDialog, "Generate from: " + Source.Name, Previewer, 600, 700); } catch (Exception Problem) { Display.DialogMessage("Error!", "Cannot generate preview from the supplied Template and source object.\n\nProblem: " + Problem.Message, EMessageType.Warning); return; } finally { EntityEditEngine.ActiveEntityEditor.ReadTechNamesAsProgramIdentifiers = false; } }
public static Idea TestTemplate(Type ExpectedSourceIdeaKind, IdeaDefinition ExpectedSourceIdeaDefinition, string SourceTemplateName, string SourceTemplateText, Composition SourceComposition, Idea SourceIdea = null, bool CanSelectSource = true) { DialogOptionsWindow Dialog = null; var TemplateEd = new TemplateTester(ExpectedSourceIdeaKind, ExpectedSourceIdeaDefinition, SourceTemplateText, SourceComposition, SourceIdea, CanSelectSource); Display.OpenContentDialogWindow(ref Dialog, "Test of " + SourceTemplateName, TemplateEd, 600, 750); return(TemplateEd.SourceIdea); }
// ----------------------------------------------------------------------------------------- /// <summary> /// Shows a dialog window for select or enter a link, starting from a supplied designator, idea and initial target. /// Returns the new selected link, or null if cancelled. /// </summary> public static Link ShowDialog(string Title, Assignment <DetailDesignator> /*L*/ Designator, Idea TargetIdea, Link InitialTarget = null) { DialogOptionsWindow EditingWindow = null; var Editor = new DetailLinkEditor(Title, InitialTarget, Designator, TargetIdea); var Result = Display.OpenContentDialogWindow <DetailLinkEditor>(ref EditingWindow, "Edit Link", Editor); if (Result.IsTrue()) { return(Editor.SelectedLinkTarget); } return(null); }
// ----------------------------------------------------------------------------------------- public static void Edit(DocumentEngine Engine, MModelPropertyDefinitor Property, Idea TargetIdea) { Engine.StartCommandVariation("Edit Internal Property"); DialogOptionsWindow EditingWindow = null; var Editor = new DetailInternalPropertyEditor("Edit internal property...", Property, TargetIdea); var Changed = Display.OpenContentDialogWindow <DetailInternalPropertyEditor>(ref EditingWindow, "Edit Property", Editor); if (Changed.IsTrue()) { TargetIdea.UpdateVersion(); Engine.CompleteCommandVariation(); } else { Engine.DiscardCommandVariation(); } }
/// <summary> /// Allows the user to select a Domain for create a new Composition. /// Returns the Domain Location plus indication of use Domain Composition as template (else empty). /// </summary> public static Tuple <Uri, bool> SelectDomain(string SourceFolder, string Title = null, bool ShowUseTemplate = true) { DialogOptionsWindow Dialog = null; DisplayUseTemplate = ShowUseTemplate; Folder = SourceFolder; Location = null; UseTemplate = false; if (!Display.OpenContentDialogWindow <DomainSelector>(ref Dialog, Title.NullDefault("Select Domain...")).IsTrue()) { return(null); } var Result = Tuple.Create(Location, UseTemplate); return(Result); }
public static void ShowAppVersionUpdate(string VersionFileText = null) { DialogOptionsWindow Dialog = null; Display.OpenContentDialogWindow <AppVersionUpdate>(ref Dialog, "Version Update", null, double.NaN, double.NaN, VersionFileText); }
/// <summary> /// Shows the product "Options" dialog. /// </summary> public static void EditOptions() { DialogOptionsWindow Dialog = null; Display.OpenContentDialogWindow <AppOptions>(ref Dialog, "Options..."); }
/// <summary> /// Shows the Help content. /// </summary> public static void ShowHelp() { DialogOptionsWindow Dialog = null; Display.OpenContentDialogWindow <AppHelp>(ref Dialog, "Help..."); }
// ------------------------------------------------------------------------------------------------------------- /// <summary> /// Shows the product "About" dialog. /// </summary> public static void ShowAbout() { DialogOptionsWindow Dialog = null; Display.OpenContentDialogWindow <About>(ref Dialog, "About..."); }
public static bool FieldDefinitionEdit(TableDefinition OwnerTableDef, IList <FieldDefinition> EditedList, FieldDefinition FieldDef) { var InstanceController = EntityInstanceController.AssignInstanceController(FieldDef); InstanceController.StartEdit(); var ExtraControls = new List <UIElement>(); MModelPropertyDefinitor ExposedProperty = null; // Declare expositor for hidden field var HideInDiagramExpositor = new EntityPropertyExpositor(FieldDefinition.__HideInDiagram.TechName); HideInDiagramExpositor.LabelMinWidth = 90; // Declare expositor for available values-sources var AvailableValuesSourcesExpositor = new EntityPropertyExpositor(); ExposedProperty = FieldDefinition.__ValuesSource; AvailableValuesSourcesExpositor.ExposedProperty = ExposedProperty.TechName; AvailableValuesSourcesExpositor.LabelMinWidth = 90; AvailableValuesSourcesExpositor.IsEnabled = (FieldDef.FieldType is NumberType || FieldDef.FieldType.IsOneOf(DataType.DataTypeTableRecordRef, DataType.DataTypeText)); // Initial setting // Declare expositor for available Ideas var IdeaReferencingPropertyExpositor = new EntityPropertyExpositor(); ExposedProperty = FieldDefinition.__IdeaReferencingProperty; IdeaReferencingPropertyExpositor.ExposedProperty = ExposedProperty.TechName; IdeaReferencingPropertyExpositor.LabelMinWidth = 90; IdeaReferencingPropertyExpositor.SetAvailable(FieldDef.FieldType.IsOneOf(DataType.DataTypeIdeaRef, DataType.DataTypeText)); // Initial setting // Declare button for table-definition assignation button var TableDefAssignationPanel = new StackPanel(); // TableDefAssignationPanel.Orientation = Orientation.Horizontal; var TableDefAssignSingleRecordCbx = new EntityPropertyExpositor(FieldDefinition.__ContainedTableIsSingleRecord.TechName); TableDefAssignSingleRecordCbx.LabelMinWidth = 90; /* var TableDefAssignSingleRecordCbx = new CheckBox(); * TableDefAssignSingleRecordCbx.Content = FieldDefinition.__ContainedTableIsSingleRecord.Name; // "Is Single-Record"; * TableDefAssignSingleRecordCbx.ToolTip = FieldDefinition.__ContainedTableIsSingleRecord.Summary; * TableDefAssignSingleRecordCbx.FontSize = 8; * TableDefAssignSingleRecordCbx.Margin = new Thickness(2); */ TableDefAssignSingleRecordCbx.IsEnabled = FieldDef.FieldType.IsEqual(DataType.DataTypeTable); var TableDefAssignationButtonArea = new StackPanel(); TableDefAssignationButtonArea.Orientation = Orientation.Horizontal; var TableDefAssignationButtonPrefix = new TextBlock(); TableDefAssignationButtonPrefix.Text = "Table-Structure"; TableDefAssignationButtonPrefix.TextAlignment = TextAlignment.Right; TableDefAssignationButtonPrefix.FontSize = 10; TableDefAssignationButtonPrefix.Width = 90; TableDefAssignationButtonPrefix.Margin = new Thickness(0, 6, 2, 2); TableDefAssignationButtonPrefix.SetAvailable(FieldDef.FieldType == DataType.DataTypeTable); // Initial setting var TableDefAssignationButton = new PaletteButton("Definition...", Display.GetAppImage("table.png")); TableDefAssignationButton.Margin = new Thickness(2 /*45*/, 2, 2, 2); TableDefAssignationButton.IsEnabled = FieldDef.FieldType.IsEqual(DataType.DataTypeTable); TableDefAssignationButtonArea.Children.Add(TableDefAssignationButtonPrefix); TableDefAssignationButtonArea.Children.Add(TableDefAssignationButton); TableDefAssignationButton.Click += ((sender, args) => { var DsnName = OwnerTableDef.Name + " - " + FieldDef.Name; if (FieldDef.ContainedTableDesignator == null) { var ContainedTableDef = new TableDefinition(OwnerTableDef.OwnerDomain, DsnName, DsnName.TextToIdentifier()); FieldDef.ContainedTableDesignator = new TableDetailDesignator(Ownership.Create <IdeaDefinition, Idea>(OwnerTableDef.OwnerDomain), ContainedTableDef, true /* Very important! */, DsnName, DsnName.TextToIdentifier(), "", null, FieldDef); } else if (FieldDef.ContainedTableDesignator.Name != DsnName) { FieldDef.ContainedTableDesignator.Name = DsnName; FieldDef.ContainedTableDesignator.TechName = DsnName.TextToIdentifier(); } var TableDefAssigner = new TableDetailDesignatorStructSubform(FieldDef.ContainedTableDesignator, null, true); DialogOptionsWindow TableDesfAssignationWindow = null; // Do not move outside this lambda OwnerTableDef.EditEngine.StartCommandVariation("Edit Field-Definition type assignment of Table-Structure Definition"); var Response = Display.OpenContentDialogWindow(ref TableDesfAssignationWindow, "Table-Structure for Field '" + FieldDef.Name + "'", TableDefAssigner); OwnerTableDef.EditEngine.CompleteCommandVariation(); if (Response.IsTrue()) { FieldDef.ContainedTableDesignator.DeclaringTableDefinition.AlterStructure(); } else { OwnerTableDef.EditEngine.Undo(); } }); // Declare expositor for field-type var FieldTypeExpositor = new EntityPropertyExpositor(); ExposedProperty = FieldDefinition.__FieldType; FieldDef.PropertyChanged += ((sender, args) => { if (args.PropertyName != FieldDefinition.__FieldType.TechName || FieldDef.FieldType == null) { return; } // Postcalls to be applied after the load initialization. var CanSelectValues = (FieldDef.FieldType is NumberType || FieldDef.FieldType.IsOneOf(DataType.DataTypeTableRecordRef, DataType.DataTypeText)); AvailableValuesSourcesExpositor.PostCall( expo => { expo.SetAvailable(CanSelectValues); if (!CanSelectValues) { FieldDef.ValuesSource = null; } }); var CanSelectIdeas = FieldDef.FieldType.IsOneOf(DataType.DataTypeIdeaRef, DataType.DataTypeText); IdeaReferencingPropertyExpositor.PostCall( expo => { expo.SetAvailable(CanSelectIdeas); if (!CanSelectIdeas) { FieldDef.IdeaReferencingProperty = null; } }); var CanAssignTableDef = FieldDef.FieldType.IsEqual(DataType.DataTypeTable); TableDefAssignationButton.PostCall( ctrl => { // ctrl.SetAvailable(CanAssignTableDef); ctrl.IsEnabled = CanAssignTableDef; /* Cancelled (better is to save user's data)... * if (!CanAssignTableDef) * { * FieldDef.DeclaringTableDefinition = null; * FieldDef.DeclaringTableDefIsOwned = false; * } */ }); TableDefAssignSingleRecordCbx.PostCall(ctrl => ctrl.IsEnabled = CanAssignTableDef); }); FieldTypeExpositor.ExposedProperty = ExposedProperty.TechName; FieldTypeExpositor.LabelMinWidth = 90; // Add the just created extra controls ExtraControls.Add(HideInDiagramExpositor); ExtraControls.Add(FieldTypeExpositor); ExtraControls.Add(AvailableValuesSourcesExpositor); ExtraControls.Add(IdeaReferencingPropertyExpositor); TableDefAssignationPanel.Children.Add(TableDefAssignationButtonArea); // POSTPONED: TableDefAssignationPanel.Children.Add(TableDefAssignSingleRecordCbx); ExtraControls.Add(TableDefAssignationPanel); var Result = InstanceController.Edit(Display.CreateEditPanel(FieldDef, null, true, null, null, true, false, false, true, ExtraControls.ToArray()), "Edit Field Definition - " + FieldDef.ToString(), InitialWidth: 700).IsTrue(); 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); }