/// <summary>
 /// Initializes a new instance of the <see cref="ConfigurationApplicationServiceFile"/> class.
 /// </summary>
 public ConfigurationApplicationServiceFile()
 {
     Logger.Trace($"Started ConfigurationAplicationServiceFile()");
     ApplicationSettings    = new ApplicationSettings();
     FilePersistenceOptions = new FilePersistenceOptions();
     Logger.Trace($"Completed ConfigurationAplicationServiceFile()");
 }
예제 #2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ProjectDefinitionApplicationServiceFile" /> class.
 /// </summary>
 public ProjectDefinitionApplicationServiceFile()
 {
     Logger.Trace($"Started ProjectDefinitionApplicationServiceFile()");
     ProjectDefinition      = new ProjectDefinition();
     FilePersistenceOptions = new FilePersistenceOptions();
     Logger.Trace($"Completed ProjectDefinitionApplicationServiceFile()");
 }
예제 #3
0
        /// <summary>
        ///     The load data.
        /// </summary>
        private void LoadData()
        {
            if (!string.IsNullOrEmpty(this.ModelPath) && !string.IsNullOrEmpty(this.ConfigPath))
            {
                FilePersistenceOptions options = new FilePersistenceOptions {
                    Path = this.ModelPath
                };

                this.applicationService =
                    new ProjectDefinitionApplicationServiceFile {
                    FilePersistenceOptions = options
                };
                this.applicationService.Load();
                this.applicationService.ProjectDefinition.ModelPath = options.Path;
                this.applicationService.ProjectDefinition.Version   = 1;

                FilePersistenceOptions configOptions = new FilePersistenceOptions {
                    Path = this.ConfigPath
                };
                this.applicationConfiguration =
                    new ConfigurationApplicationServiceFile {
                    FilePersistenceOptions = configOptions
                };

                this.applicationConfiguration.Load();

                this.TemplateManagementUserControl1.DataSource =
                    this.applicationConfiguration.ApplicationSettings.Templates[0];
                this.ManagePackageUserControl1.DataSource =
                    this.applicationConfiguration.ApplicationSettings.Packages[0];

                if (this.applicationConfiguration.ApplicationSettings.Templates.Count > 0)
                {
                    this.ManagePackageUserControl1.Templates =
                        this.applicationConfiguration.ApplicationSettings.Templates;
                }

                this.ProjectDetailsUserControl1.Project              = this.applicationService.ProjectDefinition;
                this.ProjectDomainUserControl1.SelectedIndexChanged +=
                    this.ProjectDomainUserControl1_SelectedIndexChanged;
                this.ProjectDomainUserControl1.ApplicationService = this.applicationService;
                this.projectDomainDetailsUserControl1.Packages    =
                    this.applicationConfiguration.ApplicationSettings.Packages;
                this.projectDomainDetailsUserControl1.ApplicationService = this.applicationService;
                this.tabControl1.Enabled = true;
                this.BtnSave.Enabled     = true;
                this.LblPath.Text        = this.ModelPath;
            }
            else
            {
                this.tabControl1.Enabled = false;
                this.BtnSave.Enabled     = false;
                this.LblPath.Text        = "No Model File Loaded";
            }
        }
        public void ProjectDefinitionApplicationServiceFileUnitTest_Validation()
        {
            FilePersistenceOptions options = new FilePersistenceOptions {
                Path = "Test.mdl"
            };
            IProjectDefinitionApplicationService applicationService =
                new ProjectDefinitionApplicationServiceFile {
                FilePersistenceOptions = options
            };

            this.TestValidation(applicationService);
        }
        public void ProjectDefinitionApplicationServiceFileUnitTest_Test()
        {
            FilePersistenceOptions options = new FilePersistenceOptions {
                Path = "Test.mdl"
            };
            IProjectDefinitionApplicationService applicationService =
                new ProjectDefinitionApplicationServiceFile {
                FilePersistenceOptions = options
            };

            this.CreateTestValues(applicationService.ProjectDefinition);
            applicationService.Save();
            applicationService.Load();
            this.TestProjectDefinition(applicationService.ProjectDefinition);
        }
        public void ConfigurationAplicationServiceFileUnitTest_TestMethod1()
        {
            FilePersistenceOptions options = new FilePersistenceOptions {
                Path = "Config.xml"
            };

            IConfigurationApplicationService applicationService =
                new ConfigurationApplicationServiceFile {
                FilePersistenceOptions = options
            };

            this.CreateTestValues(applicationService);
            applicationService.Save();
            applicationService.Load();
            this.TestProjectDefinition(applicationService);
        }
예제 #7
0
        public void LoadProjects()
        {
            try
            {
                if (!string.IsNullOrEmpty(ModelPath) && !string.IsNullOrEmpty(ConfigPath))
                {
                    FilePersistenceOptions options = new FilePersistenceOptions {
                        Path = ModelPath
                    };

                    projectApplicationService =
                        new ProjectDefinitionApplicationServiceFile {
                        FilePersistenceOptions = options
                    };
                    projectApplicationService.Load();
                    projectApplicationService.ProjectDefinition.ModelPath = options.Path;
                    projectApplicationService.ProjectDefinition.Version   = 1;

                    FilePersistenceOptions configOptions = new FilePersistenceOptions {
                        Path = ConfigPath
                    };
                    applicationConfiguration =
                        new ConfigurationApplicationServiceFile {
                        FilePersistenceOptions = configOptions
                    };

                    applicationConfiguration.Load();

                    TemplateManagementUserControl.DataSource =
                        applicationConfiguration.ApplicationSettings.Templates[0];

                    if (projectApplicationService.ProjectDefinition.Domains.Count > 0)
                    {
                        // By default use the first domain
                        PackageUserControl.SelectedPackage =
                            projectApplicationService.ProjectDefinition.Domains[0].Package;
                        PackageUserControl.DataSource =
                            applicationConfiguration.ApplicationSettings.Packages[0];
                        PackageUserControl.DomainDefinition =
                            projectApplicationService.ProjectDefinition.Domains[0];
                    }

                    if (applicationConfiguration.ApplicationSettings.Templates.Count > 0)
                    {
                        PackageUserControl.Templates =
                            applicationConfiguration.ApplicationSettings.Templates;
                    }

                    TemplateManagementUserControl.ProjectDefinition = projectApplicationService.ProjectDefinition;
                    TemplateManagementUserControl.Packages          = applicationConfiguration.ApplicationSettings
                                                                      .Packages[0].ReturnPackageItems();

                    ProjectDetailsUserControl1.Project              = projectApplicationService.ProjectDefinition;
                    ProjectDomainUserControl1.SelectedIndexChanged +=
                        ProjectDomainUserControl1_SelectedIndexChanged;
                    ProjectDomainUserControl1.ApplicationService = projectApplicationService;
                    projectDomainDetailsUserControl1.Packages    =
                        applicationConfiguration.ApplicationSettings.Packages;
                    projectDomainDetailsUserControl1.ApplicationService       = projectApplicationService;
                    projectDomainDetailsUserControl1.ProjectDomainUserControl = ProjectDomainUserControl1;

                    TabControl.Enabled = true;
                    BtnSave.Enabled    = true;
                    LabelPath.Text     = ModelPath;
                }
                else
                {
                    TabControl.Enabled = false;
                    BtnSave.Enabled    = false;
                    LabelPath.Text     = "No Model File Loading";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Loading", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TabControl.Enabled = false;
                BtnSave.Enabled    = false;
                LabelPath.Text     = "Model file does not exist!";
            }
        }