示例#1
0
文件: WTray.cs 项目: rfc1459/wtray
        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();
        }
示例#2
0
文件: WTray.cs 项目: rfc1459/wtray
        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();
        }