private void UserControl_Loaded(object sender, RoutedEventArgs e) { var vm = this.DataContext as SpeechViewModel; if (vm != null) { PPTViewer.SetEventAggregator(vm.EventAggregator); _eventSubscriptionManager = vm.EventSubscriptionManager; _desktopWindowCollector = vm.DesktopWindowCollector; _setupVideoLiveAndRecordingDevices = vm.SetupVideoLiveAndRecordingDevices; _switchDemonstrationSceneEventSubscriptionToken = _eventSubscriptionManager.Subscribe <SwitchDemonstrationSceneEvent, SwitchDemonstrationSceneContext>(null, SwitchDemonstrationSceneEventHandler, null); _systemCloseEventSubscriptionToken = _eventSubscriptionManager.Subscribe <ShutDownEvent, bool>(null, SystemShutdownHandler, null); _pptClosedEventSubscriptionToken = _eventSubscriptionManager.Subscribe <PPTClosedEvent, bool>(null, PPTClosedEventHandler, null); _eventSubscriptionManager.Subscribe <SelectedDemonstrationWindowEvent, PreviewWindowInfo>(null, SwitchPreviewWindowSceneHandler, null); _eventSubscriptionManager.Subscribe <PlayVolumeChangeEvent, int>(null, (volume) => { _player.Volume = (double)volume / 100; }, null); } DefaultScene.Visibility = Visibility.Visible; _desktopWindowCollector.SetWindowHandle(DefaultScene.Handle); _setupVideoLiveAndRecordingDevices?.SetVideoDevice(_desktopWindowCollector); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { var vm = this.DataContext as PowerCreatorPlayerViewModel; if (vm != null) { _eventSubscriptionManager = vm.EventSubscriptionManager; _desktopWindowCollector = vm.DesktopWindowCollector; _setupVideoLiveAndRecordingDevices = vm.SetupVideoLiveAndRecordingDevices; switchingVideoDeviceEventSubscriptionToken = _eventSubscriptionManager.Subscribe <SwitchingVideoDeviceEvent, VideoDeviceEventContext>(null, SwitchingVideoDeviceEventHandler, EventFilter); systemCloseEventSubscriptionToken = _eventSubscriptionManager.Subscribe <ShutDownEvent, bool>(null, SystemShutdown, null); } DefaultScene.Visibility = Visibility.Visible; _desktopWindowCollector?.SetWindowHandle(DefaultScene.Handle); _setupVideoLiveAndRecordingDevices?.SetVideoDevice(_desktopWindowCollector); }