public void AssociateButton(MyButton btn, IDisplayManager dm, string windowMenuName) { var windowMenuInfo = ADInfoBll.Instance.GetInfos <WindowMenuInfo>("Name = '" + windowMenuName + "'")[0]; if (windowMenuInfo == null) { throw new ArgumentException("There is no WindowMenu of " + windowMenuName); } TryAddButtons(btn, this); btn.Text = windowMenuInfo.Text; btn.Tag = windowMenuInfo; btn.Click += new EventHandler((sender, e) => { Button tsb = sender as Button; WindowMenuInfo info = tsb.Tag as WindowMenuInfo; MenuWindowExtention.OnButtonClick(info, tsb.FindForm()); }); dm.PositionChanged += new EventHandler((sender, e) => { IDisplayManager dm2 = sender as IDisplayManager; if (dm2 == dm) { MenuWindowExtention.SetMenuState(this); } }); }
public void AssociateButton(MyButton btn, IControlManager cm, string windowMenuName) { var windowMenuInfo = ADInfoBll.Instance.GetInfos <WindowMenuInfo>("Name = '" + windowMenuName + "'")[0]; if (windowMenuInfo == null) { throw new ArgumentException("There is no WindowMenu of " + windowMenuName); } TryAddButtons(btn, this); btn.Text = windowMenuInfo.Text; btn.Tag = windowMenuInfo; btn.Click += new EventHandler((sender, e) => { Button tsb = sender as Button; WindowMenuInfo info = tsb.Tag as WindowMenuInfo; MenuWindowExtention.OnButtonClick(info, tsb.FindForm()); //UpdateContent(cm, gridName); }); cm.DisplayManager.PositionChanged += new EventHandler((sender, e) => { IDisplayManager dm2 = sender as IDisplayManager; if (dm2 == cm.DisplayManager) { MenuWindowExtention.SetMenuState(this); } }); cm.StateChanged += new EventHandler((sender, e) => { IControlManager cm2 = sender as IControlManager; if (cm2 == cm) { MenuWindowExtention.SetMenuState(this); } }); cm.EditEnded += new EventHandler((sender, e) => { IControlManager cm2 = sender as IControlManager; if (cm2 == cm) { if (cm2.DisplayManager.InBatchOperation) { return; } MenuWindowExtention.SetMenuState(this); } }); }
protected override void Dispose(bool disposing) { if (disposing) { this.DisableSearchProgressForm(null); foreach (var sm in m_progressInvalidate.Keys) { sm.DataLoaded -= new EventHandler <DataLoadedEventArgs>(searchManager2_DataLoaded); } MenuWindowExtention.DisposeWindowMenu(this); } base.Dispose(disposing); }