예제 #1
0
        /// <summary>
        /// Save current project. Asks user for a file if needed.
        /// </summary>
        /// <returns>Returns true if project was successfully saved</returns>
        public bool SaveProject()
        {
            string projectFileName = Env.Current.Project.FileName;

            if (projectFileName == "")
            {
                var fd = new SaveFileDialog
                {
                    Filter           = StringResources.FileOpenDialogFilter,
                    FilterIndex      = 0,
                    RestoreDirectory = true
                };

                if (fd.ShowDialog() == DialogResult.OK)
                {
                    projectFileName = fd.FileName;
                }
                else
                {
                    return(false);
                }
            }

            SaveAllDocuments();
            Env.Current.Project.Save(projectFileName);
            projectContentView.RefreshContent(Env.Current.Project);
            mruManager.Add(projectFileName);
            return(true);
        }
예제 #2
0
 private bool save(MarkdownEditor meditor)
 {
     if (string.IsNullOrEmpty(meditor.FileName) || meditor.FileName.IndexOf("未命名") != -1)
     {
         return(saveas(meditor));
     }
     meditor.Save();
     if (!_thisModify.ContainsKey(meditor.FileName))
     {
         _thisModify.Add(meditor.FileName, true);
     }
     mruManager.Add(meditor.FileName);                      // when file is successfully opened
     return(true);
 }
예제 #3
0
        public void OpenFile(string filename)
        {
            FileInfo fi    = new FileInfo(filename);
            Form     child = (Form)FindExistingForm(fi);

            if (child != null)
            {
                ActivateMdiChild(child);
                return;
            }

            OpenDocument(fi);
            mru.Add(fi.FullName);
        }
        public override void Execute()
        {
            string projectFileName = Env.Current.Project.FileName;

            if (projectFileName == "")
            {
                var fd = new SaveFileDialog
                {
                    Filter           = CommonUI.StringResources.FileOpenDialogFilter,
                    FilterIndex      = 0,
                    RestoreDirectory = true
                };

                if (fd.ShowDialog() == DialogResult.OK)
                {
                    projectFileName = fd.FileName;
                }
                else
                {
                    return;
                }
            }

            _windowManager.SaveAllDocuments();
            Env.Current.Project.Save(projectFileName);
            _windowManager.Refresh();
            _mruManager.Add(projectFileName);
        }
        /// <summary>
        /// Load a project. Asks user for a file.
        /// </summary>
        /// <returns>Returns true if project was successfully loaded</returns>
        public bool LoadProject()
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Filter           = StringResources.FileDialogFilter;
            fd.FilterIndex      = 0;
            fd.RestoreDirectory = true;

            if (fd.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }
            Close();
            Env.Current.Project.Load(fd.FileName);
            mruManager.Add(fd.FileName);

            return(true);
        }
        public override void Execute()
        {
            var fd = new OpenFileDialog
            {
                Filter           = CommonUI.StringResources.FileOpenDialogFilter,
                FilterIndex      = 0,
                RestoreDirectory = true
            };

            if (fd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            _windowManager.Close();
            Env.Current.Project.Load(fd.FileName);
            _mruManager.Add(fd.FileName);
        }
 public override void Execute()
 {
     _windowManager.Close();
     Env.Current.Project.Load(_fileName);
     _mruManager.Add(_fileName);
 }
예제 #8
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            try
            {
                // load settings only if not in debug mode
                if (!Settings.Default.ShowLogConsole)
                {
                    ToolStripManager.LoadSettings(this, Name);
                }

                // ---
                // initialize menu state
                PicGlobalCotationProperties.ShowShortCotationLines = Settings.Default.UseCotationShortLines;
                _log.Info(string.Format("ShowShortCotationLines initialized with value : {0}", Settings.Default.UseCotationShortLines.ToString()));
                toolStripMenuItemCotationShortLines.Checked = PicGlobalCotationProperties.ShowShortCotationLines;

                // Set DockPanel properties
                dockPanel.DocumentStyle         = DocumentStyle.DockingMdi;
                dockPanel.ActiveAutoHideContent = null;
                dockPanel.Parent = this;
                dockPanel.SuspendLayout(true);

                UpdateToolCommands(null, null);

                ShowLogConsole();
                dockPanel.ResumeLayout(true, true);

                if (IsWebSiteReachable)
                {
                    ShowStartPage();
                }
                CreateBasicLayout();

                // update tool bars
                UpdateToolCommands(null);

                // Most recently used databases
                mruManager = new MRUManager();
                mruManager.Initialize(
                    this,                              // owner form
                    databaseToolStripMenuItem,         // Recent Files menu item
                    mnuFileMRU,                        // Recent Files menu item
                    "Software\\treeDiM\\PLMPackLib");  // Registry path to keep MRU list

                mruManager.Add(Pic.DAL.ApplicationConfiguration.CustomSection.DatabasePath);
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.ToString());
                _log.Error(ex.ToString());
            }
            // restore window position
            if (null != Settings.Default.MainFormSettings && !Settings.Default.StartMaximized)
            {
                Settings.Default.MainFormSettings.Restore(this);
            }
            // show maximized
            if (Settings.Default.StartMaximized)
            {
                WindowState = FormWindowState.Maximized;
            }
        }