/// <summary> /// Deletes a Miller's Column item from the list. /// </summary> /// /// <param name="ItemToDelete"> /// The Miller's Column item to delete from the list. /// </param> /// /// <returns> /// True to indicate the item was successfully deleted and false if not. /// </returns> /// private bool RemoveMillerItem(IMillerItem ItemToDelete) { bool itemRemoved = false; if (ItemToDelete != null && ItemToDelete is Control) { ItemToDelete.MillerItemSelected -= MillerColumnItemSelected; if (this.ItemsCanBeMoved) { (ItemToDelete as IDraggable).DragObject.MouseDown -= DragObject_MouseDown; (ItemToDelete as IDraggable).DragObject.MouseUp -= DragObject_MouseUp; (ItemToDelete as IDraggable).DragObject.MouseMove -= DragObject_MouseMove; } if (this.Items != null) { this.Items.Remove(ItemToDelete); } if (this.flowLayoutPanelItems.Controls.Contains(ItemToDelete as Control)) { this.flowLayoutPanelItems.Controls.Remove(ItemToDelete as Control); } itemRemoved = true; } return(itemRemoved); }
/// <summary> /// Adds a Miller's Column item to the list. /// </summary> /// /// <param name="ItemToAdd"> /// The Miller's Column item to add to the list. /// </param> /// /// <returns> /// True to indicate the item was successfully added and false if not. /// </returns> /// private bool AddMillerItem(IMillerItem ItemToAdd) { bool itemAdded = false; if (ItemToAdd != null && ItemToAdd is Control) { ItemToAdd.MillerItemSelected += MillerColumnItemSelected; if (this.ItemsCanBeMoved) { (ItemToAdd as IDraggable).DragObject.MouseDown += DragObject_MouseDown; (ItemToAdd as IDraggable).DragObject.MouseUp += DragObject_MouseUp; (ItemToAdd as IDraggable).DragObject.MouseMove += DragObject_MouseMove; } if (this.Items == null) { this.Items = new List <IMillerItem>(); } this.Items.Add(ItemToAdd); this.flowLayoutPanelItems.Controls.Add(ItemToAdd as Control); itemAdded = true; } return(itemAdded); }
/// <summary> /// Fires the MillerColumnDeleted event if there are any listeners. /// </summary> /// private void OnMillerColumnDeleted(IMillerItem DeletedItem) { if (this.MillerItemDeleted != null) { this.MillerItemDeleted(this, new MillerItemEventArgs(DeletedItem)); } }
/// <summary> /// Fires the MillerColumnAdded event if there are any listeners. /// </summary> /// private void OnMillerColumnAdded(IMillerItem AddedItem) { if (this.MillerItemAdded != null) { this.MillerItemAdded(this, new MillerItemEventArgs(AddedItem)); } }
/// <summary> /// Adds a new Miller's Column item to the list. /// </summary> /// /// <param name="NewItem"> /// The item to add. /// </param> /// /// <returns> /// True if the item was added successfully and false if not. /// </returns> /// public bool AddItem(IMillerItem NewItem) { bool itemAdded = this.AddMillerItem(NewItem); if (itemAdded) { this.OnMillerColumnAdded(NewItem); this.flowLayoutPanelItems.ScrollControlIntoView(NewItem as Control); } return(itemAdded); }
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e) { List <IMillerItem> childItems = null; IMillerItem parentItem = e.Argument as IMillerItem; if (parentItem != null && this.GetChildItems != null) { childItems = this.GetChildItems(parentItem.ID); } e.Result = childItems; }
/// <summary> /// Removes an item from this control's list. /// </summary> /// /// <param name="ItemToRemove"> /// The Miller's Column Item to remove from this control. /// </param> /// /// <returns> /// True to indicate the item has been removed and false to indicate an error. /// </returns> /// public bool RemoveItem(IMillerItem ItemToRemove) { bool itemRemoved = false; if (ItemToRemove != null) { itemRemoved = this.RemoveMillerItem(ItemToRemove); this.OnMillerColumnDeleted(ItemToRemove); this.SelectedItem = null; } return(itemRemoved); }
/// <summary> /// Retrieves and adds any child items for a specified parent to the Miller's Column control that is /// the child of this control. /// </summary> /// /// <param name="ParentItem"> /// The item considered the parent to use for finding the child items. /// </param> /// private void ShowChildItems(IMillerItem ParentItem) { if (ParentItem != null) { if (this.ChildControl != null) { if (this.GetChildItems != null) { // Perform the retrieval of the child items in a different thread then the UI thread. this.backgroundWorker.RunWorkerAsync(ParentItem); } } } }
public MillerItemEventArgs(IMillerItem NewMillerItem) { this.MillerItem = NewMillerItem; }