Exemplo n.º 1
0
        public static string InitialFolder(IDecisionTree tree, eInitialFolder initialFolder = eInitialFolder.Model, string LastUsedFolder = "")
        {
            IConfiguration conf = ConfigurationRepository.IConfiguration;

            if (conf.GetConfigurationItem(UI_Constants.SakwaModelPath) == null)
            {
                ConfigurationForm.DefineConfigurationItems();
            }

            string ciKey = initialFolder == eInitialFolder.Model
                ? UI_Constants.SakwaModelPath
                : UI_Constants.SakwaTemplatePath;

            string result = LastUsedFolder == ""
                ? conf.GetConfigurationValue(ciKey, "")
                : Path.GetDirectoryName(LastUsedFolder);

            if (result == "")
            {
                result = conf.GetConfigurationValue("UserAppDataPath", "");
            }

            if (tree != null && tree.FullPath != "")
            {
                result = Path.GetDirectoryName(tree.FullPath);
            }

            return(result);
        }
Exemplo n.º 2
0
        private void TemplateForm_Load(object sender, EventArgs e)
        {
            #region Setup Configuration
            conf.AddConfigurationItem("", new IConfigurationItemImpl(UI_Constants.TemplateFormState, "", UI_Constants.ConfigurationSource));

            IConfigurationItemObject <Size> sizeForm = new ConfigurationItemObject <Size>(UI_Constants.TemplateFormSize, new Size(686, 432), UI_Constants.ConfigurationSource);
            conf.AddConfigurationItem("", sizeForm as IConfigurationItem);
            IConfigurationItemObject <Point> locationForm = new ConfigurationItemObject <Point>(UI_Constants.TemplateFormLocation, new Point(100, 50), UI_Constants.ConfigurationSource);
            conf.AddConfigurationItem("", locationForm as IConfigurationItem);

            conf.AddConfigurationItem("", new IConfigurationItemImpl(UI_Constants.TemplateRecentFiles, "", UI_Constants.ConfigurationSource));
            conf.AddConfigurationItem("", new IConfigurationItemImpl(UI_Constants.TemplateRecentProjects, "", UI_Constants.ConfigurationSource));
            conf.AddConfigurationItem("", new IConfigurationItemImpl(UI_Constants.TemplateRecentNode, "", UI_Constants.ConfigurationSource));

            if (conf.GetConfigurationItem(UI_Constants.SakwaModelOnStart) == null)
            {
                ConfigurationForm.DefineConfigurationItems();
            }

            #endregion
            #region App configuration
            switch (conf.GetConfigurationValue(UI_Constants.TemplateFormState))
            {
            case "Maximized":
                WindowState = FormWindowState.Maximized;
                break;

            case "Normal":
                IConfigurationItem size = conf.GetConfigurationItem(UI_Constants.TemplateFormSize);
                this.Size = (size as IConfigurationItemObject <Size>).GetValue(this.Size);

                IConfigurationItem location = conf.GetConfigurationItem(UI_Constants.TemplateFormLocation);
                this.Location = (location as IConfigurationItemObject <Point>).GetValue(this.Location);
                if (this.Location.X < 0)
                {
                    this.Location = new Point(0, 0);
                }

                //Make sure the form is shown on the visible screen
                if (!Screen.GetWorkingArea(this).IntersectsWith(new Rectangle(this.Location, this.Size)))
                {
                    this.Location = new Point(100, 100);
                }

                break;

            default:
                size      = conf.GetConfigurationItem(UI_Constants.TemplateFormSize);
                this.Size = (size as IConfigurationItemObject <Size>).GetValue(this.Size);

                location      = conf.GetConfigurationItem(UI_Constants.TemplateFormLocation);
                this.Location = (location as IConfigurationItemObject <Point>).GetValue(this.Location);

                //Make sure the form is shown on the visible screen
                if (!Screen.GetWorkingArea(this).IntersectsWith(new Rectangle(this.Location, this.Size)))
                {
                    this.Location = new Point(100, 100);
                }

                break;
            } //switch(conf.GetConfigurationValue("window-state"))
            #endregion

            InitializeControl();
        }
Exemplo n.º 3
0
        private void btnTools_Click(object sender, EventArgs e)
        {
            ConfigurationForm frm = new ConfigurationForm(0, this);

            frm.ShowDialog(this);
        }