コード例 #1
0
        public static RelationshipDefinition RelationshipDefinitionCreate(Domain OwnerEntity, IList <RelationshipDefinition> EditedList)
        {
            if (!ProductDirector.ValidateEditionPermission(AppExec.LIC_EDITION_FREE, "create Relationship Definitions"))
            {
                return(null);
            }

            var ItemsCount = OwnerEntity.ConceptDefinitions.Count + EditedList.Count;
            var MaxQuota   = AppExec.CurrentLicenseEdition.TechName.SelectCorresponding(LicensingConfig.IdeaDefinitionsCreationQuotas);

            if (!ProductDirector.ValidateEditionLimit(ItemsCount + 1, MaxQuota, "create", "Idea Definitions (Concept Defs. + Relationship Defs.)"))
            {
                return(null);
            }

            int    NewNumber = EditedList.Count + 1;
            string NewName   = "RelationshipDef" + NewNumber.ToString();
            var    Definitor = new RelationshipDefinition(OwnerEntity, Domain.GenericRelationshipDefinition,
                                                          NewName, NewName.TextToIdentifier(), Shapes.Ellipse);

            if (RelationshipDefinitionEdit(OwnerEntity, EditedList, Definitor))
            {
                return(Definitor);
            }

            return(null);
        }
コード例 #2
0
        private void DetailsToolPanel_AddClicked(object arg1, RoutedEventArgs arg2)
        {
            /*- if (!ProductDirector.ConfirmImmediateApply("IdeaEditing.DetailAdd", "ApplyDialogChangesDirectly"))
             *      return; */

            var DetailOptions = new List <IRecognizableElement>();

            DetailOptions.Add(new SimplePresentationElement(AttachmentDetailDesignator.KindTitle, AttachmentDetailDesignator.KindName, AttachmentDetailDesignator.KindSummary, AttachmentDetailDesignator.KindPictogram));
            DetailOptions.Add(new SimplePresentationElement(LinkDetailDesignator.KindTitle, LinkDetailDesignator.KindName, LinkDetailDesignator.KindSummary, LinkDetailDesignator.KindPictogram));

            if (ProductDirector.ValidateEditionPermission(AppExec.LIC_EDITION_LITE, "designate Table detail", false))
            {
                DetailOptions.Add(new SimplePresentationElement(TableDetailDesignator.KindTitle, TableDetailDesignator.KindName, TableDetailDesignator.KindSummary, TableDetailDesignator.KindPictogram));
            }

            var DetailToCreate = Display.DialogMultiOption("Designation of Detail", "Select the type of detail to be designated...", "",
                                                           null, true, TableDetailDesignator.KindName, DetailOptions.ToArray());

            if (DetailToCreate == null)
            {
                return;
            }

            var SelectedDetailOption         = DetailOptions.FirstOrDefault(det => det.TechName == DetailToCreate);
            var DesignationName              = SelectedDetailOption.Name + " - Detail Definition " + (this.DetailsSource.Count + 1).ToString();
            DetailDefinitionCard NewEditCard = null;
            var Owner = Ownership.Create <IdeaDefinition, Idea>(this.SourceDefinitor);

            DetailDesignator CreatedDesignation = null;

            if (DetailToCreate == TableDetailDesignator.KindName)
            {
                CreatedDesignation = DomainServices.CreateTableDesignation(this.SourceEngine, Owner, DesignationName);
            }
            else
            if (DetailToCreate == AttachmentDetailDesignator.KindName)
            {
                CreatedDesignation = DomainServices.CreateAttachmentDesignation(Owner, DesignationName);
            }
            else
            if (DetailToCreate == LinkDetailDesignator.KindName)
            {
                CreatedDesignation = DomainServices.CreateLinkDesignation(Owner, DesignationName);
            }

            if (CreatedDesignation == null)
            {
                return;
            }

            NewEditCard = new DetailDefinitionCard(false, new Assignment <DetailDesignator>(CreatedDesignation, this.DetailsSourceIsGlobal));

            this.DetailsSource.Add(NewEditCard);
            this.DetailsListBox.SelectedItem = NewEditCard;
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
        public static void GenerateGlobalFiles(Composition Source)
        {
            if (Source == null || Source.EditEngine == null)
            {
                return;
            }

            if (!ProductDirector.ValidateEditionPermission(AppExec.LIC_EDITION_PROFESSIONAL, "Generate Files", false, new DateTime(2013, 6, 22)))
            {
                return;
            }

            if (!GenerationManager.ConfigureAndStartGeneration(Source.OwnerComposition))
            {
                return;
            }

            var Title = "File Generation from " + Source.Name;

            var Generator = new FileGenerator(Source.OwnerComposition, Source.OwnerComposition.CompositeContentDomain.CurrentExternalLanguage,
                                              Source.IdeaDefinitor.OwnerDomain.GenerationConfiguration);

            EntityEditEngine.ActiveEntityEditor.ReadTechNamesAsProgramIdentifiers =
                Source.CompositeContentDomain.GenerationConfiguration.UseTechNamesAsProgramIdentifiers;;

            var Started = ProgressiveThreadedExecutor <int> .Execute(Title, Generator.Generate,
                                                                     (opresult) =>
            {
                EntityEditEngine.ActiveEntityEditor.ReadTechNamesAsProgramIdentifiers = false;

                if (!opresult.WasSuccessful)
                {
                    Display.DialogMessage("Generation not completed!", opresult.Message, EMessageType.Warning);
                    return;
                }

                if (opresult.Message != null)
                {
                    Console.WriteLine(opresult.Message);
                }

                Display.DialogMessage("Generation completed", opresult.Message.AbsentDefault("File Generation successfully executed."));
            });

            if (!Started)
            {
                EntityEditEngine.ActiveEntityEditor.ReadTechNamesAsProgramIdentifiers = false;
            }
        }
コード例 #5
0
        public static ExternalLanguageDeclaration ExternalLanguageCreate(Domain OwnerEntity, IList <ExternalLanguageDeclaration> EditedList)
        {
            if (!ProductDirector.ValidateEditionPermission(AppExec.LIC_EDITION_PROFESSIONAL, "create External Languages declarations"))
            {
                return(null);
            }

            int    NewNumber = EditedList.Count + 1;
            string NewName   = "ExternalLanguage" + NewNumber.ToString();
            var    Definitor = new ExternalLanguageDeclaration(NewName, NewName.TextToIdentifier());

            if (ExternalLanguageEdit(OwnerEntity, EditedList, Definitor))
            {
                return(Definitor);
            }

            return(null);
        }
コード例 #6
0
        public static SimplePresentationElement VariantDefinitionCreate(Domain OwnerEntity, IList <SimplePresentationElement> EditedList)
        {
            if (!ProductDirector.ValidateEditionPermission(AppExec.LIC_EDITION_PROFESSIONAL, "create Link-Role Variant Definitions"))
            {
                return(null);
            }

            int    NewNumber = EditedList.Count + 1;
            string NewName   = "VariantDef" + NewNumber.ToString();
            var    Definitor = new SimplePresentationElement(NewName, NewName.TextToIdentifier());

            if (VariantDefinitionEdit(OwnerEntity, EditedList, Definitor))
            {
                return(Definitor);
            }

            return(null);
        }
コード例 #7
0
        public static TableDefinition TableDefinitionCreate(Domain OwnerEntity, IList <TableDefinition> EditedList)
        {
            if (!ProductDirector.ValidateEditionPermission(AppExec.LIC_EDITION_PROFESSIONAL, "create Table-Structure Definitions"))
            {
                return(null);
            }

            int    NewNumber = EditedList.Count + 1;
            string NewName   = "TableDef" + NewNumber.ToString();
            var    Definitor = new TableDefinition(OwnerEntity, NewName, NewName.TextToIdentifier());

            if (TableDefinitionEdit(OwnerEntity, EditedList, Definitor))
            {
                return(Definitor);
            }

            return(null);
        }
コード例 #8
0
        public static MarkerDefinition MarkerDefinitionCreate(Domain OwnerEntity, IList <MarkerDefinition> EditedList)
        {
            if (!ProductDirector.ValidateEditionPermission(AppExec.LIC_EDITION_LITE, "create Marker Definitions"))
            {
                return(null);
            }

            int    NewNumber = EditedList.Count + 1;
            string NewName   = "MarkerDef" + NewNumber.ToString();
            var    Definitor = new MarkerDefinition(NewName, NewName.TextToIdentifier(), "", Display.GetAppImage("rosette.png"));

            if (MarkerDefinitionEdit(OwnerEntity, EditedList, Definitor))
            {
                return(Definitor);
            }

            return(null);
        }
コード例 #9
0
        public static void GeneratePdfXpsReport(CompositionEngine Engine)
        {
            if (Engine == null)
            {
                return;
            }

            if (!ProductDirector.ValidateEditionPermission(AppExec.LIC_EDITION_STANDARD, "Generate PDF/XPS Report"))
            {
                return;
            }

            if (Engine.TargetComposition.CompositeContentDomain.ReportingConfiguration == null)
            {
                Engine.TargetComposition.CompositeContentDomain.ReportingConfiguration = new ReportConfiguration();
            }

            if (!ReportingManager.EditReportConfiguration("PDF/XPS", Engine.TargetComposition.CompositeContentDomain.ReportingConfiguration))
            {
                return;
            }

            var Generator = new ReportStandardGenerator(Engine.TargetComposition, Engine.TargetComposition.CompositeContentDomain.ReportingConfiguration);

            var Title = "Report of " + Engine.TargetComposition.Name;

            ProgressiveThreadedExecutor <int> .Execute("Generating " + Title, Generator.Generate,
                                                       (opresult) =>
            {
                if (opresult.WasSuccessful && !File.Exists(Generator.GeneratedDocumentTempFilePath))
                {
                    opresult = OperationResult.Failure <int>("Cannot write temporal report file at: " + Generator.GeneratedDocumentTempFilePath);
                }

                if (!opresult.WasSuccessful)
                {
                    Display.DialogMessage("Report not completed!", opresult.Message, EMessageType.Warning);
                    return;
                }

                try
                {
                    var GeneratedDocument = Display.LoadDocumentFromXPS(Generator.GeneratedDocumentTempFilePath);
                    var Location          = new Uri(Generator.GeneratedDocumentTempFilePath, UriKind.Absolute);
                    var Package           = System.IO.Packaging.PackageStore.GetPackage(Location);

                    DocViewerControl = new PrintPreviewer(GeneratedDocument, Generator.GeneratedDocumentTempFilePath,
                                                          Engine.TargetComposition.Name);

                    Display.OpenContentDialogWindow(ref WinFlowDocViewer, Title, DocViewerControl);

                    Package.Close();        // Package remains open, so must closed!
                    //if you don't remove the package from the PackageStore, you won't be able to
                    //re-open the same file again later (due to System.IO.Packaging's Package store/caching
                    //rather than because of any file locks)
                    System.IO.Packaging.PackageStore.RemovePackage(Location);

                    if (File.Exists(Generator.GeneratedDocumentTempFilePath))
                    {
                        File.Delete(Generator.GeneratedDocumentTempFilePath);
                    }
                }
                catch (Exception Problem)
                {
                    Display.DialogMessage("Attention!", "Cannot show generated Report.\n"
                                          + (!Generator.GeneratedDocumentTempFilePath.IsAbsent() && File.Exists(Generator.GeneratedDocumentTempFilePath)
                                                 ? "It can still be found at: " + Generator.GeneratedDocumentTempFilePath : "")
                                          + "\nProblem: " + Problem.Message);
                }
            });
        }
コード例 #10
0
        public static void GenerateHtmlReport(CompositionEngine Engine)
        {
            if (Engine == null)
            {
                return;
            }

            if (!ProductDirector.ValidateEditionPermission(AppExec.LIC_EDITION_STANDARD, "Generate HTML Report", false, new DateTime(2013, 1, 1)))
            {
                return;
            }

            if (Engine.TargetComposition.CompositeContentDomain.ReportingConfiguration == null)
            {
                Engine.TargetComposition.CompositeContentDomain.ReportingConfiguration = new ReportConfiguration();
            }

            if (!ReportingManager.EditReportConfiguration("HTML", Engine.TargetComposition.CompositeContentDomain.ReportingConfiguration))
            {
                return;
            }

            var FilePath       = Path.Combine(AppExec.UserDataDirectory, (Engine.TargetComposition.TechName + ".html").TextToUrlIdentifier());
            var DialogResponse = Display.DialogGetSaveFile("Select HTML file to create", ".html", "HTML document (*.html)|*.html", FilePath);

            if (DialogResponse == null)
            {
                return;
            }

            // Enforce url-identifier to avoid file-names with space in between.
            var Location = Path.Combine(Path.GetDirectoryName(DialogResponse.LocalPath),
                                        Path.GetFileName(DialogResponse.LocalPath).TextToUrlIdentifier());

            var WarnResponse = Display.DialogPersistableMultiOption("Note", "Your HTML Document is generated along with a '" + ReportHtmlGenerator.CONTENT_FOLDER_SUFFIX + "' directory.\n" +
                                                                    "Please don't forget to manage (copy/move/erase) them together to keep consistency." +
                                                                    (Location == DialogResponse.LocalPath ? ""
                                                                             : "\n\nThe file will be saved as '" + Path.GetFileName(Location) + "'."),
                                                                    null, "Reporting", "InformHTMLContentDir", null,
                                                                    new SimplePresentationElement("OK", "Ok", "", Display.GetAppImage("accept.png")));

            if (WarnResponse == null)
            {
                return;
            }

            var Title = "HTML Report of " + Engine.TargetComposition.Name;

            var Generator = new ReportHtmlGenerator(Engine.TargetComposition, Location,
                                                    Engine.TargetComposition.CompositeContentDomain.ReportingConfiguration);

            ProgressiveThreadedExecutor <int> .Execute("Generating " + Title, Generator.Generate,
                                                       (opresult) =>
            {
                if (opresult.WasSuccessful && !File.Exists(Generator.GeneratedTempWorkingDocumentFile))
                {
                    opresult = OperationResult.Failure <int>("Cannot write temporal report file at: " + Generator.GeneratedTempWorkingDocumentFile);
                }

                if (!opresult.WasSuccessful)
                {
                    Display.DialogMessage("Report not completed!", opresult.Message, EMessageType.Warning);
                    return;
                }

                try
                {
                    var TargetFolder = Path.GetDirectoryName(Location);
                    General.CopyDirectory(Generator.GeneratedTempWorkingDocumentDir, TargetFolder);

                    AppExec.CallExternalProcess(Location);

                    if (File.Exists(Generator.GeneratedTempWorkingDocumentFile))
                    {
                        File.Delete(Generator.GeneratedTempWorkingDocumentFile);
                    }

                    if (Directory.Exists(Generator.GeneratedTempWorkingDocumentDir))
                    {
                        Directory.Delete(Generator.GeneratedTempWorkingDocumentDir, true);
                    }
                }
                catch (Exception Problem)
                {
                    Display.DialogMessage("Attention!", "Cannot show generated Report.\n"
                                          + (!Generator.GeneratedTempWorkingDocumentFile.IsAbsent() && File.Exists(Generator.GeneratedTempWorkingDocumentFile)
                                                 ? "It can be still found at: " + Generator.GeneratedTempWorkingDocumentFile : "")
                                          + "\nProblem: " + Problem.Message);
                }
            });
        }