Пример #1
0
 private void yunfileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.yunfile == null)
     {
         this.yunfile = new yunfile(this);
     }
     this.yunfile.Show(this.dockPanel1);
     this.UpdateUI();
 }
Пример #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            //this.TerminalForm.PortOpen += TerminalForm_PortOpen;
            //this.TerminalForm.PortClose += TerminalForm_PortClose;

            string configFile = this.DockPanelConfigFile;

            if (!File.Exists(configFile))
            {
            }
            else
            {
                try
                {
                    deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
                    dockPanel1.LoadFromXml(configFile, this.deserializeDockContent);
                }
                catch (Exception ex)
                {
                    Helpers.ErrorBox(ex.Message + "\r\n\r\n" + "请重新启动程序!");
                    this.TerminalForm.Close();
                    this.Close();
                    return;
                }
            }

            this.CurretPortName = Properties.Settings.Default.PortName;

            if (this.TerminalForm == null)
            {
                this.TerminalForm = new TerminalForm();
                this.TerminalForm.Show(this.dockPanel1, DockState.DockBottom);
            }
            if (this.yunfile == null)
            {
                this.yunfile = new yunfile(this);
                this.yunfile.Show(this.dockPanel1, DockState.DockLeft);
                this.yunfile.Hide();
            }
            //
            //if (!this.ComportIsExists)
            //{
            //    this.btnConnect.Enabled = false;
            //    MessageBox.Show($"Serialport \"{this.CurretPortName}\" does not exists!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //}
            //else
            //{
            this.btnConnect.Enabled = true;
            //}
            this.UpdateUI();
            //打开关联文件
            string command = Environment.CommandLine;//获取进程命令行参数

            string[] para = command.Split('\"');

            if (para.Length > 3)
            {
                string pathC = para[3];//获取打开的文件的路径
                //下面就可以自己编写代码使用这个pathC参数了
                //FileStream fs = new FileStream(pathC, FileMode.Open, FileAccess.Read);
                FileFormats ff = EditorForm.EditorFileFormats;
                OpenFromFile(pathC, ff);
                MessageBox.Show(pathC);
            }
        }