コード例 #1
0
        private void SwitchDemonstrationSceneEventHandler(SwitchDemonstrationSceneContext context)
        {
            _desktopWindowCollector.PushingData -= _desktopWindowCollector_PushingData;

            switch (context.SceneType)
            {
            case DemonstratioType.PPT:
                AllSceneHidden();
                _player.Pause();
                PPTViewer.OpenPPT(context.UseDevice.ToString());
                DemonstrationPPTScene.Visibility = Visibility;
                _desktopWindowCollector.SetWindowHandle(DemonstrationPPTScene.Handle);
                break;

            case DemonstratioType.VideoDevice:
                AllSceneHidden();
                _player.Pause();
                DemonstrationVideoDeviceScene.Visibility = Visibility.Visible;
                MsPlayer.OpenDevice(context.UseDevice as IVideoDevice);
                _desktopWindowCollector.SetWindowHandle(DemonstrationVideoDeviceScene.Handle);
                break;

            case DemonstratioType.Image:
                _player.Pause();
                AllSceneHidden();
                if (_imagePath != context.UseDevice.ToString())
                {
                    _imagePath = context.UseDevice.ToString();
                    BitmapImage bitmap = new BitmapImage(new Uri(_imagePath));
                    ImageControl.ImageSource = bitmap;
                }
                DefaultScene.Visibility = Visibility.Visible;
                _desktopWindowCollector.SetWindowHandle(DefaultScene.Handle);
                break;

            case DemonstratioType.Video:
                if (context.UseDevice.ToString() != _videoPath)
                {
                    _videoPath = context.UseDevice.ToString();
                    AllSceneHidden();
                    _player.Open(new Uri(_videoPath));
                }
                _player.Play();
                DemonstrationVideoScene.Visibility = Visibility.Visible;
                _desktopWindowCollector.SetWindowHandle(DemonstrationVideoScene.Handle);
                break;

            default:
                AllSceneHidden();
                DefaultScene.Visibility = Visibility.Visible;
                _desktopWindowCollector.SetWindowHandle(DefaultScene.Handle);
                break;
            }
        }
コード例 #2
0
        private void SwitchScene(string sceneType)
        {
            SwitchDemonstrationSceneContext context = new SwitchDemonstrationSceneContext()
            {
                SceneType = DemonstratioType.None, Source = (SceneType)int.Parse(sceneType)
            };
            PresentationInfo presentationInfo;

            switch (context.Source)
            {
            case SceneType.PPT:
                if (PresentationViewModel.CurrentSelectedPresentation == null)
                {
                    MessageBox.Show("请选择需要演示的文件", "系统提示");
                    return;
                }
                presentationInfo  = PresentationViewModel.CurrentSelectedPresentation.Presentation;
                context.SceneType = presentationInfo.DemoFileType;
                context.UseDevice = presentationInfo.FileFullPath;
                break;

            case SceneType.WarmVideo:
                if (PresentationViewModel.CurrentSelectedWarmVideo == null)
                {
                    MessageBox.Show("请选择需要演示的文件", "系统提示");
                    return;
                }
                presentationInfo  = PresentationViewModel.CurrentSelectedWarmVideo.Presentation;
                context.SceneType = presentationInfo.DemoFileType;
                context.UseDevice = presentationInfo.FileFullPath;
                break;

            case SceneType.VideoDevice:
                if (CameraDeviceViewModel.CurrentSelectedDevice == null)
                {
                    MessageBox.Show("请选择需要播放的视频设备", "系统提示");
                    return;
                }
                context.SceneType = DemonstratioType.VideoDevice;
                context.UseDevice = CameraDeviceViewModel.CurrentSelectedDevice.OwnerVideoDevice.OwnerVideoDevice;
                break;
            }
            _eventAggregator.GetEvent <SwitchDemonstrationSceneEvent>().Publish(context);
        }