Added updaterate-slider on ui

This commit is contained in:
Darth Affe 2017-08-13 12:44:35 +02:00
parent d4b5d186a4
commit 907bb027c7
2 changed files with 31 additions and 7 deletions

View File

@ -12,6 +12,16 @@ namespace KeyboardAudioVisualizer.UI
public Version Version => Assembly.GetEntryAssembly().GetName().Version; public Version Version => Assembly.GetEntryAssembly().GetName().Version;
public double UpdateRate
{
get => 1.0 / RGBSurface.Instance.UpdateFrequency;
set
{
RGBSurface.Instance.UpdateFrequency = 1.0 / MathHelper.Clamp(value, 1, 40);
OnPropertyChanged();
}
}
#endregion #endregion
#region Commands #region Commands

View File

@ -123,18 +123,32 @@
<TabItem Header="Settings"> <TabItem Header="Settings">
<GroupBox VerticalAlignment="Top"> <GroupBox VerticalAlignment="Top">
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<controls:Formular> <Grid>
<controls:Formular.Resources> <Grid.Resources>
<Style BasedOn="{StaticResource StyleLabelFormular}" TargetType="Label" /> <Style BasedOn="{StaticResource StyleLabelFormular}" TargetType="Label" />
<Style BasedOn="{StaticResource StyleTextBlockFormular}" TargetType="TextBlock" /> <Style BasedOn="{StaticResource StyleTextBlockFormular}" TargetType="TextBlock" />
<Style BasedOn="{StaticResource StyleListBoxFormular}" TargetType="ListBox" /> <Style BasedOn="{StaticResource StyleListBoxFormular}" TargetType="ListBox" />
</controls:Formular.Resources> </Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="8" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="8" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label controls:Formular.IsLabel="True" Content="Version:" /> <controls:Formular Grid.Column="0">
<TextBlock Text="{Binding Version}" /> <Label controls:Formular.IsLabel="True" Content="Version:" />
<TextBlock Text="{Binding Version}" />
<Label controls:Formular.LineBreaks="1" controls:Formular.IsLabel="True" Content="Devices:" /> <Label controls:Formular.IsLabel="True" Content="Update-Rate" />
</controls:Formular> <Slider Minimum="1" Maximum="40" controls:Formular.Fill="True" IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight"
Value="{Binding UpdateRate}" />
<Label controls:Formular.LineBreaks="1" controls:Formular.IsLabel="True" Content="Devices:" />
</controls:Formular>
</Grid>
<!-- TODO DarthAffe 05.08.2017: Fix the formular to support that use-case --> <!-- TODO DarthAffe 05.08.2017: Fix the formular to support that use-case -->
<ItemsControl VerticalAlignment="Top" HorizontalAlignment="Left" Margin="120,-22,0,0" ItemsSource="{Binding Source={x:Static core:RGBSurface.Instance}, Path=Devices}"> <ItemsControl VerticalAlignment="Top" HorizontalAlignment="Left" Margin="120,-22,0,0" ItemsSource="{Binding Source={x:Static core:RGBSurface.Instance}, Path=Devices}">