/// <summary> /// コンテキストメニューの再描画 /// </summary> public bool RefreshContextMenu(IEnumerable <AbstractManager> managers) { //コンテキストメニューの3項目目以降を削除 while (ContextMenuStrip.Items.Count > 2) { ContextMenuStrip.Items.RemoveAt(0); } //コンテキストメニューの配信情報を初期化 ContextMenuList.Clear(); //配信中のお気に入り配信を追加 foreach (AbstractManager manager in managers) { ContextMenuList.AddRange(manager.GetFavoriteLiveOnly()); } //配信がなければfalseを返す if (ContextMenuList.Count <= 0) { return(false); } //セパレータを追加 ContextMenuStrip.Items.Insert(0, new ToolStripSeparator()); foreach (StreamClass sc in ContextMenuList) { //セパレータの上に配信を追加 ToolStripMenuItem tsi = new ToolStripMenuItem(sc.Owner, null, ContextMenu_Clicked); ContextMenuStrip.Items.Insert(ContextMenuStrip.Items.Count - 3, tsi); } return(true); }
private void SetTrack(ContextMenuList sender) { CloseMenu(); var item = sender.GetSelected(); if (item != null) { this.mainC.Exec(item.Command, item.Argument?.Invoke()); } }