/// <summary> /// Constructs a SysTrayContextMenu /// </summary> /// <param name="mainForm"></param> public SysTrayContextMenu(MainForm mainForm) { this.mainForm = mainForm; this.statusMenu = new StatusMenu("Global Status", new EventHandler(OnStatusClick)); this.MenuItems.Add(this.statusMenu); this.MenuItems.Add("-"); this.MenuItems.Add("Connect All", new EventHandler(OnConnectAll)); this.MenuItems.Add("Disconnect All", new EventHandler(OnDisconnectAll)); this.MenuItems.Add("-"); this.MenuItems.Add("Options", new EventHandler(OnOptions)); this.MenuItems.Add("-"); this.MenuItems.Add("Exit", new EventHandler(OnExit)); }
/// <summary> /// Constructs a ProtocolMenu /// </summary> /// <param name="mainForm"></param> /// <param name="protocol"></param> public ProtocolMenu(MainForm mainForm, Protocol protocol) { this.mainForm = mainForm; this.protocol = protocol; this.protocol.AddListener(this); // add connect and disconnect menu items this.statusMenu = new StatusMenu("Status", new EventHandler(OnStatusClick)); foreach (StatusMenuItem item in this.statusMenu.MenuItems) { item.RadioCheck = true; item.Checked = item.Status == this.protocol.Settings.Status; } this.MenuItems.Add(statusMenu); this.MenuItems.Add("-"); this.connectItem = new WinForms.MenuItem("Connect", new EventHandler(connectMenuItem_Click)); this.MenuItems.Add(this.connectItem); this.disconnectItem = new WinForms.MenuItem("Disconnect", new EventHandler(disconnectMenuItem_Click)); this.disconnectItem.Enabled = false; this.MenuItems.Add(this.disconnectItem); this.MenuItems.Add("-"); this.optionsItem = new WinForms.MenuItem("Options", new EventHandler(optionsMenuItem_Click)); this.MenuItems.Add(this.optionsItem); this.MenuItems.Add("-"); this.addFriendItem = new WinForms.MenuItem("Add friend", new EventHandler(addfriendMenuItem_Click)); this.addFriendItem.Enabled = false; this.MenuItems.Add(this.addFriendItem); this.MenuItems.Add("-"); this.debugReportItem = new WinForms.MenuItem("Debug Report", new EventHandler(debugReportMenuItem_Click)); this.MenuItems.Add(this.debugReportItem); this.Disposed += new EventHandler(OnDispose); // this.MenuItems.Add("Self Destruct", new EventHandler(selfdestruct_click)); }