Пример #1
0
        private static void CreateMenuItem(CtlNotifyIcon ctlNotifyIcon, ToolStripMenuItem toolStripMenuItem, string nick, WorkModeEnum workMode)
        {
            var assistItem = ctlNotifyIcon.CreateItem("聊天辅助", ToolStripMenuItem_Click, _imgAssist, true, WorkModeEnum.Assist);

            toolStripMenuItem.DropDownItems.Add(assistItem);
            toolStripMenuItem.DropDownItems.Add(ctlNotifyIcon.CreateSeparator());
            var noUseItem = ctlNotifyIcon.CreateItem("不使用", ToolStripMenuItem_Click, _imgNoUse, true, WorkModeEnum.NoUse);

            toolStripMenuItem.DropDownItems.Add(noUseItem);
            if (workMode == WorkModeEnum.NoUse)
            {
                ToolStripMenuItem_Click(noUseItem, null);
            }
            else
            {
                ToolStripMenuItem_Click(assistItem, null);
            }
        }
Пример #2
0
        public static void Create(CtlNotifyIcon ctlNotifyIcon, string nick)
        {
            var it = ctlNotifyIcon.CreateItem(nick, null, null, true, nick);

            ctlNotifyIcon.InsertItem(2, it);
            var workMode = WorkModeHelper.GetWorkMode(nick);

            CreateMenuItem(ctlNotifyIcon, it, nick, workMode);
        }