public PageState() { InitializeComponent(); this.defaultForeColor = this.lblMachineState.ForeColor; Machine.Instance.FSM.StateChanged += FSM_StateChanged; Machine.Instance.LightTower.Opened += LightTower_Opened; this.setupAlarms(); ControlUpatingMgr.Add(this); }
public MainForm() { lngResources.Add(strMachine, "Machine:"); lngResources.Add(strMotion, "Motion:"); lngResources.Add(strVision, "Vision:"); lngResources.Add(strLaser, "Laser:"); lngResources.Add(strScale, "Scale:"); lngResources.Add(strHeater, "Heater:"); lngResources.Add(strPropor1, "Propor1:"); lngResources.Add(strPropor2, "Propor2:"); //数据库存在 this.LoadConfig(); this.MainNav = new NavigateMain(); this.ProgramNav = new NavigateProgram(); this.RunNav = new NavigateRun(); this.SetupAlarm(); //数据库线程启动 this.SetupDataBase(); //setup machine if (!Machine.Instance.SetupAll()) { return; } //为了同步气压而增加的事件 Machine.Instance.Valve1.Proportioner.ChangeProgramAirEvent += FluidProgram.CurrentOrDefault().ChangeAirValue; InitializeComponent(); Ins = this; this.WindowState = FormWindowState.Maximized; this.Load += FormMain_Load; this.FormClosing += FormMain_FormClosing; this.ProgramCtl = new ProgramControl(); this.ProgramCtl.Dock = DockStyle.Fill; this.ProgramCtl.SetOwner(this); //this.CameraCtl = new CameraControl(); //this.CameraCtl.Dock = DockStyle.Fill; this.ctlCurrPos = new PositionMainControl(); this.ctlCurrPos.Dock = DockStyle.Fill; this.RunInfoCtl = new RunInfoControl(); this.RunInfoCtl.Dock = DockStyle.Fill; this.RunInfoCtl2 = new RunInfoControl2(); this.RunInfoCtl2.Dock = DockStyle.Fill; this.ManualCtl = new ManualControl(); this.ManualCtl.Dock = DockStyle.Fill; this.canvasControll = new CanvasControll(); this.canvasControll.SetControlMode(true); this.canvasControll.Dock = DockStyle.Fill; this.SetupPages(); this.SetupReceivers(); this.SetupDrawing(); ControlUpatingMgr.Add(this); Machine.Instance.FSM.StateChanged += FSM_StateChanged; Machine.Instance.LightTower.Opened += LightTower_Opened; this.transAlarmForm.SetOwner(this); this.createPath(); this.timer = new System.Windows.Forms.Timer(); this.timer.Interval = 100; this.timer.Tick += Timer_Tick; this.timer.Start(); this.ReadLanguageResources(); }