update ux

master
logchan 2020-02-13 13:48:10 -05:00
parent 209980ab50
commit b1e8930bb4
4 changed files with 30 additions and 5 deletions

View File

@ -7,19 +7,26 @@
mc:Ignorable="d" x:Name="TheWindow"
Title="chuni-hands" Height="720" Width="1280"
Loaded="Window_Loaded" Closing="Window_Closing">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Styles.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid DataContext="{Binding ElementName=TheWindow, Path=Config}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Margin="12">
<local:ChuniCanvas x:Name="TheCanvas" DrawImage="{Binding Path=ShowVideo}"></local:ChuniCanvas>
</Grid>
<DockPanel Grid.Column="1" LastChildFill="True">
<StackPanel DockPanel.Dock="Top" Margin="12">
<DockPanel Grid.Column="1" LastChildFill="True" Margin="12">
<StackPanel DockPanel.Dock="Top">
<Button x:Name="ResetButton" Click="ResetButton_Click">Reset</Button>
<CheckBox IsChecked="{Binding Path=ShowVideo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">Video</CheckBox>
<ToggleButton IsChecked="{Binding Path=ShowVideo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">Video</ToggleButton>
<DockPanel LastChildFill="True">
<TextBlock DockPanel.Dock="Left">Threshold</TextBlock>
<Button DockPanel.Dock="Right" x:Name="SetThresholdButton" Click="SetThresholdButton_Click">Set</Button>
@ -38,8 +45,8 @@
<Slider DockPanel.Dock="Right" Value="{Binding Path=OffsetY, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Minimum="-240" Maximum="240"></Slider>
</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>
<ToggleButton IsChecked="{Binding Path=LogDiff, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">Log diff</ToggleButton>
</StackPanel>
<RichTextBox DockPanel.Dock="Bottom" x:Name="LogBox">

View File

@ -152,6 +152,10 @@ namespace chuni_hands {
private void SetThresholdButton_Click(object sender, RoutedEventArgs e) {
if (Double.TryParse(ThresholdBox.Text, out var v)) {
_config.Threshold = v;
Logger.Info($"Threshold = {v}");
}
else {
Logger.Error("Invalid input");
}
}

View File

@ -0,0 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:chuni_hands">
<Style TargetType="Button">
<Setter Property="Padding" Value="8 0 8 0"></Setter>
</Style>
<Style TargetType="CheckBox">
<Setter Property="Padding" Value="8 0 8 0"></Setter>
</Style>
</ResourceDictionary>

View File

@ -106,6 +106,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Styles.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">