diff --git a/src/Captura.Console/Program.cs b/src/Captura.Console/Program.cs index 49eda9d21..6add2e94e 100644 --- a/src/Captura.Console/Program.cs +++ b/src/Captura.Console/Program.cs @@ -275,7 +275,7 @@ static void HandleVideoSource(MainViewModel ViewModel, CommonCmdOptions CommonOp screenSourceProvider.Set(index); - video.SelectedVideoSourceKind = screenSourceProvider; + video.RestoreSourceKind(screenSourceProvider); } } @@ -288,7 +288,7 @@ static void HandleVideoSource(MainViewModel ViewModel, CommonCmdOptions CommonOp winProvider.Set(handle); - video.SelectedVideoSourceKind = winProvider; + video.RestoreSourceKind(winProvider); } // Start command only @@ -305,7 +305,7 @@ static void HandleVideoSource(MainViewModel ViewModel, CommonCmdOptions CommonOp deskDuplSourceProvider.Set(new ScreenWrapper(Screen.AllScreens[index])); - video.SelectedVideoSourceKind = deskDuplSourceProvider; + video.RestoreSourceKind(deskDuplSourceProvider); } } diff --git a/src/Captura.Core/Fakes/FakeVideoSourcePicker.cs b/src/Captura.Core/Fakes/FakeVideoSourcePicker.cs index 1b9178477..73363d6c4 100644 --- a/src/Captura.Core/Fakes/FakeVideoSourcePicker.cs +++ b/src/Captura.Core/Fakes/FakeVideoSourcePicker.cs @@ -7,9 +7,17 @@ namespace Captura.Models // ReSharper disable once ClassNeverInstantiated.Global public class FakeVideoSourcePicker : IVideoSourcePicker { - public IWindow PickWindow(IEnumerable SkipWindows = null) => null; + FakeVideoSourcePicker() { } - public IScreen PickScreen() => null; + public static FakeVideoSourcePicker Instance { get; } = new FakeVideoSourcePicker(); + + public IWindow SelectedWindow { get; set; } + + public IWindow PickWindow(IEnumerable SkipWindows = null) => SelectedWindow; + + public IScreen SelectedScreen { get; set; } + + public IScreen PickScreen() => SelectedScreen; public Rectangle? PickRegion() => null; } diff --git a/src/Captura.Core/Fakes/FakesModule.cs b/src/Captura.Core/Fakes/FakesModule.cs index 685b622dd..7b1a0f3c4 100644 --- a/src/Captura.Core/Fakes/FakesModule.cs +++ b/src/Captura.Core/Fakes/FakesModule.cs @@ -14,7 +14,7 @@ public void OnLoad(IBinder Binder) Binder.Bind(); Binder.Bind(); Binder.Bind(); - Binder.Bind(); + Binder.Bind(() => FakeVideoSourcePicker.Instance); Binder.Bind(); } }