public WindowList(ExtendedForm parentForm) { windowListForm = parentForm; windowListForm.ChildAdded += WindowListForm_ChildAdded; windowListForm.ChildRemoved += WindowListForm_ChildRemoved; this.parentForm = parentForm; }
private void RemoteToolsControl_Load(object sender, EventArgs e) { if (this.ParentForm != null) { hostForm = (ExtendedForm)this.ParentForm; } }
public ExtendedForm(ExtendedForm parentForm, string formGuid) { FormGuid = formGuid; ParentForm = parentForm; SubscribeEvents(); SetDoubleBuffering(); }
public void AddChild(ExtendedForm child) { if (!childForms.Contains(child)) { childForms.Add(child); child.Disposed += Child_Disposed; OnChildAdded(this, child); } }
public ExtendedForm(ExtendedForm parentForm, MappedObject currentObject, bool startHidden = false) : this(parentForm, currentObject.Guid) { // If the form is starting without being shown, call for the handle to force its creation. if (startHidden) { var dummy = this.Handle; startedHidden = true; } }
public PSExecCommandForm(ExtendedForm parentForm, Device device) : base(parentForm) { InitializeComponent(); this.DisableDoubleBuffering(); targetDevice = device; pSExecWrapper = new PSExecWrapper(device.HostName); pSExecWrapper.ErrorReceived += PSExecWrapper_ErrorReceived; pSExecWrapper.OutputReceived += PSExecWrapper_OutputReceived; this.Text += " - " + device.CurrentUser; this.Show(); }
private void ExtendedForm_Disposed(object sender, System.EventArgs e) { if (!IsDisposed) { DoneWaiting(); UnSubscribeEvents(); CloseChildren(); parentForm = null; childForms.Clear(); childForms = null; } }
private void InitToolItems(ExtendedForm parentForm) { var toolItemList = new List <ToolStripMenuItem>(); toolItemList.Add(NewToolItem("tsmUserOrgObLookup", "User Lookup", () => MunisFunctions.NameSearch(parentForm))); toolItemList.Add(NewToolItem("tsmOrgObLookup", "Org/Obj Lookup", () => MunisFunctions.OrgObjSearch(parentForm))); toolItemList.Add(NewToolItem("tsmPOLookUp", "PO Lookup", () => MunisFunctions.POSearch(parentForm))); toolItemList.Add(NewToolItem("tsmReqNumLookUp", "Requisition # Lookup", () => MunisFunctions.ReqSearch(parentForm))); toolItemList.Add(NewToolItem("tsmDeviceLookUp", "Device Lookup", () => MunisFunctions.AssetSearch(parentForm))); foreach (var item in toolItemList) { AddToolItem(item); } }
private List <ExtendedForm> GetChildFormsList(ExtendedForm parent) { var childList = new List <ExtendedForm>(); childList.AddRange(parent.ChildForms); foreach (var child in parent.childForms) { if (child.ChildForms.Count > 0) { childList.AddRange(GetChildFormsList(child)); } } return(childList); }
private OnlineStatusMenuItem NewMenuItem(ExtendedForm frm) { var newitem = new OnlineStatusMenuItem(); newitem.Name = frm.Name; newitem.Font = dropDownControl.Font; newitem.Text = frm.Text; newitem.Image = frm.Icon.ToBitmap(); newitem.TargetForm = frm; if (frm is IOnlineStatus) { newitem.SetOnlineStatusInterface((IOnlineStatus)frm); } newitem.ToolTipText = "Right-Click to close. Middle-Click to minimize."; newitem.MouseUp += ItemClicked; return(newitem); }
/// <summary> /// Adds a menu item for the specified child to the specified parent menu item. /// </summary> /// <param name="parent"></param> /// <param name="child"></param> /// <param name="targetMenu"></param> private void AddChildMenu(ExtendedForm parent, ExtendedForm child, ToolStripItemCollection targetMenu) { // If this window list parent is the direct parent of the child, // add the child menu item to the top/root menu. if (parent == this.parentForm) { // Always add the Sibi form to the top of the menu, // all others can go below. if (child is SibiMainForm) { targetMenu.Insert(0, NewMenuItem(child)); } else { targetMenu.Add(NewMenuItem(child)); } } else { // If this window list parent is not the direct parent of the child, // iterate and recurse through all the menu items until we find the // item which targets the parent, and add to or start a new sub menu. foreach (var item in targetMenu) { // Ignore seperators. if (item is OnlineStatusMenuItem) { var statusItem = (OnlineStatusMenuItem)item; // Add the child menu item to the sub menu of the matching parent item. if (statusItem.TargetForm == parent) { statusItem.DropDownItems.Add(NewMenuItem(child)); } // Recurse with sub menu items. if (statusItem.HasDropDownItems) { AddChildMenu(parent, child, statusItem.DropDownItems); } } } } }
/// <summary> /// Removes the menu item for the specified child form. /// </summary> /// <param name="child"></param> /// <param name="targetMenu"></param> private void RemoveChildMenu(ExtendedForm child, ToolStripItemCollection targetMenu) { // Must use a regular 'for' block because we are going to modify the collection. // Iterate and recurse all menu items and remove any items that match the specified child form. for (int i = 0; i < targetMenu.Count; i++) { // Ignore seperators. if (targetMenu[i] is OnlineStatusMenuItem) { OnlineStatusMenuItem item = (OnlineStatusMenuItem)targetMenu[i]; if (item.TargetForm == child) { DisposeDropDownItem(item); } if (item.HasDropDownItems) { RemoveChildMenu(child, item.DropDownItems); } } } }
private void SetTheme(ExtendedForm parent) { Icon = parent.Icon; GridTheme = parent.GridTheme; }
public ExtendedForm(ExtendedForm parentForm, MappedObject currentObject) : this(parentForm, currentObject.Guid) { }
public void RemoveChild(ExtendedForm child) { childForms.Remove(child); child.Disposed -= Child_Disposed; OnChildRemoved(this, child); }
public ExtendedForm(ExtendedForm parentForm) : this(parentForm, string.Empty) { }
private void WindowListForm_ChildRemoved(object sender, ExtendedForm e) { RemoveChildMenu(e, dropDownControl.DropDownItems); dropDownControl.Text = CountText(windowListForm.ChildFormCount()); SetVisibility(); }
private void OnChildRemoved(ExtendedForm parent, ExtendedForm child) { ChildRemoved?.Invoke(parent, child); parentForm?.OnChildRemoved(parent, child); }
protected override void Dispose(bool disposing) { targetForm = null; onlineStatusInterface = null; base.Dispose(disposing); }
public MunisToolBar(ExtendedForm parentForm) { InitDropDown(); InitToolItems(parentForm); }