本文整理汇总了C#中ContextMenu.AddAction方法的典型用法代码示例。如果您正苦于以下问题:C# ContextMenu.AddAction方法的具体用法?C# ContextMenu.AddAction怎么用?C# ContextMenu.AddAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContextMenu
的用法示例。
在下文中一共展示了ContextMenu.AddAction方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: 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);
}
}
示例3: 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();
}
}
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: 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);
}
}