Esempio n. 1
0
        /// <summary>
        /// 托盘的右键菜单单击事件
        /// </summary>
        private void toolStripSubMenu_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;

            if (toolStripMenuItem.Name == MenuName_Exit)
            {
                //取消注册热键
                HotKey.UnregisterHotKey(this.Handle, _winQKey);
                HotKey.GlobalDeleteAtom(_winQKey);

                //退出
                this.Close();

                //(Exit)
                Application.Exit();
            }
            else
            {
                //打开文件
                BoxFile selectBoxFileItem = toolStripMenuItem.Tag as BoxFile;
                bool    state             = Utils.StartFile(selectBoxFileItem.Path);
                if (!state)
                {
                    MessageUtil.ShowTips(string.Format("文件“{0}”不存在。", selectBoxFileItem.Name));
                }
                selectBoxFileItem = null;
            }
            toolStripMenuItem = null;
        }