Player Level Bugfixes

- changed INT to LONG when parsing the the INI file values.
- created new slider for LONG types.
This commit is contained in:
Brett Hewitson 2022-06-13 18:43:10 +10:00
parent c223abf541
commit f3ff807cd0
7 changed files with 487 additions and 8 deletions

View file

@ -128,17 +128,17 @@ namespace ServerManagerTool.Lib
break;
}
int xpRequired;
if (!int.TryParse(xpResult.Groups["xp"].Value, out xpRequired))
long xpRequired;
if (!long.TryParse(xpResult.Groups["xp"].Value, out xpRequired))
{
Debug.WriteLine(String.Format("Invalid xm required value: '{0}'", xpResult.Groups["xp"].Value));
break;
}
int engramPoints = 0;
long engramPoints = 0;
if (engramResult != null)
{
if (!int.TryParse(engramResult.Groups["points"].Value, out engramPoints))
if (!long.TryParse(engramResult.Groups["points"].Value, out engramPoints))
{
Debug.WriteLine(String.Format("Invalid engram points value: '{0}'", engramResult.Groups["points"].Value));
break;

View file

@ -4558,14 +4558,14 @@
<Button DockPanel.Dock="Right" ToolTip="{DynamicResource ServerSettings_ResetMaxXPTooltip}" Click="MaxXPPlayer_Reset" Style="{StaticResource ButtonStyle1}">
<Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Refresh.ico,Size=32}"/>
</Button>
<cctl:AnnotatedCheckBoxAndIntegerSlider DockPanel.Dock="Right" Margin="0,1,0,1" Label="{DynamicResource ServerSettings_MaxXPPlayerLabel}" Value="{Binding OverrideMaxExperiencePointsPlayer}" Suffix="{DynamicResource SliderUnits_XP}" Minimum="0" Maximum="1000000000" SmallChange="5000" LargeChange="100000" TickFrequency="50000" ToolTip="{DynamicResource ServerSettings_MaxXPPlayerTooltip}"/>
<cctl:AnnotatedCheckBoxAndLongSlider DockPanel.Dock="Right" Margin="0,1,0,1" Label="{DynamicResource ServerSettings_MaxXPPlayerLabel}" Value="{Binding OverrideMaxExperiencePointsPlayer}" Suffix="{DynamicResource SliderUnits_XP}" Minimum="0" Maximum="10000000000" SmallChange="5000" LargeChange="100000" TickFrequency="50000" ToolTip="{DynamicResource ServerSettings_MaxXPPlayerTooltip}"/>
</DockPanel>
<DockPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3">
<Button DockPanel.Dock="Right" Click="MaxXPDino_Reset" ToolTip="{DynamicResource ServerSettings_ResetMaxXPTooltip}" Style="{StaticResource ButtonStyle1}">
<Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Refresh.ico,Size=32}"/>
</Button>
<cctl:AnnotatedCheckBoxAndIntegerSlider DockPanel.Dock="Right" Margin="0,1,0,1" Label="{DynamicResource ServerSettings_MaxXPDinoLabel}" Value="{Binding OverrideMaxExperiencePointsDino}" Suffix="{DynamicResource SliderUnits_XP}" Minimum="0" Maximum="1000000000" SmallChange="5000" LargeChange="100000" TickFrequency="50000" ToolTip="{DynamicResource ServerSettings_MaxXPDinoTooltip}"/>
<cctl:AnnotatedCheckBoxAndLongSlider DockPanel.Dock="Right" Margin="0,1,0,1" Label="{DynamicResource ServerSettings_MaxXPDinoLabel}" Value="{Binding OverrideMaxExperiencePointsDino}" Suffix="{DynamicResource SliderUnits_XP}" Minimum="0" Maximum="10000000000" SmallChange="5000" LargeChange="100000" TickFrequency="50000" ToolTip="{DynamicResource ServerSettings_MaxXPDinoTooltip}"/>
</DockPanel>
<TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Margin="5" Text="{Binding CustomLevelProgressionsInformation, ElementName=SettingsControl, FallbackValue=NOTE: Custom Player and Dino levels..}" TextWrapping="Wrap" VerticalAlignment="Center" FontWeight="Bold"/>

View file

@ -9,8 +9,8 @@
<entry>
<id>urn:uuid:2ADA47E8-6DD0-4231-BAB9-AE3CEE5FA72C</id>
<title>1.1.431 (1.1.431.1)</title>
<summary>1.1.431.1</summary>
<title>1.1.431 (1.1.431.2)</title>
<summary>1.1.431.2</summary>
<link href="" />
<updated>2022-06-13T00:00:00Z</updated>
<content type="xhtml">

View file

@ -7,6 +7,29 @@
<link href="http://arkservermanager.freeforums.net/" />
<updated>2022-06-13T00:00:00Z</updated>
<entry>
<id>urn:uuid:2ADA47E8-6DD0-4231-BAB9-AE3CEE5FA72C</id>
<title>1.1.431 (1.1.431.2)</title>
<summary>1.1.431.2</summary>
<link href="" />
<updated>2022-06-13T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">BUGFIX</u>
<br/>
<ul>
<li>Player Levels - fix the conversion bug that would prevent all player levels being read from the INI file. Only values > 2147483647 were affected.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:2ADA47E8-6DD0-4231-BAB9-AE3CEE5FA72C</id>
<title>1.1.431 (1.1.431.1)</title>

View file

@ -0,0 +1,298 @@
<UserControl x:Class="ServerManagerTool.Common.Controls.AnnotatedCheckBoxAndLongSlider"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cc="clr-namespace:ServerManagerTool.Common.Converters"
mc:Ignorable="d"
d:DesignWidth="300"
d:DesignHeight="25"
x:Name="Control">
<UserControl.Resources>
<ResourceDictionary>
<SolidColorBrush x:Key="SliderThumb.Static.Foreground" Color="#FFE5E5E5"/>
<SolidColorBrush x:Key="SliderThumb.MouseOver.Background" Color="#FFDCECFC"/>
<SolidColorBrush x:Key="SliderThumb.MouseOver.Border" Color="#FF7Eb4EA"/>
<SolidColorBrush x:Key="SliderThumb.Pressed.Background" Color="#FFDAECFC"/>
<SolidColorBrush x:Key="SliderThumb.Pressed.Border" Color="#FF569DE5"/>
<SolidColorBrush x:Key="SliderThumb.Disabled.Background" Color="#FFF0F0F0"/>
<SolidColorBrush x:Key="SliderThumb.Disabled.Border" Color="#FFD9D9D9"/>
<SolidColorBrush x:Key="SliderThumb.Static.Background" Color="#FFF0F0F0"/>
<SolidColorBrush x:Key="SliderThumb.Static.Border" Color="#FFACACAC"/>
<SolidColorBrush x:Key="SliderThumb.Track.Border" Color="#FFD6D6D6"/>
<SolidColorBrush x:Key="SliderThumb.Track.BorderBackground" Color="#FFE7EAEA"/>
<SolidColorBrush x:Key="SliderThumb.Grip.Fill" Color="#FFE6DFD8"/>
<SolidColorBrush x:Key="SliderThumb.Tick.Bottom" Color="#FFD8CCBC"/>
<SolidColorBrush x:Key="SliderThumb.Track.Background" Color="#FFBFA786"/>
<ControlTemplate x:Key="SliderThumbHorizontalTop" TargetType="{x:Type Thumb}">
<Grid HorizontalAlignment="Center" UseLayoutRounding="True" VerticalAlignment="Center">
<Path x:Name="grip" Data="M 0,6 C0,6 5.5,0 5.5,0 5.5,0 11,6 11,6 11,6 11,18 11,18 11,18 0,18 0,18 0,18 0,6 0,6 z" Fill="{StaticResource SliderThumb.Static.Background}" Stretch="Fill" SnapsToDevicePixels="True" Stroke="{StaticResource SliderThumb.Static.Border}" StrokeThickness="1" UseLayoutRounding="True" VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.MouseOver.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsDragging" Value="true">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.Pressed.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.Disabled.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.Disabled.Border}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="SliderThumbHorizontalBottom" TargetType="{x:Type Thumb}">
<Grid HorizontalAlignment="Center" UseLayoutRounding="True" VerticalAlignment="Center">
<Path x:Name="grip" Data="M 0,12 C0,12 5.5,18 5.5,18 5.5,18 11,12 11,12 11,12 11,0 11,0 11,0 0,0 0,0 0,0 0,12 0,12 z" Fill="{StaticResource SliderThumb.Static.Background}" Stretch="Fill" SnapsToDevicePixels="True" Stroke="{StaticResource SliderThumb.Static.Border}" StrokeThickness="1" UseLayoutRounding="True" VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.MouseOver.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsDragging" Value="true">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.Pressed.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.Disabled.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.Disabled.Border}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="RepeatButtonTransparent" TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="SliderThumbHorizontalDefault" TargetType="{x:Type Thumb}">
<Grid HorizontalAlignment="Center" UseLayoutRounding="True" VerticalAlignment="Center">
<Path x:Name="grip" Data="M 0,0 C0,0 11,0 11,0 11,0 11,18 11,18 11,18 0,18 0,18 0,18 0,0 0,0 z" Fill="{DynamicResource SliderThumb.Grip.Fill}" Stretch="Fill" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" StrokeThickness="1" UseLayoutRounding="True" VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.MouseOver.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsDragging" Value="true">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.Pressed.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.Disabled.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.Disabled.Border}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="SliderHorizontal" TargetType="{x:Type Slider}">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TickBar x:Name="TopTick" Fill="{TemplateBinding Foreground}" Height="4" Margin="0,0,0,2" Placement="Top" Grid.Row="0" Visibility="Collapsed"/>
<TickBar x:Name="BottomTick" Fill="{DynamicResource SliderThumb.Tick.Bottom}" Height="4" Margin="0,2,0,0" Placement="Bottom" Grid.Row="2" Visibility="Collapsed"/>
<Border x:Name="TrackBackground" BorderBrush="{StaticResource SliderThumb.Track.Border}" BorderThickness="1" Background="{StaticResource SliderThumb.Track.BorderBackground}" Height="4.0" Margin="5,0" Grid.Row="1" VerticalAlignment="center">
<Canvas Margin="-6,-1" Background="{DynamicResource SliderThumb.Track.Background}">
<Rectangle x:Name="PART_SelectionRange" Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" Height="4.0" Visibility="Hidden"/>
</Canvas>
</Border>
<Track x:Name="PART_Track" Grid.Row="1">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource RepeatButtonTransparent}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource RepeatButtonTransparent}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" Height="18" OverridesDefaultStyle="True" Template="{StaticResource SliderThumbHorizontalDefault}" VerticalAlignment="Center" Width="11" Foreground="#FFBFA786"/>
</Track.Thumb>
</Track>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="TickPlacement" Value="TopLeft">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
<Setter Property="Template" TargetName="Thumb" Value="{StaticResource SliderThumbHorizontalTop}"/>
<Setter Property="Margin" TargetName="TrackBackground" Value="5,2,5,0"/>
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
<Setter Property="Template" TargetName="Thumb" Value="{StaticResource SliderThumbHorizontalBottom}"/>
<Setter Property="Margin" TargetName="TrackBackground" Value="5,0,5,2"/>
</Trigger>
<Trigger Property="TickPlacement" Value="Both">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</Trigger>
<Trigger Property="IsSelectionRangeEnabled" Value="true">
<Setter Property="Visibility" TargetName="PART_SelectionRange" Value="Visible"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter Property="Foreground" TargetName="Thumb" Value="Blue"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="SliderThumbVerticalLeft" TargetType="{x:Type Thumb}">
<Grid HorizontalAlignment="Center" UseLayoutRounding="True" VerticalAlignment="Center">
<Path x:Name="grip" Data="M 6,11 C6,11 0,5.5 0,5.5 0,5.5 6,0 6,0 6,0 18,0 18,0 18,0 18,11 18,11 18,11 6,11 6,11 z" Fill="{StaticResource SliderThumb.Static.Background}" Stretch="Fill" Stroke="{StaticResource SliderThumb.Static.Border}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.MouseOver.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsDragging" Value="true">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.Pressed.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.Disabled.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.Disabled.Border}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="SliderThumbVerticalRight" TargetType="{x:Type Thumb}">
<Grid HorizontalAlignment="Center" UseLayoutRounding="True" VerticalAlignment="Center">
<Path x:Name="grip" Data="M 12,11 C12,11 18,5.5 18,5.5 18,5.5 12,0 12,0 12,0 0,0 0,0 0,0 0,11 0,11 0,11 12,11 12,11 z" Fill="{StaticResource SliderThumb.Static.Background}" Stretch="Fill" Stroke="{StaticResource SliderThumb.Static.Border}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.MouseOver.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsDragging" Value="true">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.Pressed.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.Disabled.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.Disabled.Border}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="SliderThumbVerticalDefault" TargetType="{x:Type Thumb}">
<Grid HorizontalAlignment="Center" UseLayoutRounding="True" VerticalAlignment="Center">
<Path x:Name="grip" Data="M0.5,0.5 L18.5,0.5 18.5,11.5 0.5,11.5z" Fill="{StaticResource SliderThumb.Static.Background}" Stretch="Fill" Stroke="{StaticResource SliderThumb.Static.Border}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.MouseOver.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsDragging" Value="true">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.Pressed.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Fill" TargetName="grip" Value="{StaticResource SliderThumb.Disabled.Background}"/>
<Setter Property="Stroke" TargetName="grip" Value="{StaticResource SliderThumb.Disabled.Border}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="SliderVertical" TargetType="{x:Type Slider}">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition MinWidth="{TemplateBinding MinWidth}" Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TickBar x:Name="TopTick" Grid.Column="0" Fill="{TemplateBinding Foreground}" Margin="0,0,2,0" Placement="Left" Visibility="Collapsed" Width="4"/>
<TickBar x:Name="BottomTick" Grid.Column="2" Fill="{TemplateBinding Foreground}" Margin="2,0,0,0" Placement="Right" Visibility="Collapsed" Width="4"/>
<Border x:Name="TrackBackground" BorderBrush="{StaticResource SliderThumb.Track.Border}" BorderThickness="1" Background="{StaticResource SliderThumb.Track.BorderBackground}" Grid.Column="1" HorizontalAlignment="center" Margin="0,5" Width="4.0">
<Canvas Margin="-1,-6">
<Rectangle x:Name="PART_SelectionRange" Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" Visibility="Hidden" Width="4.0"/>
</Canvas>
</Border>
<Track x:Name="PART_Track" Grid.Column="1">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource RepeatButtonTransparent}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource RepeatButtonTransparent}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb" Focusable="False" Height="11" OverridesDefaultStyle="True" Template="{StaticResource SliderThumbVerticalDefault}" VerticalAlignment="Top" Width="18"/>
</Track.Thumb>
</Track>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="TickPlacement" Value="TopLeft">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
<Setter Property="Template" TargetName="Thumb" Value="{StaticResource SliderThumbVerticalLeft}"/>
<Setter Property="Margin" TargetName="TrackBackground" Value="2,5,0,5"/>
</Trigger>
<Trigger Property="TickPlacement" Value="BottomRight">
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
<Setter Property="Template" TargetName="Thumb" Value="{StaticResource SliderThumbVerticalRight}"/>
<Setter Property="Margin" TargetName="TrackBackground" Value="0,5,2,5"/>
</Trigger>
<Trigger Property="TickPlacement" Value="Both">
<Setter Property="Visibility" TargetName="TopTick" Value="Visible"/>
<Setter Property="Visibility" TargetName="BottomTick" Value="Visible"/>
</Trigger>
<Trigger Property="IsSelectionRangeEnabled" Value="true">
<Setter Property="Visibility" TargetName="PART_SelectionRange" Value="Visible"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter Property="Foreground" TargetName="Thumb" Value="Blue"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="AnnotatedSliderStyle" TargetType="{x:Type Slider}">
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="{StaticResource SliderThumb.Static.Foreground}"/>
<Setter Property="Template" Value="{StaticResource SliderHorizontal}"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Template" Value="{StaticResource SliderVertical}"/>
</Trigger>
</Style.Triggers>
</Style>
<cc:NullableHasValueConverter x:Key="NullableHasValueConverter"/>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding LabelRelativeWidth}" MinWidth="{Binding LabelRelativeMinWidth}"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="{Binding SliderRelativeWidth}" MinWidth="{Binding SliderRelativeMinWidth}"/>
<ColumnDefinition Width="{Binding ValueRelativeWidth}" MinWidth="{Binding ValueRelativeMinWidth}"/>
<ColumnDefinition Width="{Binding SuffixRelativeWidth}" MinWidth="{Binding SuffixRelativeMinWidth}"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="{Binding Label}" VerticalContentAlignment="Center"/>
<CheckBox x:Name="CheckBox" Grid.Column="1" Margin="2,0,2,0" IsChecked="{Binding Value.HasValue}" VerticalAlignment="Center" VerticalContentAlignment="Center"/>
<Slider x:Name="Slider" Grid.Column="2" Margin="0,0,5,0" IsEnabled="{Binding ElementName=CheckBox, Path=IsChecked, FallbackValue=False}"
Value="{Binding Value.Value, Mode=OneWay}"
Minimum="{Binding Minimum}"
Maximum="{Binding Maximum}"
LargeChange="{Binding LargeChange}"
SmallChange="{Binding SmallChange}"
TickFrequency="{Binding TickFrequency}" Style="{DynamicResource AnnotatedSliderStyle}"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
HorizontalContentAlignment="Stretch"
ValueChanged="Slider_ValueChanged"/>
<TextBox x:Name="Text" Grid.Column="3" Text="{Binding Value.Value, Mode=TwoWay, StringFormat={}{0:#######,##0}}" IsEnabled="{Binding ElementName=CheckBox, Path=IsChecked, FallbackValue=False}" VerticalContentAlignment="Center" MinHeight="{Binding ValueRelativeMinHeight}"/>
<Label Grid.Column="4" Content="{Binding Suffix}" VerticalContentAlignment="Center" />
</Grid>
</UserControl>

View file

@ -0,0 +1,152 @@
using ServerManagerTool.Common.Model;
using System.Windows;
using System.Windows.Controls;
namespace ServerManagerTool.Common.Controls
{
/// <summary>
/// Interaction logic for AnnotatedSlider.xaml
/// </summary>
public partial class AnnotatedCheckBoxAndLongSlider : UserControl
{
public static readonly DependencyProperty LabelProperty = DependencyProperty.Register(nameof(Label), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider));
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(nameof(Value), typeof(NullableValue<long>), typeof(AnnotatedCheckBoxAndLongSlider), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public static readonly DependencyProperty SuffixProperty = DependencyProperty.Register(nameof(Suffix), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider));
public static readonly DependencyProperty MinimumProperty = DependencyProperty.Register(nameof(Minimum), typeof(float), typeof(AnnotatedCheckBoxAndLongSlider));
public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register(nameof(Maximum), typeof(float), typeof(AnnotatedCheckBoxAndLongSlider));
public static readonly DependencyProperty LargeChangeProperty = DependencyProperty.Register(nameof(LargeChange), typeof(float), typeof(AnnotatedCheckBoxAndLongSlider));
public static readonly DependencyProperty SmallChangeProperty = DependencyProperty.Register(nameof(SmallChange), typeof(float), typeof(AnnotatedCheckBoxAndLongSlider));
public static readonly DependencyProperty TickFrequencyProperty = DependencyProperty.Register(nameof(TickFrequency), typeof(float), typeof(AnnotatedCheckBoxAndLongSlider));
public static readonly DependencyProperty LabelRelativeWidthProperty = DependencyProperty.Register(nameof(LabelRelativeWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("4*"));
public static readonly DependencyProperty LabelRelativeMinWidthProperty = DependencyProperty.Register(nameof(LabelRelativeMinWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("0"));
public static readonly DependencyProperty SliderRelativeWidthProperty = DependencyProperty.Register(nameof(SliderRelativeWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("8*"));
public static readonly DependencyProperty SliderRelativeMinWidthProperty = DependencyProperty.Register(nameof(SliderRelativeMinWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("0"));
public static readonly DependencyProperty ValueRelativeWidthProperty = DependencyProperty.Register(nameof(ValueRelativeWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("2*"));
public static readonly DependencyProperty ValueRelativeMinWidthProperty = DependencyProperty.Register(nameof(ValueRelativeMinWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("50"));
public static readonly DependencyProperty ValueRelativeMinHeightProperty = DependencyProperty.Register(nameof(ValueRelativeMinHeight), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("25"));
public static readonly DependencyProperty SuffixRelativeWidthProperty = DependencyProperty.Register(nameof(SuffixRelativeWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("1*"));
public static readonly DependencyProperty SuffixRelativeMinWidthProperty = DependencyProperty.Register(nameof(SuffixRelativeMinWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("0"));
public AnnotatedCheckBoxAndLongSlider()
{
InitializeComponent();
Value = new NullableValue<long>();
(this.Content as FrameworkElement).DataContext = this;
}
public string Label
{
get { return (string)GetValue(LabelProperty); }
set { SetValue(LabelProperty, value); }
}
public NullableValue<long> Value
{
get { return (NullableValue<long>)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
public string Suffix
{
get { return (string)GetValue(SuffixProperty); }
set { SetValue(SuffixProperty, value); }
}
public float Minimum
{
get { return (float)GetValue(MinimumProperty); }
set { SetValue(MinimumProperty, value); }
}
public float Maximum
{
get { return (float)GetValue(MaximumProperty); }
set { SetValue(MaximumProperty, value); }
}
public float LargeChange
{
get { return (float)GetValue(LargeChangeProperty); }
set { SetValue(LargeChangeProperty, value); }
}
public float SmallChange
{
get { return (float)GetValue(SmallChangeProperty); }
set { SetValue(SmallChangeProperty, value); }
}
public float TickFrequency
{
get { return (float)GetValue(TickFrequencyProperty); }
set { SetValue(TickFrequencyProperty, value); }
}
public string LabelRelativeWidth
{
get { return (string)GetValue(LabelRelativeWidthProperty); }
set { SetValue(LabelRelativeWidthProperty, value); }
}
public string LabelRelativeMinWidth
{
get { return (string)GetValue(LabelRelativeMinWidthProperty); }
set { SetValue(LabelRelativeMinWidthProperty, value); }
}
public string SliderRelativeWidth
{
get { return (string)GetValue(SliderRelativeWidthProperty); }
set { SetValue(SliderRelativeWidthProperty, value); }
}
public string SliderRelativeMinWidth
{
get { return (string)GetValue(SliderRelativeMinWidthProperty); }
set { SetValue(SliderRelativeMinWidthProperty, value); }
}
public string ValueRelativeWidth
{
get { return (string)GetValue(ValueRelativeWidthProperty); }
set { SetValue(ValueRelativeWidthProperty, value); }
}
public string ValueRelativeMinWidth
{
get { return (string)GetValue(ValueRelativeMinWidthProperty); }
set { SetValue(ValueRelativeMinWidthProperty, value); }
}
public string ValueRelativeMinHeight
{
get { return (string)GetValue(ValueRelativeMinHeightProperty); }
set { SetValue(ValueRelativeMinHeightProperty, value); }
}
public string SuffixRelativeWidth
{
get { return (string)GetValue(SuffixRelativeWidthProperty); }
set { SetValue(SuffixRelativeWidthProperty, value); }
}
public string SuffixRelativeMinWidth
{
get { return (string)GetValue(SuffixRelativeMinWidthProperty); }
set { SetValue(SuffixRelativeMinWidthProperty, value); }
}
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (Slider.IsFocused)
{
unchecked
{
Value.Value = (long)e.NewValue;
}
}
}
}
}

View file

@ -11,6 +11,9 @@
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<None Remove="Controls\AnnotatedCheckBoxAndLongSlider.xaml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotNetZip" Version="1.13.8" />
<PackageReference Include="Microsoft.Tpl.Dataflow" Version="4.5.24" />
@ -21,6 +24,9 @@
</ItemGroup>
<ItemGroup>
<Page Include="Controls\AnnotatedCheckBoxAndFloatSlider.xaml" />
<Page Include="Controls\AnnotatedCheckBoxAndLongSlider.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\AnnotatedCheckBoxAndIntegerSlider.xaml" />
<Page Include="Controls\AnnotatedSlider.xaml" />
</ItemGroup>