コード例 #1
0
        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);
                }
            };
        }
コード例 #2
0
        public MainWindow()
        {
            Instance = this;

            FFMpegService.FFMpegDownloader += () =>
            {
                if (_downloader == null)
                {
                    _downloader         = new FFMpegDownloader();
                    _downloader.Closed += (Sender, Args) => _downloader = null;
                }

                _downloader.ShowAndFocus();
            };

            InitializeComponent();

            if (DataContext is MainViewModel vm)
            {
                vm.Init(!App.CmdOptions.NoPersist, true, !App.CmdOptions.Reset, !App.CmdOptions.NoHotkeys);

                // 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();

                        vm.HotKeyManager.ProcessHotkey(id);
                    }
                };

                Loaded += (Sender, Args) =>
                {
                    RepositionWindowIfOutside();

                    vm.HotKeyManager.ShowNotRegisteredOnStartup();
                };
            }

            if (App.CmdOptions.Tray || ServiceProvider.Get <Settings>().UI.MinToTrayOnStartup)
            {
                Hide();
            }

            Closing += (Sender, Args) =>
            {
                if (!TryExit())
                {
                    Args.Cancel = true;
                }
            };
        }
コード例 #3
0
        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);
        }