public MenuItem(string name, Action command, HybridIcon icon, ShortcutKey key, Func<bool> can_be_clicked) { this.can_be_clicked = can_be_clicked; item = new ToolStripMenuItem(name) { Image = icon, ShortcutKeys = key, Enabled = can_be_clicked() }; item.Click += (o, e) => command(); task_tray_item = new System.Windows.Forms.MenuItem(name) {ShowShortcut = true, Enabled = can_be_clicked()}; task_tray_item.Click += (o, e) => command(); }
public ShortcutKey and(ShortcutKey other_key) { return new ShortcutKey(key | other_key.key); }