public MainWindow()
        {
            DataContext = this;
            InitializeComponent();
            var descriptor = DependencyPropertyDescriptor.FromProperty(ArduinoPathProperty, typeof(Control));

            //NOTE this would be a concerning memory leak, if this was not the main window that ran the entire lifetime of the app anyways.
            //essentially, it attaches a reference to this window to the static dependency property, which prevents garbage collection. If this were a helper window,
            //we'd have to wrap this in a weak reference.
            descriptor.AddValueChanged(this, delegate {
                ProgrammerInfo[] programmers         = GetAllProgrammers(ArduinoPath).ToArray();
                ProgrammerInfo oldSelectedProgrammer = SelectedProgrammer;
                Programmers        = programmers;
                SelectedProgrammer = oldSelectedProgrammer != null ? Programmers.FirstOrDefault(p => p.Name == oldSelectedProgrammer.Name) : null;
                UpdateValidationState();
            });


            descriptor = DependencyPropertyDescriptor.FromProperty(SelectedProgrammerProperty, typeof(Control));
            descriptor.AddValueChanged(this, delegate
            {
                UpdateValidationState();
            });


            descriptor = DependencyPropertyDescriptor.FromProperty(SelectedPortProperty, typeof(Control));
            descriptor.AddValueChanged(this, delegate
            {
                UpdateValidationState();
            });
        }
        void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (Settings.Default.CheckForUpdates)
            {
                CheckForUpdates();
            }
            //Temp
            ProgrammerInfo[] programmers = GetAllProgrammers(Settings.Default.ArduinoPath).ToArray();
            Programmers = programmers;
            string[] ports = SerialPort.GetPortNames();
            ProgrammerPorts = ports;
            //end temp

            if (Settings.Default.WindowWidth > 0)
            {
                Width = Settings.Default.WindowWidth;
            }

            if (Settings.Default.WindowHeight > 0)
            {
                Height = Settings.Default.WindowHeight;
            }

            if (Settings.Default.WindowIsMaximized)
            {
                WindowState = WindowState.Maximized;
            }

            AppVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            ArduinoPath = Settings.Default.ArduinoPath;

            SelectedProgrammer = Programmers.FirstOrDefault(p => p.Name == Settings.Default.SelectedPogrammer);
            SelectedPort       = Settings.Default.SelectedPort;

            _browser.UseHttpActivityObserver = true;

            _browser.AddMessageEventListener("isAppHosted", (string s) => NotifyWebAppisHosted(s));
            _browser.CreateWindow += _browser_CreateWindow;

            _browser.EnableJavascriptDebugger();
            string fullWebRoot =
                IOPath.Combine(IOPath.GetDirectoryName(Assembly.GetExecutingAssembly().Location), StaticConfig.LocalWebRootPath);

            _browser.Navigate("file:///" + fullWebRoot);
        }