本文整理汇总了C#中ContextMenu.Show方法的典型用法代码示例。如果您正苦于以下问题:C# ContextMenu.Show方法的具体用法?C# ContextMenu.Show怎么用?C# ContextMenu.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContextMenu
的用法示例。
在下文中一共展示了ContextMenu.Show方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopupMenu
/// <summary>
/// Display the popup menu for this row
/// </summary>
/// <param name="parent">The parent control</param>
/// <param name="x">X coordinate of menu</param>
/// <param name="y">Y coordinate of menu</param>
public void PopupMenu( System.Windows.Forms.Control parent , int x , int y )
{
// Use reflection to get the list of popup menu commands
MemberInfo[] members = this.GetType().FindMembers ( MemberTypes.Method ,
BindingFlags.Public | BindingFlags.Instance ,
new System.Reflection.MemberFilter ( Filter ) ,
null ) ;
if ( members.Length > 0 )
{
// Create a context menu
ContextMenu menu = new ContextMenu ( ) ;
// Now loop through those members and generate the popup menu
// Note the cast to MethodInfo in the foreach
foreach ( MethodInfo meth in members )
{
// Get the caption for the operation from the ContextMenuAttribute
ContextMenuAttribute[] ctx = (ContextMenuAttribute[]) meth.GetCustomAttributes ( typeof ( ContextMenuAttribute ) , true ) ;
MenuCommand callback = new MenuCommand ( this , meth ) ;
MenuItem item = new MenuItem ( ctx[0].Caption , new EventHandler ( callback.Execute ) ) ;
item.DefaultItem = ctx[0].Default ;
menu.MenuItems.Add ( item ) ;
}
System.Drawing.Point pt = new System.Drawing.Point ( x , y ) ;
menu.Show ( parent , pt ) ;
}
}
示例2: ShowMoreOptionsMenu
private ContextMenuAction ShowMoreOptionsMenu()
{
ContextMenu cmenu = new ContextMenu(Translation.Options);
cmenu.AddAction(Translation.ScanDropFolder, ScanDropFolder);
cmenu.AddAction(Translation.RemoveRecordsWithoutFile, RemoveMissingFiles);
cmenu.AddAction(Translation.SyncVotes, SyncVotes);
cmenu.AddAction(Translation.SyncMyList, SyncMyList);
return cmenu.Show();
}
示例3: OnShowContextMenu
protected override void OnShowContextMenu()
{
try
{
GUIListItem currentitem = m_Facade.SelectedListItem;
if (currentitem == null)
return;
VideoLocalVM vid = currentitem.TVTag as VideoLocalVM;
if (vid == null)
return;
ContextMenu cmenu = new ContextMenu(Translation.FileOptions);
cmenu.AddAction(Translation.PlayFile, () => MainWindow.vidHandler.ResumeOrPlay(vid));
cmenu.AddAction(Translation.RehashFile, () =>
{
JMMServerVM.Instance.clientBinaryHTTP.RehashFile(vid.VideoLocalID);
DialogProcess();
});
cmenu.AddAction(Translation.IgnoreFile, () =>
{
JMMServerVM.Instance.clientBinaryHTTP.SetIgnoreStatusOnFile(vid.VideoLocalID, true);
RefreshUnlinkedFiles();
});
cmenu.AddAction(Translation.DeleteFileFromDisk, () =>
{
if (!Utils.DialogConfirm(Translation.AreYouSureYouWantDeleteFile)) return;
foreach(VideoLocal_PlaceVM p in vid.Places)
JMMServerVM.Instance.clientBinaryHTTP.DeleteVideoLocalPlaceAndFile(p.VideoLocal_Place_ID);
RefreshUnlinkedFiles();
});
cmenu.Show();
}
catch (Exception ex)
{
BaseConfig.MyAnimeLog.Write("Error in menu: {0}", ex);
}
}
示例4: ShowDockPopupMenu
internal void ShowDockPopupMenu (Gtk.Widget parent, Gdk.EventButton evt)
{
var menu = new ContextMenu ();
ContextMenuItem citem;
// Hide menuitem
if ((Behavior & DockItemBehavior.CantClose) == 0) {
citem = new ContextMenuItem (Catalog.GetString ("Hide"));
citem.Clicked += delegate { Visible = false; };
menu.Add (citem);
}
// Auto Hide menuitem
if ((Behavior & DockItemBehavior.CantAutoHide) == 0 && Status != DockItemStatus.AutoHide) {
citem = new ContextMenuItem (Catalog.GetString ("Minimize"));
citem.Clicked += delegate { Status = DockItemStatus.AutoHide; };
menu.Add (citem);
}
if (Status != DockItemStatus.Dockable) {
// Dockable menuitem
citem = new ContextMenuItem (Catalog.GetString ("Dock"));
citem.Clicked += delegate { Status = DockItemStatus.Dockable; };
menu.Add (citem);
}
// Floating menuitem
if ((Behavior & DockItemBehavior.NeverFloating) == 0 && Status != DockItemStatus.Floating) {
citem = new ContextMenuItem (Catalog.GetString ("Undock"));
citem.Clicked += delegate { Status = DockItemStatus.Floating; };
menu.Add (citem);
}
if (menu.Items.Count == 0) {
return;
}
ShowingContextMenu = true;
menu.Show (parent, evt, () => { ShowingContextMenu = true; });
}
示例5: OnShowContextMenu
protected override void OnShowContextMenu()
{
GUIListItem currentitem = this.m_Facade.SelectedListItem;
if (currentitem == null) return;
if (currentitem.TVTag.GetType() == typeof(RecommendationVM))
{
RecommendationVM rec = currentitem.TVTag as RecommendationVM;
if (rec != null)
{
ContextMenu cmenu = new ContextMenu(rec.Recommended_DisplayName);
cmenu.AddAction(Translation.DontShowThisAnime, () =>
{
int recType = 1;
if (dummyModeDownload != null && dummyModeDownload.Visible)
recType = 2;
JMMServerVM.Instance.clientBinaryHTTP.IgnoreAnime(rec.RecommendedAnimeID, recType, JMMServerVM.Instance.CurrentUser.JMMUserID);
LoadData();
});
cmenu.AddAction(Translation.BookmarkThisAnime, () =>
{
BookmarkedAnimeVM bookmark = new BookmarkedAnimeVM();
bookmark.AnimeID = rec.RecommendedAnimeID;
bookmark.Downloading = 0;
bookmark.Notes = "";
bookmark.Priority = 1;
if (bookmark.Save())
Utils.DialogMsg(Translation.Sucess, Translation.BookmarkCreated);
});
cmenu.AddAction(Translation.CreateSeriesForAnime, () =>
{
JMMServerBinary.Contract_AnimeSeries_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.CreateSeriesFromAnime(
rec.RecommendedAnimeID, null, JMMServerVM.Instance.CurrentUser.JMMUserID);
if (string.IsNullOrEmpty(resp.ErrorMessage))
Utils.DialogMsg(Translation.Sucess, Translation.SeriesCreated);
else
Utils.DialogMsg(Translation.Error, resp.ErrorMessage);
});
cmenu.Show();
}
}
}
示例6: OnShowContextMenu
protected override void OnShowContextMenu()
{
try
{
GUIListItem currentitem = m_Facade.SelectedListItem;
if (currentitem == null || !(currentitem.TVTag is FanartContainer)) return;
FanartContainer selectedFanart = currentitem.TVTag as FanartContainer;
ContextMenu cmenu = new ContextMenu(Translation.Fanart);
cmenu.AddAction(selectedFanart.IsImageEnabled ? Translation.Disable : Translation.Enable, () =>
{
bool endis = !selectedFanart.IsImageEnabled;
JMMServerHelper.EnableDisableFanart(endis, selectedFanart, AnimeID);
ShowFanart();
});
if (selectedFanart.IsImageEnabled)
{
cmenu.AddAction(selectedFanart.IsImageDefault ? Translation.RemoveAsDefault : Translation.SetAsDefault, () =>
{
bool isdef = !selectedFanart.IsImageDefault;
JMMServerHelper.SetDefaultFanart(isdef, selectedFanart, AnimeID);
ShowFanart();
});
}
cmenu.Show();
}
catch (Exception ex)
{
BaseConfig.MyAnimeLog.Write("Exception in Fanart Chooser Context Menu: " + ex.Message + ex.StackTrace);
}
}
示例7: OnShowContextMenu
protected override void OnShowContextMenu()
{
try
{
AniDB_VoteVM userVote = MainAnime.UserVote;
ContextMenu cmenu = new ContextMenu(MainAnime.FormattedTitle);
cmenu.AddAction(Translation.UpdateSeriesInfo, () =>
{
MainWindow.ServerHelper.UpdateAnime(MainAnime.AnimeID);
SetGUIProperty(GuiProperty.AnimeInfo_DownloadStatus, Translation.WaitingOnServer + "...");
});
cmenu.AddAction(Translation.SearchForTorrents, () => DownloadHelper.SearchAnime(MainAnime));
if (userVote == null && JMMServerVM.Instance.CurrentUser.IsAniDBUserBool)
{
cmenu.AddAction(Translation.PermanentVote, () =>
{
decimal rating = Utils.PromptAniDBRating(MainAnime.FormattedTitle);
if (rating > 0)
{
JMMServerVM.Instance.clientBinaryHTTP.VoteAnime(MainAnime.AnimeID, rating, (int)VoteType.AnimePermanent);
LoadInfo();
SetSkinProperties();
InfoPage();
}
});
cmenu.AddAction(Translation.TemporaryVote, () =>
{
decimal rating = Utils.PromptAniDBRating(MainAnime.FormattedTitle);
if (rating > 0)
{
JMMServerVM.Instance.clientBinaryHTTP.VoteAnime(MainAnime.AnimeID, rating, (int)VoteType.AnimeTemporary);
LoadInfo();
SetSkinProperties();
InfoPage();
}
});
}
if (userVote != null && JMMServerVM.Instance.CurrentUser.IsAniDBUserBool)
{
cmenu.AddAction(Translation.RevokeVote, () =>
{
JMMServerVM.Instance.clientBinaryHTTP.VoteAnimeRevoke(MainAnime.AnimeID);
LoadInfo();
SetSkinProperties();
InfoPage();
});
}
cmenu.Show();
}
catch (Exception ex)
{
BaseConfig.MyAnimeLog.Write("Error in menu: {0}", ex);
}
}
示例8: OnShowContextMenu
protected override void OnShowContextMenu()
{
try
{
ContextMenu cmenu = new ContextMenu(Translation.Relations);
cmenu.AddAction(Translation.SearchForTorrents, () =>
{
DownloadHelper.SearchAnime(mainAnime);
});
cmenu.Show();
}
catch (Exception ex)
{
BaseConfig.MyAnimeLog.Write("Error in menu: {0}", ex);
}
}