Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        void _passContextMenu_Opened(object sender, EventArgs e)
        {
            ContextMenuStrip cms = (sender as ContextMenuStrip);

            if (cms == null)
            {
                return;
            }
            for (int i = 0; i < cms.Items.Count; i++)
            {
                ToolStripMenuItem tsi = cms.Items[i] as ToolStripMenuItem;
                if (tsi == null)
                {
                    continue;
                }
                if (tsi.Tag == null)
                {
                    continue;
                }
                int commandId = Convert.ToInt32(tsi.Tag);
                if (_passCheckHelper.PassPopMenuEnable(commandId.ToString()))
                {
                    tsi.Enabled = true;
                }
                else
                {
                    tsi.Enabled = false;
                }
                for (int j = 0; j < tsi.DropDownItems.Count; j++)
                {
                    ToolStripMenuItem tsisub = tsi.DropDownItems[j] as ToolStripMenuItem;
                    if (tsisub.Tag == null)
                    {
                        continue;
                    }
                    int commandIdsub = Convert.ToInt32(tsisub.Tag);
                    if (_passCheckHelper.PassPopMenuEnable(commandIdsub.ToString()))
                    {
                        tsisub.Enabled = true;
                    }
                    else
                    {
                        tsisub.Enabled = false;
                    }
                }
            }
        }
Beispiel #2
0
        void TagToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int commandId = Convert.ToInt32((sender as System.Windows.Forms.ToolStripMenuItem).Tag);

            if (_passCheckhlp != null)
            {
                if (_passCheckhlp.PassPopMenuEnable(commandId.ToString()))
                {
                    _passCheckhlp.DoCommand(commandId);
                }
            }
        }