public MainWindow() { ServiceProvider.RegionProvider = new RegionSelector(); ServiceProvider.MessageProvider = new MessageProvider(); ServiceProvider.WebCamProvider = new WebCamProvider(); FFMpegService.FFMpegDownloader += () => { if (_downloader == null) { _downloader = new FFMpegDownloader(); _downloader.Closed += (s, args) => _downloader = null; } _downloader.ShowAndFocus(); }; InitializeComponent(); ServiceProvider.MainWindow = new MainWindowProvider(this); if (App.CmdOptions.Tray) { Hide(); } // Register for Windows Messages ComponentDispatcher.ThreadPreprocessMessage += (ref MSG Message, ref bool Handled) => { const int WmHotkey = 786; if (Message.message == WmHotkey) { var id = Message.wParam.ToInt32(); ServiceProvider.RaiseHotKeyPressed(id); } }; ServiceProvider.SystemTray = new SystemTray(SystemTray); Closing += (s, e) => { if (!TryExit()) { e.Cancel = true; } }; Loaded += (s, e) => { if (DataContext is MainViewModel vm) { vm.Init(!App.CmdOptions.NoPersist, true, !App.CmdOptions.Reset, !App.CmdOptions.NoHotkeys); } }; }
public MainWindow() { ServiceProvider.Register <IRegionProvider>(ServiceName.RegionProvider, new RegionSelector()); ServiceProvider.Register <IMessageProvider>(ServiceName.Message, new MessageProvider()); ServiceProvider.Register <IWebCamProvider>(ServiceName.WebCam, new WebCamProvider()); InitializeComponent(); if (App.CmdOptions.Tray) { Hide(); } ServiceProvider.Register <Action <bool> >(ServiceName.Minimize, minimize => { WindowState = minimize ? WindowState.Minimized : WindowState.Normal; }); // Register for Windows Messages ComponentDispatcher.ThreadPreprocessMessage += (ref MSG Message, ref bool Handled) => { const int WmHotkey = 786; if (Message.message == WmHotkey) { var id = Message.wParam.ToInt32(); ServiceProvider.RaiseHotKeyPressed(id); } }; ServiceProvider.Register <ISystemTray>(ServiceName.SystemTray, new SystemTray(SystemTray)); Closing += (s, e) => { if (!TryExit()) { e.Cancel = true; } }; (DataContext as MainViewModel).Init(!App.CmdOptions.NoPersist, true, !App.CmdOptions.Reset, !App.CmdOptions.NoHotkeys); }
public MainWindow() { ServiceProvider.RegionProvider = new RegionSelector(); ServiceProvider.MessageProvider = new MessageProvider(); ServiceProvider.WebCamProvider = new WebCamProvider(); FFMpegService.FFMpegDownloader += () => { if (_downloader == null) { _downloader = new FFMpegDownloader(); _downloader.Closed += (s, args) => _downloader = null; } _downloader.ShowAndFocus(); }; Settings.Instance.Expanded = false; InitializeComponent(); ServiceProvider.MainWindow = new MainWindowProvider(this); if (App.CmdOptions.Tray) { Hide(); } // Register for Windows Messages ComponentDispatcher.ThreadPreprocessMessage += (ref MSG Message, ref bool Handled) => { const int WmHotkey = 786; if (Message.message == WmHotkey) { var id = Message.wParam.ToInt32(); ServiceProvider.RaiseHotKeyPressed(id); } }; ServiceProvider.SystemTray = new SystemTray(SystemTray); Closing += (s, e) => { if (!TryExit()) { e.Cancel = true; } }; (DataContext as MainViewModel).Init(!App.CmdOptions.NoPersist, true, !App.CmdOptions.Reset, !App.CmdOptions.NoHotkeys); try { UrlParse.validate(Settings.Instance.MeetingParams, Properties.Resources.ResourceManager.GetString("validateName"), Properties.Resources.ResourceManager.GetString("validateId")); } catch (Exception e) { ServiceProvider.MessageProvider.ShowError( Properties.Resources.ResourceManager.GetString("StartParamError")); this.TryExit(); } if (Settings.Instance.CheckForUpdates) { Task.Factory.StartNew(CheckForUpdates); } ServiceProvider.SystemTray.ShowTextNotification(Settings.Instance.MeetingName, 60_000, null); }