/// <summary> /// Add an item to the collection /// </summary> /// <param name="text">shown item caption</param> /// <param name="visible">item visibility</param> /// <param name="image">item image</param> /// <param name="itemType">new item type</param> /// <returns>new created item</returns> public virtual TrayMenuItem Add(string text, bool visible, Image image, TrayMenuItemType itemType) { return(Add(text, visible, image, itemType, null)); }
/// <summary> /// Add an item to the collection /// </summary> /// <param name="text">shown item caption</param> /// <param name="visible">item visibility</param> /// <param name="image">item image</param> /// <param name="itemType">new item type</param> /// <param name="control">custom control</param> /// <returns>new created item</returns> public virtual TrayMenuItem Add(string text, bool visible, Image image, TrayMenuItemType itemType, object control) { TrayMenuItem item = null; switch (itemType) { case TrayMenuItemType.Item: item = new TrayMenuItem(_owner, text, visible); break; case TrayMenuItemType.Label: item = new TrayMenuLabelItem(_owner, text, visible); break; case TrayMenuItemType.LinkLabel: item = new TrayMenuLinkLabelItem(_owner, text, visible); break; case TrayMenuItemType.Button: item = new TrayMenuButtonItem(_owner, text, visible); break; case TrayMenuItemType.TextBox: item = new TrayMenuTextboxItem(_owner, text, visible); break; case TrayMenuItemType.CheckBox: item = new TrayMenuCheckboxItem(_owner, text, visible); break; case TrayMenuItemType.Progress: item = new TrayMenuProgressItem(_owner, text, visible); break; case TrayMenuItemType.DropDownList: item = new TrayMenuDropDownListItem(_owner, text, visible); break; case TrayMenuItemType.Separator: item = new TrayMenuSeparatorItem(_owner, text, visible); break; case TrayMenuItemType.Custom: if (!(control is System.Windows.Forms.Control)) { throw new ArgumentOutOfRangeException("control"); } item = new TrayMenuCustomItem(_owner, text, visible, control); break; case TrayMenuItemType.Monitor: item = new TrayMenuMonitorItem(_owner, text, visible); break; case TrayMenuItemType.AutoClose: item = new TrayMenuAutoCloseItem(_owner, text, visible); break; case TrayMenuItemType.Close: item = new TrayMenuCloseItem(_owner, text, visible); break; default: throw new ArgumentOutOfRangeException("itemType"); } item.Image = image; _items.Add(item); RaiseItemAdded(item); return(item); }
/// <summary> /// Add an item to the collection /// </summary> /// <param name="text">shown item caption</param> /// <param name="visible">item visibility</param> /// <param name="imageResourceName">image resource address</param> /// <returns>new created item</returns> public virtual T Add <T>(string text, bool visible, string imageResourceName) where T : TrayMenuItem { TrayMenuItemType type = GetItemType <T>(); return(Add(text, visible, Image.FromStream(ReadRessource(imageResourceName)), type) as T); }
/// <summary> /// Add an item to the collection /// </summary> /// <param name="text">shown item caption</param> /// <param name="itemType">new item type</param> /// <returns>new created item</returns> public virtual TrayMenuItem Add(string text, TrayMenuItemType itemType) { return(Add(text, true, null, itemType)); }
/// <summary> /// Add an item to the collection /// </summary> /// <param name="text">shown item caption</param> /// <param name="visible">item visibility</param> /// <param name="image">item image</param> /// <returns>new created item</returns> public virtual T Add <T>(string text, bool visible, Image image) where T : TrayMenuItem { TrayMenuItemType type = GetItemType <T>(); return(Add(text, visible, image, type) as T); }
/// <summary> /// Add an item to the collection /// </summary> /// <param name="text">shown item caption</param> /// <returns>new created items</returns> public virtual T Add <T>(string text) where T : TrayMenuItem { TrayMenuItemType type = GetItemType <T>(); return(Add(text, true, null, type) as T); }
/// <summary> /// Add an item to the collection /// </summary> /// <returns>new created items</returns> public virtual T Add <T>() where T : TrayMenuItem { TrayMenuItemType type = GetItemType <T>(); return(Add(String.Empty, true, null, type) as T); }
/// <summary> /// Creates an instance of the class /// </summary> /// <param name="type">runtime supported item type</param> public ItemTypeAttribute(TrayMenuItemType type) { Type = type; }
/// <summary> /// Not Supported /// </summary> /// <param name="text"></param> /// <param name="visible"></param> /// <param name="itemType"></param> /// <returns></returns> public override TrayMenuItem Add(string text, bool visible, TrayMenuItemType itemType) { throw new NotSupportedException(); }