Ejemplo n.º 1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            bool loaded = false;

            if (!String.IsNullOrEmpty(Properties.Settings.Default.ScriptConfig))
            {
                try
                {
                    ScriptDocumentControlConfig config = (ScriptDocumentControlConfig)GeneralUtils.StringToObject(Properties.Settings.Default.ScriptConfig);

                    foreach (string engine in ScriptEngineFactory.Engines)
                    {
                        SetConfigItem(ScriptDocumentControl.GetConfigForEngine(engine), config);
                    }
                }
                catch
                {
                }

                Properties.Settings.Default.ScriptConfig = null;
                Program.SaveSettings();
            }

            SetConfigFromProperties();

            if (!loaded)
            {
                _projectExplorer.Show(dockPanel);
                _projectExplorer.DockState = DockState.DockRight;
            }

            if (_fileName == null)
            {
                if (Properties.Settings.Default.ShowStartupForm)
                {
                    using (StartupForm newProject = new StartupForm())
                    {
                        if (newProject.ShowDialog(this) == DialogResult.OK)
                        {
                            if (newProject.FileName == null)
                            {
                                NewDocument(true);
                            }
                            else
                            {
                                LoadProject(newProject.FileName, true, true);
                            }
                        }
                        else
                        {
                            NewDocument(false);
                        }
                    }
                }
            }
            else
            {
                LoadProject(_fileName, true, true);
            }

            if (Properties.Settings.Default.AutoSaveEnabled)
            {
                timerAutoSaveTimer.Interval = Properties.Settings.Default.AutoSaveTimerMins * 60 * 1000;
                timerAutoSaveTimer.Enabled  = true;
            }
        }
Ejemplo n.º 2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            bool loaded = false;

            if (!String.IsNullOrEmpty(Properties.Settings.Default.ScriptConfig))
            {
                try
                {
                    ScriptDocumentControlConfig config = (ScriptDocumentControlConfig) GeneralUtils.StringToObject(Properties.Settings.Default.ScriptConfig);

                    foreach (string engine in ScriptEngineFactory.Engines)
                    {
                        SetConfigItem(ScriptDocumentControl.GetConfigForEngine(engine), config);
                    }
                }
                catch
                {
                }

                Properties.Settings.Default.ScriptConfig = null;
                Program.SaveSettings();
            }

            SetConfigFromProperties();

            if(!loaded)
            {
                _projectExplorer.Show(dockPanel);
                _projectExplorer.DockState = DockState.DockRight;
            }

            if (_fileName == null)
            {
                if (Properties.Settings.Default.ShowStartupForm)
                {
                    using (StartupForm newProject = new StartupForm())
                    {
                        if (newProject.ShowDialog(this) == DialogResult.OK)
                        {
                            if (newProject.FileName == null)
                            {
                                NewDocument(true);
                            }
                            else
                            {
                                LoadProject(newProject.FileName, true);
                            }
                        }
                        else
                        {
                            NewDocument(false);
                        }
                    }
                }
            }
            else
            {
                LoadProject(_fileName, true);
            }

            if (Properties.Settings.Default.AutoSaveEnabled)
            {
                timerAutoSaveTimer.Interval = Properties.Settings.Default.AutoSaveTimerMins * 60 * 1000;
                timerAutoSaveTimer.Enabled = true;
            }
        }