示例#1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            this.Text = Application.ProductName + " V" + Application.ProductVersion;
            //初始化最近打开的文件
            mruManager = new MRUManager();
            mruManager.Initialize(this,文件ToolStripMenuItem, 最近打开的文件ToolStripMenuItem,                        // Recent Files menu item
                                  "Software\\YihuiStudio\\MEditor"); // Registry path to keep MRU list
            mruManager.CurrentDir = ".....";           // default is current directory
            mruManager.MaxMRULength = 10;             // default is 10
            mruManager.MaxDisplayNameLength = 40;

            //定义编辑管理器
            meditorManager = new MarkdownEditorManager(this, tabControl1, mruManager,webBrowser1);
            ReadCss();
            //webBrowser1.Navigate("about:blank");
            meditorManager.SetStyle(rtbHtml);
            //webBrowser1.DocumentText = meditorManager.GetHTMLStyle("");

            _filemonitor = new FileMonitor(fsw_Changed);
            string command = Environment.CommandLine;//获取进程命令行参数
            if (!string.IsNullOrEmpty(command))
            {
                string[] para = command.Split('\"');
                if (para.Length > 2)
                {
                    string pathC = para[2];//获取打开的文件的路径
                    if (pathC.Length > 3)
                    {
                        openfile(pathC);
                    }
                    else
                    {
                        meditorManager.Open("");
                    }
                }
            }
            else
            {
                meditorManager.Open("");
            }

            //this.timer1.Start();
            rtbHtml.EnableAutoDragDrop = false;
            rtbHtml.AllowDrop = true;

            //			rtbHtml.KeyDown += rtbHtml_KeyDown;
            rtbHtml.DragDrop += new DragEventHandler(frmMain_DragDrop);
            rtbHtml.DragEnter += new DragEventHandler(rtbHtml_DragEnter);

            tabControl1.MouseDown += new MouseEventHandler(tabControl1_MouseDown);
            tabControl2.MouseDown+=new MouseEventHandler(tabControl1_MouseDown);
            //tabControl1.GotFocus += new EventHandler(tabControl1_GotFocus);
        }
示例#2
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            try
            {
                // make ToolStripButton available
                toolStripButtonOceProCut.Available = Properties.Settings.Default.TSButtonAvailableOceProCut;
                toolStripButtonARISTO.Available = Properties.Settings.Default.TSButtonAvailableARISTO;
                toolStripButtonZUND.Available = Properties.Settings.Default.TSButtonAvailableZUND;

                // construct tree
                // this line was moved here from the treeview contructor
                // to avoid running this code while in design mode
                _treeViewCtrl.RefreshTree();

                // load settings only if not in debug mode
                if (!Properties.Settings.Default.DebugMode)
                    ToolStripManager.LoadSettings(this, this.Name);

                // --- instantiate and start splach screen thread
                // cardboard format loader
                CardboardFormatLoader formatLoader = new CardboardFormatLoaderImpl();
                _pluginViewCtrl.CardboardFormatLoader = formatLoader;
                _factoryViewCtrl.CardBoardFormatLoader = formatLoader;

                // profile loader
                _profileLoaderImpl = new ProfileLoaderImpl();
                _pluginViewCtrl.ProfileLoader = _profileLoaderImpl;
                // search method
                ComponentSearchMethodDB searchmethod = new ComponentSearchMethodDB();
                _pluginViewCtrl.SearchMethod = new ComponentSearchMethodDB();

                _treeViewCtrl.StartPageSelected += new DocumentTreeView.StartPageSelectHandler(ShowStartPage);
                _treeViewCtrl.DownloadPageSelected += new DocumentTreeView.DownloadPageSelectHandler(ShowDownloadPage);

                _treeViewCtrl.SelectionChanged += new DocumentTreeView.SelectionChangedHandler(_branchViewCtrl.OnSelectionChanged);
                _treeViewCtrl.SelectionChanged += new DocumentTreeView.SelectionChangedHandler(OnSelectionChanged);

                _branchViewCtrl.SelectionChanged += new DocumentTreeBranchView.SelectionChangedHandler(_treeViewCtrl.OnSelectionChanged);
                _branchViewCtrl.SelectionChanged += new DocumentTreeBranchView.SelectionChangedHandler(OnSelectionChanged);
                _branchViewCtrl.TreeNodeCreated += new DocumentTreeBranchView.TreeNodeCreatedHandler(_treeViewCtrl.OnTreeNodeCreated);

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

                // show start page
                if (_showRoot)
                    _treeViewCtrl.CollapseRootChildrens();
                else
                    ShowStartPage(this);
                // update tool bars
                UpdateToolCommands();

                // 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 (System.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;
        }