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