Пример #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\\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 openfile(string fileName)
 {
     if (meditorManager.Open(fileName))
     {
         Add(fileName);
     }
     else
     {
         mruManager.Remove(fileName);       // when Open File operation failed
     }
 }
Пример #3
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            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, webControl1);
            ReadCss();
            meditorManager.SetStyle(rtbHtml);

            _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 += frmMain_DragDrop;
            rtbHtml.DragEnter += rtbHtml_DragEnter;

            tabControl1.MouseDown += tabControl1_MouseDown;
            tabControl2.MouseDown += tabControl1_MouseDown;
            //tabControl1.GotFocus += new EventHandler(tabControl1_GotFocus);
        }