示例#1
0
        public ContextMenuStrip NewContextMenu()
        {
            var menu = new ContextMenuStrip();

            menu.AddDefaultItems(this);
            switch (this?.ComputerPanel.ConnectionState)
            {
            case ConnectionState.Online:
            case ConnectionState.OnlineSlow:
                menu.AddOnlineItems(this);
                menu.AddOnlineSlowItems(this);
                break;

            case ConnectionState.OnlineDegraded:
                menu.AddOnlineDegradedItems(this);
                break;

            case ConnectionState.Offline:
                menu.AddOfflineItems(this);
                break;
            }
            return(menu);
        }