diff --git a/LedBadge/MainViewModel.cs b/LedBadge/MainViewModel.cs index d5a3a04..8739fc2 100644 --- a/LedBadge/MainViewModel.cs +++ b/LedBadge/MainViewModel.cs @@ -16,7 +16,8 @@ enum DisplayMode Nothing, Messages, TestFill, - TestCopy + TestCopy, + TestFrame } class MainViewModel: INotifyPropertyChanged @@ -34,7 +35,7 @@ public MainViewModel(Dispatcher dispatcher, Action logFunc) m_frameTimer.Start(); HoldTimingA = 1; - HoldTimingB = 4; + HoldTimingB = 3; HoldTimingC = 4; IdleFade = true; IdleResetToBootImage = true; @@ -89,7 +90,7 @@ public DisplayMode DisplayMode set { m_displayMode = value; - m_badgePump.UseFrameBuffer = m_displayMode == DisplayMode.Messages; + m_badgePump.UseFrameBuffer = m_displayMode == DisplayMode.Messages || m_displayMode == DisplayMode.TestFrame; } } @@ -147,10 +148,22 @@ void InitScene() void OnRenderFrame(object sender, LedBadgeLib.BadgeFrameEventArgs args) { - LedBadgeLib.BadgePump pump = (LedBadgeLib.BadgePump)sender; - m_messageScene.Update(1.0f / pump.FrameRate); - m_messageScene.Render(args.Frame, 0, 0); - Frame++; + switch(DisplayMode) + { + case DisplayMode.Messages: + { + LedBadgeLib.BadgePump pump = (LedBadgeLib.BadgePump)sender; + m_messageScene.Update(1.0f / pump.FrameRate); + m_messageScene.Render(args.Frame, 0, 0); + Frame++; + break; + } + case DisplayMode.TestFrame: + { + TestFrame(args.Frame); + break; + } + } } void OnFrameReady(object sender, LedBadgeLib.BadgeFrameEventArgs args) @@ -181,12 +194,12 @@ void OnGenerateCommands(object sender, LedBadgeLib.BadgeCommandEventArgs args) { switch(DisplayMode) { - case LedBadge.DisplayMode.TestFill: + case DisplayMode.TestFill: { TestPattern(args.CommandStream); break; } - case LedBadge.DisplayMode.TestCopy: + case DisplayMode.TestCopy: { TestScroll(args.CommandStream); break; @@ -223,6 +236,11 @@ void TestScroll(MemoryStream commands) LedBadgeLib.BadgeCommands.Swap(commands); } + void TestFrame(LedBadgeLib.BadgeRenderTarget frame) + { + LedBadgeLib.ScreenCapture.ReadScreenAtMousePosition(frame.IntermediateImage, LedBadgeLib.BadgeCaps.Width, LedBadgeLib.BadgeCaps.Height); + } + void OnBadgeResponse(object sender, LedBadgeLib.BadgeResponseEventArgs args) { Dispatcher.InvokeAsync(() => LogMessage(args.Code, args.Response)); diff --git a/LedBadge/MainWindow.xaml b/LedBadge/MainWindow.xaml index 309819b..fd519d1 100644 --- a/LedBadge/MainWindow.xaml +++ b/LedBadge/MainWindow.xaml @@ -91,15 +91,15 @@