public void AlignToControler() { if (this.IsDesignMode()) { var values = Enum.GetValues(typeof(ViewType)); foreach (ViewType type in values) { CreateButton(type); } } else { ViewControler controler = Controler; if (controler != null) { List <ViewType> list = controler.RegisterdViews; list.Sort(); foreach (ViewType type in list) { CreateButton(type, controler.IsCurrent(type)); } } AlignOnOff(); } }
private void ViewSelector_Load(object sender, EventArgs e) { this.ToolTip.ForeColor = SkinInfo.ForeColor; this.ToolTip.BackColor = SkinInfo.BackColor; if (!this.IsDesignMode()) { ViewControler controler = Controler; if (controler != null) { controler.OnViewListChange += this.AlignToControler; controler.OnViewChanged += this.AlignOnOff; } } AlignToControler(); }
public void OnButtonClick(object sender, EventArgs e) { ViewControler controler = Controler; if (controler != null && !controler.Lock) { StatusImageButton ctrl = sender as StatusImageButton; if (ctrl != null && ctrl.Tag != null) { ViewType type = (ViewType)(ctrl.Tag); controler.ChangeView(type); AlignOnOff(); } } }
public void AlignOnOff() { ViewControler controler = Controler; if (controler != null) { foreach (Control ctrl in this.flowLayoutPanel1.Controls) { if (ctrl is StatusImageButton && ctrl.Tag != null) { ViewType type = (ViewType)(ctrl.Tag); bool on = controler.IsCurrent(type); ((StatusImageButton)ctrl).On = on; if (!on) { ctrl.Enabled = !controler.Lock; } ctrl.Enabled = ctrl.Enabled && controler.IsEnabled(type); } } } }
public MainForm() { InitializeComponent(); Application.Idle +=OnIdle; SkinInfo.ApplyColor(this); object cust = this; if (cust is CustomAppForm) { ((CustomAppForm)cust).SettingsClick += new System.EventHandler(this.MainForm_SettingsClick); ((CustomAppForm)cust).AboutClick += new System.EventHandler(this.MainForm_AboutClick); } ViewControler controler = new ViewControler(this, this.BigViewPanel, this.SmallViewPanel); Settings.RegisterInstance(controler); controler.RegisterView(ViewType.Process, Scene3DView, ProcessView); TuneSmallView.Viewer = TuneBigView; controler.RegisterView(ViewType.Tune, TuneBigView, TuneSmallView); CalibrationSmallView.Viewer = CalibrationBigView; controler.RegisterView(ViewType.Calibrate, CalibrationBigView, CalibrationSmallView); controler.ChangeView(ViewType.Process); this.mainToolBox1.Controler = controler; }