当前位置: 首页>>代码示例>>C#>>正文


C# ContextMenu.Show方法代码示例

本文整理汇总了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 ) ;
        }
    }
开发者ID:alannet,项目名称:example,代码行数:38,代码来源:Data.cs

示例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();
 }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:9,代码来源:AdminWindow.cs

示例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);
            }
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:38,代码来源:AdminWindow.cs

示例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; });
		}
开发者ID:pjcollins,项目名称:monodevelop,代码行数:40,代码来源:DockItem.cs

示例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();
                }
            }
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:44,代码来源:RecommendationsWindow.cs

示例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);
            }
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:33,代码来源:FanartWindow.cs

示例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);
            }
        }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:59,代码来源:AnimeInfoWindow.cs

示例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);
     }
 }
开发者ID:japanesemediamanager,项目名称:animeplugin3,代码行数:16,代码来源:RelationsWindow.cs


注:本文中的ContextMenu.Show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。