Example #1
0
        public WTrayApp()
        {
            try
            {
                wmiObj = new AwmiInterface();
            }
            catch (AwmiException)
            {
                ShowErrorMsg(Strings.FatalAwmiError, MessageBoxIcon.Error);
                Environment.Exit(1);
            }
            Camera = new DevEntry(Strings.Webcam, OnCameraToggle);
            CardReader = new DevEntry(Strings.CardReader, OnCardReaderToggle);

            trayMenuStrip = new ContextMenuStrip();
            ToolStripLabel lblDevices = new ToolStripLabel(Strings.Devices);
            lblDevices.Enabled = false;
            ToolStripMenuItem mnuAbout = new ToolStripMenuItem(Strings.About, null, OnAbout);
            ToolStripMenuItem mnuExit = new ToolStripMenuItem(Strings.Exit, null, OnExit);

            trayMenuStrip.Items.Add(lblDevices);
            trayMenuStrip.Items.Add(Camera.MenuItem);
            trayMenuStrip.Items.Add(CardReader.MenuItem);
            trayMenuStrip.Items.Add(new ToolStripSeparator());
            trayMenuStrip.Items.Add(mnuAbout);
            trayMenuStrip.Items.Add(mnuExit);

            trayIcon = new NotifyIcon();
            trayIcon.Text = Strings.WTrayName;
            trayIcon.Icon = new Icon(Icons.WTray, 40, 40);

            trayIcon.ContextMenuStrip = trayMenuStrip;
            trayIcon.Visible = true;
            RefreshDeviceStatus();
        }
Example #2
0
        public WTrayApp()
        {
            try
            {
                wmiObj = new AwmiInterface();
            }
            catch (AwmiException)
            {
                ShowErrorMsg(Strings.FatalAwmiError, MessageBoxIcon.Error);
                Environment.Exit(1);
            }
            Camera     = new DevEntry(Strings.Webcam, OnCameraToggle);
            CardReader = new DevEntry(Strings.CardReader, OnCardReaderToggle);

            trayMenuStrip = new ContextMenuStrip();
            ToolStripLabel lblDevices = new ToolStripLabel(Strings.Devices);

            lblDevices.Enabled = false;
            ToolStripMenuItem mnuAbout = new ToolStripMenuItem(Strings.About, null, OnAbout);
            ToolStripMenuItem mnuExit  = new ToolStripMenuItem(Strings.Exit, null, OnExit);

            trayMenuStrip.Items.Add(lblDevices);
            trayMenuStrip.Items.Add(Camera.MenuItem);
            trayMenuStrip.Items.Add(CardReader.MenuItem);
            trayMenuStrip.Items.Add(new ToolStripSeparator());
            trayMenuStrip.Items.Add(mnuAbout);
            trayMenuStrip.Items.Add(mnuExit);

            trayIcon      = new NotifyIcon();
            trayIcon.Text = Strings.WTrayName;
            trayIcon.Icon = new Icon(Icons.WTray, 40, 40);

            trayIcon.ContextMenuStrip = trayMenuStrip;
            trayIcon.Visible          = true;
            RefreshDeviceStatus();
        }