mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
- changed INT to LONG when parsing the the INI file values. - created new slider for LONG types.
152 lines
7.4 KiB
C#
152 lines
7.4 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|