internal ObedienceContext() { //Instantiate the component Module to hold everything _components = new System.ComponentModel.Container(); Trace.Listeners.Add(new TextWriterTraceListener("C:\\temp\\Obedience.log")); //Instantiate the NotifyIcon attaching it to the components container and //provide it an icon, note, you can imbed this resource _notifyIcon = new NotifyIcon(_components); _notifyIcon.Icon = Resources.AppIcon; _notifyIcon.Text = "Obedience"; _notifyIcon.Visible = true; //Instantiate the context menu and items var contextMenu = new ContextMenuStrip(); var displayForm = new ToolStripMenuItem(); var exitApplication = new ToolStripMenuItem(); //Attach the menu to the notify icon _notifyIcon.ContextMenuStrip = contextMenu; //Setup the items and add them to the menu strip, adding handlers to be created later displayForm.Text = "Do something"; displayForm.Click += mDisplayForm_Click; contextMenu.Items.Add(displayForm); exitApplication.Text = "Exit"; exitApplication.Click += mExitApplication_Click; contextMenu.Items.Add(exitApplication); Trace.WriteLine("Obedience started"); scanner = new AcdController(new IPEndPoint(new IPAddress(new byte[] {10, 0, 3, 220}), 5003)); //scanner.Reboot(); Trace.AutoFlush = true; scanner.ConnectedChanged += new ConnectedChangedEventHandler(scanner_ConnectedChanged); }
internal ObedienceContext() { //Instantiate the component Module to hold everything _components = new System.ComponentModel.Container(); Trace.Listeners.Add(new TextWriterTraceListener("C:\\temp\\Obedience.log")); //Instantiate the NotifyIcon attaching it to the components container and //provide it an icon, note, you can imbed this resource _notifyIcon = new NotifyIcon(_components); _notifyIcon.Icon = Resources.AppIcon; _notifyIcon.Text = "Obedience"; _notifyIcon.Visible = true; //Instantiate the context menu and items var contextMenu = new ContextMenuStrip(); var displayForm = new ToolStripMenuItem(); var exitApplication = new ToolStripMenuItem(); //Attach the menu to the notify icon _notifyIcon.ContextMenuStrip = contextMenu; //Setup the items and add them to the menu strip, adding handlers to be created later displayForm.Text = "Do something"; displayForm.Click += mDisplayForm_Click; contextMenu.Items.Add(displayForm); exitApplication.Text = "Exit"; exitApplication.Click += mExitApplication_Click; contextMenu.Items.Add(exitApplication); Trace.WriteLine("Obedience started"); scanner = new AcdController(new IPEndPoint(new IPAddress(new byte[] { 10, 0, 3, 220 }), 5003)); //scanner.Reboot(); Trace.AutoFlush = true; scanner.ConnectedChanged += new ConnectedChangedEventHandler(scanner_ConnectedChanged); }