From 209980ab5037b14bcc31d3ae2c48647c8cd5ff5a Mon Sep 17 00:00:00 2001 From: logchan Date: Thu, 13 Feb 2020 13:32:34 -0500 Subject: [PATCH] add freeze button --- chuni-hands/Config.cs | 7 ++++++- chuni-hands/MainWindow.xaml | 1 + chuni-hands/MainWindow.xaml.cs | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/chuni-hands/Config.cs b/chuni-hands/Config.cs index f567d52..1bd1fcc 100644 --- a/chuni-hands/Config.cs +++ b/chuni-hands/Config.cs @@ -1,4 +1,6 @@ -namespace chuni_hands { +using Newtonsoft.Json; + +namespace chuni_hands { public sealed class Config : Helpers.PropertyChangedInvoker { static Config() { Helpers.PatchNotifyPropertyChanged(); @@ -19,5 +21,8 @@ public string SendKeyMode { get; set; } = "be"; public string EndPoint { get; set; } = "http://10.233.3.22:4420/update_air"; public bool ShowVideo { get; set; } = true; + + [JsonIgnore] + public bool FreezeVideo { get; set; } } } diff --git a/chuni-hands/MainWindow.xaml b/chuni-hands/MainWindow.xaml index f14a56e..839a163 100644 --- a/chuni-hands/MainWindow.xaml +++ b/chuni-hands/MainWindow.xaml @@ -39,6 +39,7 @@ Log diff + Freeze diff --git a/chuni-hands/MainWindow.xaml.cs b/chuni-hands/MainWindow.xaml.cs index f91444c..72834f9 100644 --- a/chuni-hands/MainWindow.xaml.cs +++ b/chuni-hands/MainWindow.xaml.cs @@ -118,11 +118,15 @@ namespace chuni_hands { var bootstrapFrames = _config.BootstrapSeconds * _config.Fps; while (!_closing) { - _capture.Read(_mat); if (bootstrapFrames > 0) { + _capture.Read(_mat); --bootstrapFrames; } else { + if (!_config.FreezeVideo) { + _capture.Read(_mat); + } + Dispatcher?.BeginInvoke(new Action(FrameUpdate)); }