Exemplo n.º 1
0
        public LogiLockLEDApp()
        {
            appCon = new SynchronizationContext();

            ledSettings = new LedSettings();
            ledSettings.LoadSettings();

            configWindow = new ConfigurationForm(ref ledSettings);
            configWindow.SettingsUpdated += ConfigWindow_OnSettingsUpdated;
            popupWindow = new IndicatorPopup();
            popupWindow.Configure(ledSettings);

            ledThread = new LedThread(ref ledSettings);
            ledThread.KeylockUpdated += ledThread_OnKeylockUpdated;
            ledThread.StartThread();

            configEnableItem = new MenuItem("Enabled", new EventHandler(ToggleEnabled))
            {
                Checked = ledSettings.EnableKeyLockLEDs
            };

            notifyIcon      = new NotifyIcon();
            notifyIcon.Icon = Properties.Resources.appicon;
            contextMenu     = new ContextMenu(new MenuItem[] {
                new MenuItem("LogiLockLED")
                {
                    Enabled = false
                },
                new MenuItem("-"),
                configEnableItem,
                new MenuItem("Configuration", new EventHandler(ShowConfig)),
                new MenuItem("Restart App", new EventHandler(Restart)),
                new MenuItem("Exit", new EventHandler(Exit))
            });
            notifyIcon.ContextMenu  = contextMenu;
            notifyIcon.DoubleClick += ShowConfig;
            notifyIcon.Visible      = true;

            trayManager = new TrayManager(ledSettings);

            SystemEvents.PowerModeChanged += OnPowerModeChange;
            SystemEvents.SessionSwitch    += OnSystemSessionSwitch;
        }
Exemplo n.º 2
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     ledSettings.LoadSettings();
     PopulateSettingsToUI();
     this.Close();
 }