Exemplo n.º 1
0
        public void StartupInit()
        {
            DataSafe ds = new DataSafe(Paths.SettingsPath, "MainWindow");

            if (!ds.containsKey("SelectedHardware") || ds.Ints["SelectedHardware"] < 0)
            {
                HardwareSelector hws = new HardwareSelector(ds);
                if (hws.ShowDialog() != true)
                {
                    Environment.Exit(0);
                }
            }
            LoadingWindow lw = new LoadingWindow(ds);

            lw.Load();

            this.WindowState = ds.Bools["Maximized", false] ? System.Windows.WindowState.Maximized : System.Windows.WindowState.Normal;
            this.HWC         = lw.HWC;
            CameraClickAndMove.SetHWC(this.HWC);

            //Init 1 CloseableTabItem
            Data.TabItems_Add(new CloseableTabItem("new"));

            // Init UI Elemente
            AxesControl.SetHardwareControllerAndInitGUI(HWC);
            IOControl.SetHardwareControllerAndInitGUI(HWC);

            //Verbinde EventHandler
            ScriptHandler.OnState1Changed += this.OnScriptHandlerStateChange_1;
            ScriptHandler.OnState2Changed += this.OnScriptHandlerStateChange_2;

            //Data.CodeTextFieldItems = new List<string>();
            //Load last X Commands
            List <string> s = new List <string>();
            int           x = ds.Ints["CodeTextFieldItemsCount", 0];

            for (int i = 0; i < x; ++i)
            {
                s.Add(ds.Strings["CTFI-" + i, ""]);
            }
            Data.CodeTextFieldItems = s;

#if TEST
            Tests.TestClass.RunTest(this, HWC);
#endif
        }
Exemplo n.º 2
0
        private void iOToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (DIOBase.GetInstanceInterface() == null)
            {
                MessageBox.Show("IO가 존재하지 않습니다.");
                return;
            }

            if (m_ioCtrlAjin == null)
            {
                m_ioCtrlAjin = new IOControl();
            }

            m_ioCtrlAjin.Show();
            m_ioCtrlAjin.Focus();

            m_ioCtrlAjin.Location = new Point(this.Location.X - m_ioCtrlAjin.Size.Width, this.Location.Y);
        }
Exemplo n.º 3
0
        private void toolStripButton_Click(object sender, EventArgs e)
        {
            ToolStripButton toolbtn = sender as ToolStripButton;

            if (toolbtn.Tag != null)
            {
                switch (toolbtn.Tag.ToString())
                {
                case "主页":
                    skinTabControl1.SelectedTab = 主页Tag;
                    break;

                case "用户管理":
                    skinTabControl1.SelectedTab = 用户管理Tag;
                    userInfo.TopLevel           = false;                //将子窗体设置成非最高层,非顶级控件
                    userInfo.FormBorderStyle    = FormBorderStyle.None; //去掉窗体边框
                    userInfo.Size   = this.panel11.Size;
                    userInfo.Parent = this.panel11;                     //指定子窗体显示的容器
                    userInfo.Dock   = DockStyle.Fill;
                    userInfo.Show();
                    userInfo.Activate();
                    break;

                case "电机":
                    skinTabControl1.SelectedTab = 电机参数Tag;
                    Frm_Machine.TopLevel        = false;                //将子窗体设置成非最高层,非顶级控件
                    Frm_Machine.FormBorderStyle = FormBorderStyle.None; //去掉窗体边框
                    Frm_Machine.Size            = this.panel9.Size;
                    Frm_Machine.Parent          = this.panel9;          //指定子窗体显示的容器
                    Frm_Machine.Dock            = DockStyle.Fill;
                    Frm_Machine.Show();
                    Frm_Machine.Activate();
                    break;

                case "IO":
                    skinTabControl1.SelectedTab = IO控制Tag;
                    if (IOControl == null || IOControl.IsDisposed || IOControl.Disposing)
                    {
                        IOControl = new InputOutput(DeviceRsDef.MotionCard, "INPUTDEFINE.csv", "OUTPUTDEFINE.csv");
                    }
                    IOControl.TopLevel        = false;                //将子窗体设置成非最高层,非顶级控件
                    IOControl.FormBorderStyle = FormBorderStyle.None; //去掉窗体边框
                    IOControl.Size            = this.panel3.Size;
                    IOControl.Parent          = this.panel3;          //指定子窗体显示的容器
                    IOControl.Dock            = DockStyle.Fill;
                    IOControl.Show();
                    IOControl.Activate();
                    break;

                case "日志":
                    skinTabControl1.SelectedTab = 日志Tag;
                    frmLog.TopLevel             = false;                //将子窗体设置成非最高层,非顶级控件
                    frmLog.FormBorderStyle      = FormBorderStyle.None; //去掉窗体边框
                    frmLog.Size   = this.panel6.Size;
                    frmLog.Parent = this.panel6;                        //指定子窗体显示的容器
                    frmLog.Dock   = DockStyle.Fill;
                    frmLog.Loadshow();
                    frmLog.Show();
                    frmLog.Activate();
                    break;

                case "退出":
                    if (MessageBox.Show("是否退出软件", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.OK)
                    {
                        //ConfigSpace.ConfigHandle.Instance.Save();
                        Application.Exit();
                    }
                    else
                    {
                        return;
                    }
                    break;

                default:
                    break;
                }
            }
        }