add freeze button

master
logchan 2020-02-13 13:32:34 -05:00
parent 20e50491d7
commit 209980ab50
3 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,6 @@
namespace chuni_hands {
using Newtonsoft.Json;
namespace chuni_hands {
public sealed class Config : Helpers.PropertyChangedInvoker {
static Config() {
Helpers.PatchNotifyPropertyChanged<Config>();
@ -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; }
}
}

View File

@ -39,6 +39,7 @@
</DockPanel>
<Button x:Name="CenterButton" Click="CenterButton_Click">Center</Button>
<CheckBox IsChecked="{Binding Path=LogDiff, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">Log diff</CheckBox>
<ToggleButton IsChecked="{Binding Path=FreezeVideo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">Freeze</ToggleButton>
</StackPanel>
<RichTextBox DockPanel.Dock="Bottom" x:Name="LogBox">

View File

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