Esempio n. 1
0
        public AutoWriteProcess()
        {
            InitializeComponent();
            InitGlobleVariable();
            InitComBoxUart();

            InitForm();
            autoWriteForm = this;
        }
Esempio n. 2
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (treeView1.SelectedNode.Name == "AutoWriPro")
            {
#if tabControl
                //try
                //{
                //    string testFormName = typeof(AutoWriteProcess).ToString();
                //    creatForm.AddTabpage(xtraTabControl1, "TabPageAuto", "自动写程", testFormName);
                //}
                //catch (Exception ex)
                //{

                //    XtraMessageBox.Show(ex.Message);
                //}
#else
                panel1.Controls.Clear();

                autoWp                 = new AutoWriteProcess();
                autoWp.TopLevel        = false;
                autoWp.Dock            = DockStyle.Fill;
                autoWp.FormBorderStyle = FormBorderStyle.None;
                autoWp.TopLevel        = false;

                panel1.Controls.Add(autoWp);
                autoWp.Show();
#endif
            }
            else if (treeView1.SelectedNode.Name == "ManualWriPro")
            {
                DialogResult dr = XtraMessageBox.Show("打开手动写程后将关闭主界面\r\n是否关闭主程序", "警告", MessageBoxButtons.YesNo,
                                                      MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                if (dr == DialogResult.Yes)
                {
                    Login login = new Login();
                    login.ShowDialog();

                    if (!login.LoginOk)//登录成功才打开
                    {
                        XtraMessageBox.Show("手动写程请先登录");
                        return;
                    }
                    string exePath = System.Environment.CurrentDirectory + "\\" + AutoWriteProcess.ToolFolder + "\\SerialDownloader_cpp.exe";
                    System.Diagnostics.Process.Start(exePath);
                    Thread.Sleep(1000);
                    openAndClose = true;
                    Application.Exit();
                }
            }
        }