Example #1
0
        static void Main()
        {
#if DEBUG
            var config         = new LoggingConfiguration();
            var debuggerTarget = new DebuggerTarget()
            {
                Layout = "${processtime} ${message:exceptionSeparator=\n\t:withException=true}"
            };
            config.AddTarget("debugger", debuggerTarget);
            config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, debuggerTarget));

            LogManager.Configuration = config;
#endif

            _log.Debug($"adrilight {VersionNumber}: Main() started.");

            AppDomain.CurrentDomain.UnhandledException +=
                (sender, args) => ApplicationOnThreadException(sender, args.ExceptionObject as Exception);

            Settings.Load();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += (sender, args) => ApplicationOnThreadException(sender, args.Exception);

            Application.ApplicationExit   += (s, e) => _log.Debug("Application exit!");
            SystemEvents.PowerModeChanged += (s, e) => _log.Debug("Changing Powermode to {0}", e.Mode);

            SetupNotifyIcon();

            //subscribe for changes in the settings
            Properties.Settings.Default.PropertyChanged += (s, e) => SpotSet.Refresh();
            //exeucte once to setup the leds
            SpotSet.Refresh();

            //subscribe for changes in the settings
            Properties.Settings.Default.PropertyChanged += (s, e) => RefreshCapturingState();
            //exeucte once to start the capturing initially
            RefreshCapturingState();


            //subscribe for changes in the settings
            Properties.Settings.Default.PropertyChanged += (s, e) => RefreshTransferState();
            //exeucte once to start the serial stream initially
            RefreshTransferState();


            if (!Settings.StartMinimized)
            {
                OpenSettingsWindow();
            }
            Application.Run();
        }
Example #2
0
 private void RefreshAll()
 {
     SpotSet.Refresh();
     RefreshFields();
     RefreshOverlay();
 }