public MainWindow(ProxySwitcher switcher) { InitializeComponent(); ThemeManager.Current.ChangeTheme(this, "Dark.Blue"); _proxySwitcher = switcher; var proxyViewSource = (CollectionViewSource)FindResource("ProxyViewSource"); proxyViewSource.Source = new object[] { _buttonContent }; SetProxyViewSource(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); _proxySwitcher = new ProxySwitcher(); var window = new MainWindow(_proxySwitcher); window.Closing += MainWindow_Closing; window.Deactivated += MainWindowOnDeactivated; window.SwitchRefresh += WindowOnSwitchRefresh; MainWindow = window; _notifyIcon = new NotifyIcon(); _notifyIcon.MouseClick += ShowMainWindow; _notifyIcon.Visible = true; CreateContextMenu(); ChangeContextMenuStripItemsByProxyState(); }