Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
Cmdline Window, Screen capture fix (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
MathewSachin authored Oct 10, 2018
1 parent 69bc3cf commit 3e2e9aa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Captura.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static void HandleVideoSource(MainViewModel ViewModel, CommonCmdOptions CommonOp

screenSourceProvider.Set(index);

video.SelectedVideoSourceKind = screenSourceProvider;
video.RestoreSourceKind(screenSourceProvider);
}
}

Expand All @@ -288,7 +288,7 @@ static void HandleVideoSource(MainViewModel ViewModel, CommonCmdOptions CommonOp

winProvider.Set(handle);

video.SelectedVideoSourceKind = winProvider;
video.RestoreSourceKind(winProvider);
}

// Start command only
Expand All @@ -305,7 +305,7 @@ static void HandleVideoSource(MainViewModel ViewModel, CommonCmdOptions CommonOp

deskDuplSourceProvider.Set(new ScreenWrapper(Screen.AllScreens[index]));

video.SelectedVideoSourceKind = deskDuplSourceProvider;
video.RestoreSourceKind(deskDuplSourceProvider);
}
}

Expand Down
12 changes: 10 additions & 2 deletions src/Captura.Core/Fakes/FakeVideoSourcePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@ namespace Captura.Models
// ReSharper disable once ClassNeverInstantiated.Global
public class FakeVideoSourcePicker : IVideoSourcePicker
{
public IWindow PickWindow(IEnumerable<IntPtr> SkipWindows = null) => null;
FakeVideoSourcePicker() { }

public IScreen PickScreen() => null;
public static FakeVideoSourcePicker Instance { get; } = new FakeVideoSourcePicker();

public IWindow SelectedWindow { get; set; }

public IWindow PickWindow(IEnumerable<IntPtr> SkipWindows = null) => SelectedWindow;

public IScreen SelectedScreen { get; set; }

public IScreen PickScreen() => SelectedScreen;

public Rectangle? PickRegion() => null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Captura.Core/Fakes/FakesModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void OnLoad(IBinder Binder)
Binder.Bind<ISystemTray, FakeSystemTray>();
Binder.Bind<IMainWindow, FakeWindowProvider>();
Binder.Bind<IPreviewWindow, FakePreviewWindow>();
Binder.Bind<IVideoSourcePicker, FakeVideoSourcePicker>();
Binder.Bind<IVideoSourcePicker>(() => FakeVideoSourcePicker.Instance);
Binder.Bind<IAudioPlayer, FakeAudioPlayer>();
}
}
Expand Down

0 comments on commit 3e2e9aa

Please sign in to comment.