Пример #1
0
        public ScreenShotViewModel(LanguageManager Loc,
                                   Settings Settings,
                                   DiskWriter DiskWriter,
                                   ClipboardWriter ClipboardWriter,
                                   ImageUploadWriter ImgurWriter,
                                   ScreenShotModel ScreenShotModel,
                                   VideoSourcesViewModel VideoSourcesViewModel,
                                   IPlatformServices PlatformServices) : base(Settings, Loc)
        {
            this.DiskWriter      = DiskWriter;
            this.ClipboardWriter = ClipboardWriter;
            this.ImgurWriter     = ImgurWriter;

            ScreenShotCommand = VideoSourcesViewModel
                                .ObserveProperty(M => M.SelectedVideoSourceKind)
                                .Select(M => !(M is NoVideoSourceProvider))
                                .ToReactiveCommand()
                                .WithSubscribe(() => ScreenShotModel.CaptureScreenShot());

            async Task ScreenShotWindow(IWindow Window)
            {
                var img = ScreenShotModel.ScreenShotWindow(Window);

                await ScreenShotModel.SaveScreenShot(img);
            }

            ScreenShotActiveCommand  = new DelegateCommand(async() => await ScreenShotWindow(PlatformServices.ForegroundWindow));
            ScreenShotDesktopCommand = new DelegateCommand(async() => await ScreenShotWindow(PlatformServices.DesktopWindow));
            ScreenshotRegionCommand  = new DelegateCommand(async() => await ScreenShotModel.ScreenshotRegion());
            ScreenshotWindowCommand  = new DelegateCommand(async() => await ScreenShotModel.ScreenshotWindow());
            ScreenshotScreenCommand  = new DelegateCommand(async() => await ScreenShotModel.ScreenshotScreen());
        }
Пример #2
0
        public ScreenShotViewModel(LanguageManager loc,
                                   Settings settings,
                                   DiskWriter diskWriter,
                                   ClipboardWriter clipboardWriter,
                                   ImageUploadWriter imgurWriter,
                                   ScreenShotModel screenShotModel,
                                   VideoSourcesViewModel videoSourcesViewModel,
                                   IPlatformServices platformServices) : base(settings, loc)
        {
            DiskWriter      = diskWriter;
            ClipboardWriter = clipboardWriter;
            ImgurWriter     = imgurWriter;

            ScreenShotCommand = videoSourcesViewModel
                                .ObserveProperty(sourcesViewModel => sourcesViewModel.SelectedVideoSourceKind)
                                .Select(videoSourceProvider => !(videoSourceProvider is NoVideoSourceProvider))
                                .ToReactiveCommand()
                                .WithSubscribe(() => screenShotModel.CaptureScreenShot());

            async Task ScreenShotWindow(IWindow window)
            {
                var img = screenShotModel.ScreenShotWindow(window);

                await screenShotModel.SaveScreenShot(img);
            }

            ScreenShotActiveCommand  = new DelegateCommand(async() => await ScreenShotWindow(platformServices.ForegroundWindow));
            ScreenShotDesktopCommand = new DelegateCommand(async() => await ScreenShotWindow(platformServices.DesktopWindow));
            ScreenshotRegionCommand  = new DelegateCommand(async() => await screenShotModel.ScreenshotRegion());
            ScreenshotWindowCommand  = new DelegateCommand(async() => await screenShotModel.ScreenshotWindow());
            ScreenshotScreenCommand  = new DelegateCommand(async() => await screenShotModel.ScreenshotScreen());
        }
Пример #3
0
        public ScreenShotViewModel(LanguageManager Loc,
                                   Settings Settings,
                                   DiskWriter DiskWriter,
                                   ClipboardWriter ClipboardWriter,
                                   ImageUploadWriter ImgurWriter,
                                   ScreenShotModel ScreenShotModel,
                                   VideoSourcesViewModel VideoSourcesViewModel) : base(Settings, Loc)
        {
            this.DiskWriter      = DiskWriter;
            this.ClipboardWriter = ClipboardWriter;
            this.ImgurWriter     = ImgurWriter;

            ScreenShotCommand = VideoSourcesViewModel
                                .ObserveProperty(M => M.SelectedVideoSourceKind)
                                .Select(M => !(M is NoVideoSourceProvider))
                                .ToReactiveCommand()
                                .WithSubscribe(() => ScreenShotModel.CaptureScreenShot());

            ScreenShotActiveCommand  = new DelegateCommand(async() => await ScreenShotModel.SaveScreenShot(ScreenShotModel.ScreenShotWindow(Window.ForegroundWindow)));
            ScreenShotDesktopCommand = new DelegateCommand(async() => await ScreenShotModel.SaveScreenShot(ScreenShotModel.ScreenShotWindow(Window.DesktopWindow)));
            ScreenshotRegionCommand  = new DelegateCommand(async() => await ScreenShotModel.ScreenshotRegion());
            ScreenshotWindowCommand  = new DelegateCommand(async() => await ScreenShotModel.ScreenshotWindow());
            ScreenshotScreenCommand  = new DelegateCommand(async() => await ScreenShotModel.ScreenshotScreen());

            ScreenShotImageFormats = ScreenShotModel.ScreenShotImageFormats;

            SelectedScreenShotImageFormat = ScreenShotModel
                                            .ToReactivePropertyAsSynchronized(M => M.SelectedScreenShotImageFormat);
        }
        public ScreenShotViewModel(LanguageManager Loc,
                                   Settings Settings,
                                   DiskWriter DiskWriter,
                                   ClipboardWriter ClipboardWriter,
                                   ImageUploadWriter ImgurWriter,
                                   ScreenShotModel ScreenShotModel,
                                   VideoSourcesViewModel VideoSourcesViewModel,
                                   WebcamModel WebcamModel,
                                   IPlatformServices PlatformServices) : base(Settings, Loc)
        {
            this.DiskWriter      = DiskWriter;
            this.ClipboardWriter = ClipboardWriter;
            this.ImgurWriter     = ImgurWriter;

            ScreenShotCommand = new[]
            {
                VideoSourcesViewModel
                .ObserveProperty(M => M.SelectedVideoSourceKind)
                .Select(M => M is NoVideoSourceProvider),
                VideoSourcesViewModel
                .ObserveProperty(M => M.SelectedVideoSourceKind)
                .Select(M => M is WebcamSourceProvider),
                WebcamModel
                .ObserveProperty(M => M.SelectedCam)
                .Select(M => M is NoWebcamItem)
            }
            .CombineLatest(M =>
            {
                var noVideo    = M[0];
                var webcamMode = M[1];
                var noWebcam   = M[2];

                if (webcamMode)
                {
                    return(!noWebcam);
                }

                return(!noVideo);
            })
            .ToReactiveCommand()
            .WithSubscribe(M => ScreenShotModel.CaptureScreenShot());

            async Task ScreenShotWindow(IWindow Window)
            {
                var img = ScreenShotModel.ScreenShotWindow(Window);

                await ScreenShotModel.SaveScreenShot(img);
            }

            ScreenShotActiveCommand  = new DelegateCommand(async() => await ScreenShotWindow(PlatformServices.ForegroundWindow));
            ScreenShotDesktopCommand = new DelegateCommand(async() => await ScreenShotWindow(PlatformServices.DesktopWindow));
            ScreenshotRegionCommand  = new DelegateCommand(async() => await ScreenShotModel.ScreenshotRegion());
            ScreenshotWindowCommand  = new DelegateCommand(async() => await ScreenShotModel.ScreenshotWindow());
            ScreenshotScreenCommand  = new DelegateCommand(async() => await ScreenShotModel.ScreenshotScreen());
        }
Пример #5
0
        public ScreenShotViewModel(VideoSourcesViewModel VideoSourcesViewModel,
                                   ISystemTray SystemTray,
                                   LanguageManager Loc,
                                   Settings Settings,
                                   IRegionProvider RegionProvider,
                                   IMainWindow MainWindow,
                                   DiskWriter DiskWriter,
                                   ClipboardWriter ClipboardWriter,
                                   ImageUploadWriter ImgurWriter,
                                   IVideoSourcePicker SourcePicker,
                                   IAudioPlayer AudioPlayer,
                                   IEnumerable <IImageWriterItem> ImageWriters) : base(Settings, Loc)
        {
            _videoSourcesViewModel = VideoSourcesViewModel;
            _systemTray            = SystemTray;
            _regionProvider        = RegionProvider;
            _mainWindow            = MainWindow;
            _sourcePicker          = SourcePicker;
            _audioPlayer           = AudioPlayer;
            this.DiskWriter        = DiskWriter;
            this.ClipboardWriter   = ClipboardWriter;
            this.ImgurWriter       = ImgurWriter;

            AvailableImageWriters = ImageWriters.ToList();

            if (!AvailableImageWriters.Any(M => M.Active))
            {
                AvailableImageWriters[0].Active = true;
            }

            ScreenShotCommand        = new DelegateCommand(() => CaptureScreenShot());
            ScreenShotActiveCommand  = new DelegateCommand(async() => await SaveScreenShot(ScreenShotWindow(Window.ForegroundWindow)));
            ScreenShotDesktopCommand = new DelegateCommand(async() => await SaveScreenShot(ScreenShotWindow(Window.DesktopWindow)));
            ScreenshotRegionCommand  = new DelegateCommand(async() => await ScreenshotRegion());
            ScreenshotWindowCommand  = new DelegateCommand(async() => await ScreenshotWindow());
            ScreenshotScreenCommand  = new DelegateCommand(async() => await ScreenshotScreen());
        }