public CtrlFactory(ZWPictureBox pictureBox) { this.pictureBox = pictureBox; this.laserCtrl = new LaserCtrl(pictureBox); this.laserAlignment = new LaserAlignment(pictureBox); this.laserAppearance = new LaserAppearanceCtrl(); this.laserHoleSize = new LaserHoleSize(); this.statisticsCtrl = new StatisticsCtrl(); this.rulerAppearanceCtrl = new RulerAppearanceCtrl(); this.settingCtrl = new SettingCtrl(pictureBox); serialPortCtrl = new SerialPortConfigCtrl(); InitializeHandler(); }
/// <summary> /// initialize all the base controls /// </summary> private void InitializeControls() { CtrlFactory.InitializeCtrlFactory(this); controls = new List <BaseCtrl>(); controls.Add(CtrlFactory.GetCtrlFactory().GetCtrlByType <LaserCtrl>(CtrlType.LaserCtrl)); controls.Add(CtrlFactory.GetCtrlFactory().GetCtrlByType <LaserAppearanceCtrl>(CtrlType.LaserAppreance)); controls.Add(CtrlFactory.GetCtrlFactory().GetCtrlByType <StatisticsCtrl>(CtrlType.StatisticsCtrl)); controls.Add(CtrlFactory.GetCtrlFactory().GetCtrlByType <RulerAppearanceCtrl>(CtrlType.RulerAppearanceCtrl)); settingCtrl = CtrlFactory.GetCtrlFactory().GetCtrlByType <SettingCtrl>(CtrlType.SettingCtrl); settingCtrl.UpdateSimulatorImageHandler += UpdateSimulatorImageHandler; //settingCtrl.UpdateTimerStatesHandler += UpdateTimerStatesHandler; controls.Add(settingCtrl); controls.Add(CtrlFactory.GetCtrlFactory().GetCtrlByType <LaserAlignment>(CtrlType.LaserAlignment)); controls.Add(CtrlFactory.GetCtrlFactory().GetCtrlByType <LaserHoleSize>(CtrlType.LaserHoleSize)); serialPortConfigCtrl = CtrlFactory.GetCtrlFactory().GetCtrlByType <SerialPortConfigCtrl>(CtrlType.SerialPort); controller = new IController(serialPortConfigCtrl); controls.Add(serialPortConfigCtrl); }