Beispiel #1
0
            public static void WorkModeMenuItem_Click(object sender, bool bySoft)
            {
                var it       = sender as ToolStripMenuItem;
                var parentIt = it.OwnerItem as ToolStripMenuItem;
                var mode     = (WorkModeEnum)it.Tag;
                var nick     = parentIt.Tag.ToString();

                if (bySoft)
                {
                    WorkModeMenuItemHelper.SetWorkMode(it, parentIt, mode, nick);
                }
                else
                {
                    var premode = WorkModeHelper.GetWorkMode(nick);
                    Util.Assert(premode > WorkModeEnum.Unknown);
                    if (premode != mode)
                    {
                        if (premode == WorkModeEnum.NoUse)
                        {
                            WorkModeMenuItemHelper.SetWorkMode(it, parentIt, mode, nick);
                        }
                        else
                        {
                            WorkModeMenuItemHelper.CloseWorkMode(premode, nick);
                            WorkModeMenuItemHelper.SetWorkMode(it, parentIt, mode, nick);
                        }
                    }
                }
            }
Beispiel #2
0
            private static void SetWorkMode(ToolStripMenuItem mi, ToolStripMenuItem parent, WorkModeEnum mode, string nick)
            {
                parent.Image = WorkModeMenuItemHelper.GetWorkModeImage(mode);
                WorkModeMenuItemHelper.SelectedMenuItem(parent, mi, mode);
                WorkModeHelper.SetWorkMode(nick, mode);
                switch (mode)
                {
                case WorkModeEnum.Assist:
                    AssistModeHelper.Create(nick);
                    break;

                case WorkModeEnum.NoUse:
                    break;

                default:
                    Util.ThrowException("WorkMode为Unknow");
                    break;
                }
            }
Beispiel #3
0
 private static void ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     WorkModeMenuItemHelper.WorkModeMenuItem_Click(sender, e == null);
 }