Преглед на файлове

增加组态控件集合,测试案例

样式分支
fyf преди 2 години
родител
ревизия
118f11351c
променени са 51 файла, в които са добавени 2224 реда и са изтрити 37 реда
  1. +12
    -0
      BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj
  2. +36
    -0
      BPASmartClient.SCADAControl/Converters/BoolToVisibilityConverter.cs
  3. +14
    -0
      BPASmartClient.SCADAControl/Converters/ControlTypeAttribute.cs
  4. +37
    -0
      BPASmartClient.SCADAControl/Converters/ItemsList.cs
  5. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/ArcGauge.cs
  6. +62
    -0
      BPASmartClient.SCADAControl/CustomerControls/DigitalNumber.cs
  7. +14
    -0
      BPASmartClient.SCADAControl/CustomerControls/GraphArrow.xaml
  8. +55
    -0
      BPASmartClient.SCADAControl/CustomerControls/GraphArrow.xaml.cs
  9. +14
    -0
      BPASmartClient.SCADAControl/CustomerControls/GraphStar.xaml
  10. +55
    -0
      BPASmartClient.SCADAControl/CustomerControls/GraphStar.xaml.cs
  11. +241
    -0
      BPASmartClient.SCADAControl/CustomerControls/KnobButton.cs
  12. +2
    -2
      BPASmartClient.SCADAControl/CustomerControls/NewConveyorBelt.xaml
  13. +2
    -1
      BPASmartClient.SCADAControl/CustomerControls/NewConveyorBelt.xaml.cs
  14. +370
    -0
      BPASmartClient.SCADAControl/CustomerControls/NumberBox.cs
  15. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/Silos.xaml
  16. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/Silos.xaml.cs
  17. +102
    -0
      BPASmartClient.SCADAControl/CustomerControls/StatusLight.cs
  18. +4
    -1
      BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs
  19. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml
  20. +2
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml.cs
  21. +9
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml
  22. +90
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml.cs
  23. +9
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheComboBox.xaml
  24. +73
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheComboBox.xaml.cs
  25. +9
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheGroupBox.xaml
  26. +56
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheGroupBox.xaml.cs
  27. +9
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheImage.xaml
  28. +55
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheImage.xaml.cs
  29. +57
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheRadioButton.cs
  30. +67
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheSlider.cs
  31. +9
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.xaml
  32. +51
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.xaml.cs
  33. +57
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs
  34. +97
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheTimer.cs
  35. +9
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheToggleButton.xaml
  36. +97
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheToggleButton.xaml.cs
  37. +185
    -0
      BPASmartClient.SCADAControl/CustomerControls/WaveProgressBar.cs
  38. Двоични данни
     
  39. Двоични данни
     
  40. Двоични данни
     
  41. Двоични данни
     
  42. Двоични данни
     
  43. Двоични данни
     
  44. +259
    -28
      BPASmartClient.SCADAControl/Themes/Generic.xaml
  45. Двоични данни
     
  46. Двоични данни
     
  47. Двоични данни
     
  48. Двоични данни
     
  49. Двоични данни
     
  50. Двоични данни
     
  51. Двоични данни
     

+ 12
- 0
BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj Целия файл

@@ -8,6 +8,12 @@
</PropertyGroup>

<ItemGroup>
<None Remove="Fonts\ds-digib.ttf" />
<None Remove="Images\State0.png" />
<None Remove="Images\State1.png" />
<None Remove="Images\State11.png" />
<None Remove="Images\State2.png" />
<None Remove="Images\timericon.png" />
<None Remove="Images\借出.png" />
<None Remove="Images\光柱.png" />
<None Remove="Images\退出.png" />
@@ -35,6 +41,12 @@
</ItemGroup>

<ItemGroup>
<Resource Include="Fonts\ds-digib.ttf" />
<Resource Include="Images\State0.png" />
<Resource Include="Images\State1.png" />
<Resource Include="Images\State11.png" />
<Resource Include="Images\State2.png" />
<Resource Include="Images\timericon.png" />
<Resource Include="Images\借出.png" />
<Resource Include="Images\光柱.png" />
<Resource Include="Images\退出.png" />


+ 36
- 0
BPASmartClient.SCADAControl/Converters/BoolToVisibilityConverter.cs Целия файл

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace BPASmartClient.SCADAControl.Converters
{
[ValueConversion(typeof(bool), typeof(Visibility))]
public class BoolToVisibilityConverter : IValueConverter
{
static BoolToVisibilityConverter()
{
Instance = new BoolToVisibilityConverter();
}

public static BoolToVisibilityConverter Instance
{
get;
private set;
}

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return ((bool)value) ? Visibility.Visible : Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

+ 14
- 0
BPASmartClient.SCADAControl/Converters/ControlTypeAttribute.cs Целия файл

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.SCADAControl.Converters
{
[AttributeUsage(AttributeTargets.Class)]
public class ControlTypeAttribute : Attribute
{
public string Group { get; set; }
}
}

+ 37
- 0
BPASmartClient.SCADAControl/Converters/ItemsList.cs Целия файл

@@ -0,0 +1,37 @@
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.SCADAControl.Converters
{
/// <summary>
/// 因ObservableCollection无法序列化,继承并实例化一个
/// </summary>
public class ItemsList : ObservableCollection<string>
{
public ItemsList()
{
AddCommand = new RelayCommand<string>(AddItem);
DeleteCommand = new RelayCommand<string>(DeleteItem);
}

private void DeleteItem(string obj)
{
if (!string.IsNullOrEmpty(obj))
Remove(obj);
}

public RelayCommand<string> AddCommand { get; }
public RelayCommand<string> DeleteCommand { get; }
private void AddItem(string txt)
{
if (!string.IsNullOrEmpty(txt))
Add(txt);
}

}
}

BPASmartClient.SCADAControl/ArcGauge.cs → BPASmartClient.SCADAControl/CustomerControls/ArcGauge.cs Целия файл

@@ -16,7 +16,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl
namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// 新测试仪表盘

+ 62
- 0
BPASmartClient.SCADAControl/CustomerControls/DigitalNumber.cs Целия файл

@@ -0,0 +1,62 @@
using BPASmartClient.Compiler;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// 数字表
/// </summary>
public class DigitalNumber :Control, IExecutable
{
public DigitalNumber()
{
Width = 80;
Height = 30;
}
public string ControlType => "控件";

static DigitalNumber()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(DigitalNumber),new FrameworkPropertyMetadata(typeof(DigitalNumber)));
}

TextBlock text = null;
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
text = GetTemplateChild("line") as TextBlock;
}

public double NumberValue
{
get { return (double)GetValue(NumberValueProperty); }
set { SetValue(NumberValueProperty,value); }
}
public static readonly DependencyProperty NumberValueProperty =
DependencyProperty.Register("NumberValue",typeof(double),typeof(DigitalNumber),new UIPropertyMetadata(0.00d));

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

public void Register()
{
}
}
}

+ 14
- 0
BPASmartClient.SCADAControl/CustomerControls/GraphArrow.xaml Целия файл

@@ -0,0 +1,14 @@
<UserControl x:Class="BPASmartClient.SCADAControl.CustomerControls.GraphArrow"
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:local="clr-namespace:BPASmartClient.SCADAControl.CustomerControls"
mc:Ignorable="d"
x:Name="root"
d:DesignHeight="44" d:DesignWidth="60" Foreground="#22DCF7">
<Grid>
<Path Data="M571.5,161.75L629,161.75 629,147.5 657.5,176 629,204.5 629,190.25 571.5,190.25z"
Stretch="Fill" Fill="{Binding ElementName=root,Path=Foreground}"/>
</Grid>
</UserControl>

+ 55
- 0
BPASmartClient.SCADAControl/CustomerControls/GraphArrow.xaml.cs Целия файл

@@ -0,0 +1,55 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// 箭头
/// GraphArrow.xaml 的交互逻辑
/// </summary>
public partial class GraphArrow : UserControl, IExecutable
{
public GraphArrow()
{
InitializeComponent();
Width = 80;
Height = 80;
}

public string ControlType => "图形";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
IsEnabled = true;
Register();
Style = null;
}
}
}

public void Register()
{
}
}
}

+ 14
- 0
BPASmartClient.SCADAControl/CustomerControls/GraphStar.xaml Целия файл

@@ -0,0 +1,14 @@
<UserControl x:Class="BPASmartClient.SCADAControl.CustomerControls.GraphStar"
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:local="clr-namespace:BPASmartClient.SCADAControl.CustomerControls"
mc:Ignorable="d"
x:Name="root"
d:DesignHeight="1056" d:DesignWidth="1094" Foreground="#78C94F">
<Grid>
<Path Data="M132.5,205.601L206.22,205.602 229,131.5 251.78,205.602 325.5,205.601 265.859,251.398 288.64,325.5 229,279.702 169.36,325.5 192.141,251.398z"
Fill="{Binding ElementName=root,Path=Foreground}" Stretch="Fill"/>
</Grid>
</UserControl>

+ 55
- 0
BPASmartClient.SCADAControl/CustomerControls/GraphStar.xaml.cs Целия файл

@@ -0,0 +1,55 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// 五角星
/// GraphStar.xaml 的交互逻辑
/// </summary>
public partial class GraphStar : UserControl, IExecutable
{
public GraphStar()
{
InitializeComponent();
Width = 100;
Height = 100;
}

public string ControlType => "图形";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
IsEnabled = true;
Register();
Style = null;
}
}
}

public void Register()
{
}
}
}

+ 241
- 0
BPASmartClient.SCADAControl/CustomerControls/KnobButton.cs Целия файл

@@ -0,0 +1,241 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// 旋转刻度
/// </summary>
public class KnobButton : Slider, IExecutable
{
static KnobButton()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(KnobButton), new FrameworkPropertyMetadata(typeof(KnobButton)));
}

public KnobButton()
{
SetCurrentValue(WidthProperty, 150d);
SetCurrentValue(HeightProperty, 150d);
SetCurrentValue(MaximumProperty, 100d);
MouseDown += Path_MouseDown;
MouseMove += Path_MouseMove;
MouseWheel += Path_MouseWheel;
MouseLeftButtonUp += KnobButton_MouseLeftButtonUp;
Update();
}

#region 设计需要
public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
Register();
}
}

/// <summary>
/// 注册需要处理的事件
/// </summary>
public void Register()
{
ValueChanged += KnobButton_ValueChanged; ;
}

private void KnobButton_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Config.GetInstance().RunJsScipt(ValueChangedExecute);
}
#endregion

#region 绘制
private void InitTick()
{
// 画大刻度
for (int i = 0; i < 11; i++)
{
Line line = new Line();
line.X1 = 0;
line.Y1 = 0;
line.X2 = 0;
line.Y2 = 12;
line.Stroke = Brushes.Gray;
line.StrokeThickness = 2;
line.HorizontalAlignment = HorizontalAlignment.Center;
line.RenderTransformOrigin = new Point(0.5, 0.5);
line.RenderTransform = new RotateTransform() { Angle = -140 + i * 28 };
bdGrid.Children.Add(line);
}

// 画小刻度
for (int i = 0; i < 10; i++)
{
var start = -140 + 28 * i + 2.8;
for (int j = 0; j < 9; j++)
{
Line line = new Line();
line.X1 = 0;
line.Y1 = 0;
line.X2 = 0;
line.Y2 = 6;
line.Stroke = Brushes.Gray;
line.StrokeThickness = 1;
line.HorizontalAlignment = HorizontalAlignment.Center;
line.RenderTransformOrigin = new Point(0.5, 0.5);
line.RenderTransform = new RotateTransform() { Angle = start + j * 2.8 };
bdGrid.Children.Add(line);
}
}
}
#endregion
protected override void OnValueChanged(double oldValue, double newValue)
{
base.OnValueChanged(oldValue, newValue);
Update();
}

protected override void OnMaximumChanged(double oldMaximum, double newMaximum)
{
base.OnMaximumChanged(oldMaximum, newMaximum);
Update();
}

protected override void OnMinimumChanged(double oldMinimum, double newMinimum)
{
base.OnMinimumChanged(oldMinimum, newMinimum);
Update();
}

public string ValueChangedExecute
{
get { return (string)GetValue(ValueChangedExecuteProperty); }
set { SetValue(ValueChangedExecuteProperty, value); }
}
public static readonly DependencyProperty ValueChangedExecuteProperty =
DependencyProperty.Register("ValueChangedExecute", typeof(string), typeof(KnobButton), new PropertyMetadata(string.Empty));

public int Step
{
get { return (int)GetValue(StepProperty); }
set { SetValue(StepProperty, value); }
}
public static readonly DependencyProperty StepProperty =
DependencyProperty.Register("Step", typeof(int), typeof(KnobButton), new PropertyMetadata(1));

RotateTransform rotatevalue;
Grid bdGrid;
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
rotatevalue = GetTemplateChild("rotatevalue") as RotateTransform;
bdGrid = GetTemplateChild("bdGrid") as Grid;
Update();
InitTick();
}

private void Update()
{
if (rotatevalue == null) return;
double perangle = 280 / (Maximum - Minimum);
double angle = (perangle * (Value - Minimum)) + 40;

DoubleAnimation da = new DoubleAnimation();
da.Duration = new Duration(TimeSpan.FromMilliseconds(350));
da.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut };
da.To = angle;

rotatevalue.Angle = angle;
rotatevalue.BeginAnimation(RotateTransform.AngleProperty, da);
}

Point lastpoint;
private void Path_MouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Released) return;

CaptureMouse();
Point point = e.GetPosition(this);
double xmove = point.X - lastpoint.X;
double ymove = point.Y - lastpoint.Y;

double changeValue = (xmove + ymove) / 10 * Step;
if ((changeValue + Value) > Maximum)
{
if (Value < Maximum)
{
Value = Maximum;
}
return;
}

if ((changeValue + Value) < Minimum)
{
if (Value > Minimum)
{
Value = Minimum;
}
return;
}

Value = changeValue + Value;
lastpoint = point;
}

private void Path_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Released) return;
lastpoint = e.GetPosition(this);
}

private void KnobButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
ReleaseMouseCapture();
}

private void Path_MouseWheel(object sender, MouseWheelEventArgs e)
{
double changeValue = (e.Delta / 120) * Step;
if ((changeValue + Value) > Maximum)
{
if (Value < Maximum)
{
Value = Maximum;
}
return;
}

if ((changeValue + Value) < Minimum)
{
if (Value > Minimum)
{
Value = Minimum;
}
return;
}

Value = Value + changeValue;
Update();
}
}
}

BPASmartClient.SCADAControl/NewConveyorBelt.xaml → BPASmartClient.SCADAControl/CustomerControls/NewConveyorBelt.xaml Целия файл

@@ -1,9 +1,9 @@
<UserControl x:Class="BPASmartClient.SCADAControl.NewConveyorBelt"
<UserControl x:Class="BPASmartClient.SCADAControl.CustomerControls.NewConveyorBelt"
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:local="clr-namespace:BPASmartClient.SCADAControl"
xmlns:local="clr-namespace:BPASmartClient.SCADAControl.CustomerControls"
mc:Ignorable="d"
x:Name="gr"
Margin="0,0,0,0"

BPASmartClient.SCADAControl/NewConveyorBelt.xaml.cs → BPASmartClient.SCADAControl/CustomerControls/NewConveyorBelt.xaml.cs Целия файл

@@ -25,9 +25,10 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl
namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// 滚筒线
/// NewConveyorBelt.xaml 的交互逻辑
/// </summary>
public partial class NewConveyorBelt : UserControl, IExecutable

+ 370
- 0
BPASmartClient.SCADAControl/CustomerControls/NumberBox.cs Целия файл

@@ -0,0 +1,370 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl.CustomerControls
{
public class NumberBox : TextBox, IExecutable
{
static NumberBox()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(NumberBox), new FrameworkPropertyMetadata(typeof(NumberBox)));

FrameworkPropertyMetadata metadata = new FrameworkPropertyMetadata(CURVALUE, new PropertyChangedCallback(OnCurValueChanged));
CurValueProperty = DependencyProperty.Register("CurValue", typeof(double), typeof(NumberBox), metadata);

metadata = new FrameworkPropertyMetadata(MINVALUE, new PropertyChangedCallback(OnMinValueChanged));
MinValueProperty = DependencyProperty.Register("MinValue", typeof(double), typeof(NumberBox), metadata);

metadata = new FrameworkPropertyMetadata(MAXVALUE, new PropertyChangedCallback(OnMaxValueChanged));
MaxValueProperty = DependencyProperty.Register("MaxValue", typeof(double), typeof(NumberBox), metadata);

metadata = new FrameworkPropertyMetadata(DIGITS, new PropertyChangedCallback(OnDigitsChanged));
DigitsProperty = DependencyProperty.Register("Digits", typeof(int), typeof(NumberBox), metadata);
}
public string ControlType => "控件";

public NumberBox()
{
Width = 80;
Height = 30;
CurValue = 0.01;
Digits = 2;

VerticalContentAlignment = VerticalAlignment.Center;
Style = Application.Current.Resources["DesignNumberBox"] as Style;//FindResource("DesignNumberBox") as Style;

this.TextChanged += NumberBox_TextChanged;
this.PreviewKeyDown += NumberBox_KeyDown;
this.LostFocus += NumberBox_LostFocus;
DataObject.AddPastingHandler(this, NumberBox_Pasting);
Focusable = false;
}

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
IsEnabled = true;
Register();
Style = null;
Focusable = true;
}
}
}

public void Register()
{
}

#region DependencyProperty
private const double CURVALUE = 0; //当前值
private const double MINVALUE = double.MinValue; //最小值
private const double MAXVALUE = double.MaxValue; //最大值
private const int DIGITS = 15; //小数点精度

public static readonly DependencyProperty CurValueProperty;
public static readonly DependencyProperty MinValueProperty;
public static readonly DependencyProperty MaxValueProperty;
public static readonly DependencyProperty DigitsProperty;

public double CurValue
{
get
{
return (double)GetValue(CurValueProperty);
}
set
{
double v = value;
if (value < MinValue)
{
v = MinValue;
}
else if (value > MaxValue)
{
v = MaxValue;
}
v = Math.Round(v, Digits);

SetValue(CurValueProperty, v);
// if do not go into OnCurValueChanged then force update ui
if (v != value)
{
this.Text = v.ToString();
}
}
}
public double MinValue
{
get
{
return (double)GetValue(MinValueProperty);
}
set
{
SetValue(MinValueProperty, value);
}
}
public double MaxValue
{
get
{
return (double)GetValue(MaxValueProperty);
}
set
{
SetValue(MaxValueProperty, value);
}
}
public int Digits
{
get
{
return (int)GetValue(DigitsProperty);
}
set
{
int digits = value;
if (digits <= 0)
{
digits = 0;
}
if (digits > 15)
{
digits = 15;
}
SetValue(DigitsProperty, value);
}
}

private static void OnCurValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
double value = (double)e.NewValue;
NumberBox numericBox = (NumberBox)sender;
numericBox.Text = value.ToString();
}
private static void OnMinValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
double minValue = (double)e.NewValue;
NumberBox numericBox = (NumberBox)sender;
numericBox.MinValue = minValue;
}
private static void OnMaxValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
double maxValue = (double)e.NewValue;
NumberBox numericBox = (NumberBox)sender;
numericBox.MaxValue = maxValue;
}
private static void OnDigitsChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
int digits = (int)e.NewValue;
NumberBox numericBox = (NumberBox)sender;
numericBox.CurValue = Math.Round(numericBox.CurValue, digits);
numericBox.MinValue = Math.Round(numericBox.MinValue, digits);
numericBox.MaxValue = Math.Round(numericBox.MaxValue, digits);
}
#endregion


void NumberBox_TextChanged(object sender, TextChangedEventArgs e)
{
NumberBox numericBox = sender as NumberBox;
if (string.IsNullOrEmpty(numericBox.Text))
{
return;
}

TrimZeroStart();

double value = MinValue;
if (!Double.TryParse(numericBox.Text, out value))
{
return;
}

if (value != this.CurValue)
{
this.CurValue = value;
}
}

void NumberBox_KeyDown(object sender, KeyEventArgs e)
{
Key key = e.Key;
if (IsControlKeys(key))
{
return;
}
else if (IsDigit(key))
{
return;
}
else if (IsSubtract(key)) //-
{
TextBox textBox = sender as TextBox;
string str = textBox.Text;
if (str.Length > 0 && textBox.SelectionStart != 0)
{
e.Handled = true;
}
}
else if (IsDot(key)) //point
{
if (this.Digits > 0)
{
TextBox textBox = sender as TextBox;
string str = textBox.Text;
if (str.Contains('.') || str == "-")
{
e.Handled = true;
}
}
else
{
e.Handled = true;
}
}
else
{
e.Handled = true;
}
}

void NumberBox_LostFocus(object sender, RoutedEventArgs e)
{
NumberBox numericBox = sender as NumberBox;
if (string.IsNullOrEmpty(numericBox.Text))
{
numericBox.Text = this.CurValue.ToString();
}
}

private void NumberBox_Pasting(object sender, DataObjectPastingEventArgs e)
{
e.CancelCommand();
}

private static readonly List<Key> _controlKeys = new List<Key>
{
Key.Back,
Key.CapsLock,
Key.Down,
Key.End,
Key.Enter,
Key.Escape,
Key.Home,
Key.Insert,
Key.Left,
Key.PageDown,
Key.PageUp,
Key.Right,
Key.Tab,
Key.Up
};
public static bool IsControlKeys(Key key)
{
return _controlKeys.Contains(key);
}

public static bool IsDigit(Key key)
{
bool shiftKey = (Keyboard.Modifiers & ModifierKeys.Shift) != 0;
bool retVal;
if (key >= Key.D0 && key <= Key.D9 && !shiftKey)
{
retVal = true;
}
else
{
retVal = key >= Key.NumPad0 && key <= Key.NumPad9;
}
return retVal;
}


public static bool IsDot(Key key)
{
bool shiftKey = (Keyboard.Modifiers & ModifierKeys.Shift) != 0;
bool flag = false;
if (key == Key.Decimal)
{
flag = true;
}
if (key == Key.OemPeriod && !shiftKey)
{
flag = true;
}
return flag;
}
public static bool IsSubtract(Key key)
{
bool shiftKey = (Keyboard.Modifiers & ModifierKeys.Shift) != 0;
bool flag = false;
if (key == Key.Subtract)
{
flag = true;
}
if (key == Key.OemMinus && !shiftKey)
{
flag = true;
}
return flag;
}

private void TrimZeroStart()
{
if (this.Text.Length == 1)
{
return;
}
string resultText = this.Text;
int zeroCount = 0;
foreach (char c in this.Text)
{
if (c == '0') { zeroCount++; }
else { break; }
}
if (zeroCount == 0)
{
return;
}

if (this.Text.Contains('.'))
{
if (this.Text[zeroCount] != '.')
{
resultText = this.Text.TrimStart('0');
}
else if (zeroCount > 1)
{
resultText = this.Text.Substring(zeroCount - 1);
}
}
else if (zeroCount > 0)
{
resultText = this.Text.TrimStart('0');
}
}

}
}

BPASmartClient.SCADAControl/Silos.xaml → BPASmartClient.SCADAControl/CustomerControls/Silos.xaml Целия файл

@@ -1,4 +1,4 @@
<UserControl x:Class="BPASmartClient.SCADAControl.Silos"
<UserControl x:Class="BPASmartClient.SCADAControl.CustomerControls.Silos"
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"

BPASmartClient.SCADAControl/Silos.xaml.cs → BPASmartClient.SCADAControl/CustomerControls/Silos.xaml.cs Целия файл

@@ -27,7 +27,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl
namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// Silos.xaml 的交互逻辑

+ 102
- 0
BPASmartClient.SCADAControl/CustomerControls/StatusLight.cs Целия файл

@@ -0,0 +1,102 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// 状态标志
/// </summary>
public class StatusLight : Control, IExecutable
{
public StatusLight()
{
Width = 80;
Height = 80;
}
public string ControlType => "控件";

static StatusLight()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(StatusLight), new FrameworkPropertyMetadata(typeof(StatusLight)));
}

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

/// <summary>
/// 状态值
/// </summary>
[Category("值设定")]
public int StatusValue
{
get { return (int)GetValue(StatusValueProperty); }
set { SetValue(StatusValueProperty, value); }
}
public static readonly DependencyProperty StatusValueProperty =
DependencyProperty.Register("StatusValue", typeof(int), typeof(StatusLight), new UIPropertyMetadata(0, OnStatusChanged));

private static void OnStatusChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as StatusLight).Refresh();

private void Refresh()
{
if (image != null)
{
switch (StatusValue)
{
case 0:
image.Source = new BitmapImage(new Uri("pack://application:,,,/Images/State0.png", UriKind.Absolute));
break;
case -1:
image.Source = new BitmapImage(new Uri("pack://application:,,,/Images/State11.png", UriKind.Absolute));
break;
case 1:
image.Source = new BitmapImage(new Uri("pack://application:,,,/Images/State1.png", UriKind.Absolute));
break;
case 2:
image.Source = new BitmapImage(new Uri("pack://application:,,,/Images/State2.png", UriKind.Absolute));
break;
default:
break;
}
}
}

Image image;
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
image = GetTemplateChild("ima") as Image;
Refresh();
}

public void Register()
{
}
}
}

BPASmartClient.SCADAControl/SwitchButton.cs → BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs Целия файл

@@ -17,8 +17,11 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl
namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// 开关button
/// </summary>
[TemplatePart(Name = ELLIPSE, Type = typeof(FrameworkElement))]
[TemplatePart(Name = TranslateX, Type = typeof(TranslateTransform))]
public class SwitchButton : ToggleButton, IExecutable

BPASmartClient.SCADAControl/TheButton.xaml → BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml Целия файл

@@ -1,4 +1,4 @@
<Button x:Class="BPASmartClient.SCADAControl.TheButton"
<Button x:Class="BPASmartClient.SCADAControl.CustomerControls.TheButton"
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"

BPASmartClient.SCADAControl/TheButton.xaml.cs → BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml.cs Целия файл

@@ -15,9 +15,10 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl
namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// 常用button
/// TheButton.xaml 的交互逻辑
/// </summary>
public partial class TheButton : Button, IExecutable

+ 9
- 0
BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml Целия файл

@@ -0,0 +1,9 @@
<CheckBox x:Class="BPASmartClient.SCADAControl.CustomerControls.TheCheckBox"
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:local="clr-namespace:BPASmartClient.SCADAControl.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</CheckBox>

+ 90
- 0
BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml.cs Целия файл

@@ -0,0 +1,90 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// TheCheckBox.xaml 的交互逻辑
/// </summary>
public partial class TheCheckBox : CheckBox, IExecutable
{
public TheCheckBox()
{
InitializeComponent();
Content = "勾选框";
VerticalContentAlignment = VerticalAlignment.Center;
}

public string ControlType => "控件";


private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

/// <summary>
/// 不勾选时执行代码
/// </summary>
[Category("事件")]
public string UnCheckedExec
{
get { return (string)GetValue(UnCheckedExecProperty); }
set { SetValue(UnCheckedExecProperty, value); }
}
public static readonly DependencyProperty UnCheckedExecProperty =
DependencyProperty.Register("UnCheckedExec", typeof(string), typeof(TheCheckBox), new PropertyMetadata(string.Empty));

/// <summary>
/// 勾选时执行代码
/// </summary>
[Category("事件")]
public string CheckedExec
{
get { return (string)GetValue(CheckedExecProperty); }
set { SetValue(CheckedExecProperty, value); }
}
public static readonly DependencyProperty CheckedExecProperty =
DependencyProperty.Register("CheckedExec", typeof(string), typeof(TheCheckBox), new PropertyMetadata(string.Empty));

public void Register()
{
Checked += TheCheckBox_Checked;
Unchecked += TheCheckBox_Unchecked;
}

private void TheCheckBox_Unchecked(object sender, RoutedEventArgs e)
{
Config.GetInstance().RunJsScipt(UnCheckedExec);
}

private void TheCheckBox_Checked(object sender, RoutedEventArgs e)
{
Config.GetInstance().RunJsScipt(CheckedExec);
}
}
}

+ 9
- 0
BPASmartClient.SCADAControl/CustomerControls/TheComboBox.xaml Целия файл

@@ -0,0 +1,9 @@
<ComboBox x:Class="BPASmartClient.SCADAControl.CustomerControls.TheComboBox"
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:local="clr-namespace:BPASmartClient.SCADAControl.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</ComboBox>

+ 73
- 0
BPASmartClient.SCADAControl/CustomerControls/TheComboBox.xaml.cs Целия файл

@@ -0,0 +1,73 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using BPASmartClient.SCADAControl.Converters;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;

namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// TheComboBox.xaml 的交互逻辑
/// </summary>
public partial class TheComboBox : ComboBox, IExecutable
{
public TheComboBox()
{
InitializeComponent();
VerticalContentAlignment = VerticalAlignment.Center;
ItemsString = new ItemsList() { "AA", "BB" };
Style = Application.Current.Resources["DesignComboBox"] as Style;
Width = 80;
Height = 30;
Focusable = false;
}
public string ControlType => "控件";

public ItemsList ItemsString
{
get { return (ItemsList)GetValue(ItemsStringProperty); }
set { SetValue(ItemsStringProperty, value); }
}

public static readonly DependencyProperty ItemsStringProperty =
DependencyProperty.Register("ItemsString", typeof(ItemsList), typeof(TheComboBox), new PropertyMetadata(null));

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Focusable = true;
IsEnabled = true;
Register();
Style = null;
}
}
}

public void Register()
{
// 运行时进行项目绑定
Binding binding = new Binding();
binding.RelativeSource = new RelativeSource() { Mode = RelativeSourceMode.Self };
binding.Path = new PropertyPath("ItemsString");
SetBinding(ItemsSourceProperty, binding);
}
}
}

+ 9
- 0
BPASmartClient.SCADAControl/CustomerControls/TheGroupBox.xaml Целия файл

@@ -0,0 +1,9 @@
<GroupBox x:Class="BPASmartClient.SCADAControl.CustomerControls.TheGroupBox"
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:local="clr-namespace:BPASmartClient.SCADAControl.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</GroupBox>

+ 56
- 0
BPASmartClient.SCADAControl/CustomerControls/TheGroupBox.xaml.cs Целия файл

@@ -0,0 +1,56 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// TheGroupBox.xaml 的交互逻辑
/// </summary>
public partial class TheGroupBox : GroupBox, IExecutable
{
public TheGroupBox()
{
InitializeComponent();
Width = 150;
Height = 150;
Header = "分组";
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

/// <summary>
/// 注册需要处理的事件
/// </summary>
public void Register()
{
}
}
}

+ 9
- 0
BPASmartClient.SCADAControl/CustomerControls/TheImage.xaml Целия файл

@@ -0,0 +1,9 @@
<Image x:Class="BPASmartClient.SCADAControl.CustomerControls.TheImage"
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:local="clr-namespace:BPASmartClient.SCADAControl.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" Source="/BPASmartClient.SCADAControl;component/Images/State0.png">
</Image>

+ 55
- 0
BPASmartClient.SCADAControl/CustomerControls/TheImage.xaml.cs Целия файл

@@ -0,0 +1,55 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// TheImage.xaml 的交互逻辑
/// </summary>
public partial class TheImage : Image, IExecutable
{
public TheImage()
{
InitializeComponent();
Stretch = Stretch.UniformToFill;
//SetCurrentValue(SourceProperty, new BitmapImage(new Uri("pack://application:,,,/Images/借出.png", UriKind.Absolute)));
//Width = 120;
//Height = 40;
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

public void Register()
{

}
}
}

+ 57
- 0
BPASmartClient.SCADAControl/CustomerControls/TheRadioButton.cs Целия файл

@@ -0,0 +1,57 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl.CustomerControls
{
public class TheRadioButton : RadioButton, IExecutable, IDisposable
{
public TheRadioButton()
{
SetCurrentValue(ContentProperty, "单选按钮");
}
static TheRadioButton()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(TheRadioButton), new FrameworkPropertyMetadata(typeof(TheRadioButton)));
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
Style = null;
}
}
}

public void Register()
{

}

public void Dispose()
{
}
}
}

+ 67
- 0
BPASmartClient.SCADAControl/CustomerControls/TheSlider.cs Целия файл

@@ -0,0 +1,67 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl.CustomerControls
{
public class TheSlider : Slider, IExecutable
{
static TheSlider()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(TheSlider), new FrameworkPropertyMetadata(typeof(TheSlider)));
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
Style = null;
}
}
}

public string ValueChangedExecute
{
get { return (string)GetValue(ValueChangedExecuteProperty); }
set { SetValue(ValueChangedExecuteProperty, value); }
}
public static readonly DependencyProperty ValueChangedExecuteProperty =
DependencyProperty.Register("ValueChangedExecute", typeof(string), typeof(TheSlider), new PropertyMetadata(string.Empty));


public void Register()
{
ValueChanged += TheSlider_ValueChanged;
}

private void TheSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Config.GetInstance().RunJsScipt(ValueChangedExecute);
}

public void Dispose()
{
}
}
}

+ 9
- 0
BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.xaml Целия файл

@@ -0,0 +1,9 @@
<TextBlock x:Class="BPASmartClient.SCADAControl.CustomerControls.TheTextBlock"
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:local="clr-namespace:BPASmartClient.SCADAControl.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</TextBlock>

+ 51
- 0
BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.xaml.cs Целия файл

@@ -0,0 +1,51 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// TheTextBlock.xaml 的交互逻辑
/// </summary>
public partial class TheTextBlock : TextBlock, IExecutable
{
public TheTextBlock()
{
InitializeComponent();
Text = "文本块";
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

public void Register()
{
}
}
}

+ 57
- 0
BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs Целия файл

@@ -0,0 +1,57 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SCADAControl.CustomerControls
{
public class TheTextBox : TextBox, IExecutable
{
static TheTextBox()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(TheTextBox), new FrameworkPropertyMetadata(typeof(TheTextBox)));
}

public TheTextBox()
{
Text = "0.01";
VerticalContentAlignment = VerticalAlignment.Center;
Style = Application.Current.Resources["DesignTheTextBox"] as Style;//FindResource("DesignTheTextBox") as Style;
Focusable = false;
}
public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
IsEnabled = true;
Focusable = true;
Register();
Style = null;
}
}
}

public void Register()
{
}
}
}

+ 97
- 0
BPASmartClient.SCADAControl/CustomerControls/TheTimer.cs Целия файл

@@ -0,0 +1,97 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace BPASmartClient.SCADAControl.CustomerControls
{
public class TheTimer : Control, IExecutable, IDisposable
{
public TheTimer()
{
Width = 40;
Height = 40;
}
static TheTimer()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(TheTimer), new FrameworkPropertyMetadata(typeof(TheTimer)));
}

public string ControlType => "控件";


private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
Style = null;
}
}
}

DispatcherTimer timer = new DispatcherTimer();
public void Register()
{
timer.Interval = TimeSpan.FromMilliseconds(Interval);
timer.Tick += Timer_Tick;
timer.Start();
}

private void Timer_Tick(object sender, EventArgs e)
{
Config.GetInstance().RunJsScipt(TikcExecute);
}

public void Start() => timer.Start();
public void Stop() => timer.Stop();

public void Dispose()
{
timer.Stop();
}

/// <summary>
/// 时间间隔
/// </summary>
public int Interval
{
get { return (int)GetValue(IntervalProperty); }
set { SetValue(IntervalProperty, value); }
}
public static readonly DependencyProperty IntervalProperty =
DependencyProperty.Register("Interval", typeof(int), typeof(TheTimer), new PropertyMetadata(0));


/// <summary>
/// 执行内容
/// </summary>
[Category("事件")]
public string TikcExecute
{
get { return (string)GetValue(TikcExecuteProperty); }
set { SetValue(TikcExecuteProperty, value); }
}
public static readonly DependencyProperty TikcExecuteProperty =
DependencyProperty.Register("TikcExecute", typeof(string), typeof(TheTimer), new PropertyMetadata(string.Empty));
}
}

+ 9
- 0
BPASmartClient.SCADAControl/CustomerControls/TheToggleButton.xaml Целия файл

@@ -0,0 +1,9 @@
<ToggleButton x:Class="BPASmartClient.SCADAControl.CustomerControls.TheToggleButton"
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:local="clr-namespace:BPASmartClient.SCADAControl.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</ToggleButton>

+ 97
- 0
BPASmartClient.SCADAControl/CustomerControls/TheToggleButton.xaml.cs Целия файл

@@ -0,0 +1,97 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// TheToggleButton.xaml 的交互逻辑
/// </summary>
public partial class TheToggleButton : ToggleButton, IExecutable
{
/// <summary>
/// 开关按钮
/// </summary>
public TheToggleButton()
{
InitializeComponent();
Content = "开关";
Width = 80;
Height = 30;
Style = Application.Current.Resources["DesignToggleButton"] as Style;//FindResource("DesignToggleButton") as Style;
VerticalContentAlignment = VerticalAlignment.Center;
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Style = Application.Current.Resources["ExecuteToggleButton"] as Style;//FindResource("ExecuteToggleButton") as Style;

Register();
}
}
}

/// <summary>
/// 不勾选时执行代码
/// </summary>
[Category("事件")]
public string UnCheckedExec
{
get { return (string)GetValue(UnCheckedExecProperty); }
set { SetValue(UnCheckedExecProperty, value); }
}
public static readonly DependencyProperty UnCheckedExecProperty =
DependencyProperty.Register("UnCheckedExec", typeof(string), typeof(TheToggleButton), new PropertyMetadata(string.Empty));

/// <summary>
/// 勾选时执行代码
/// </summary>
[Category("事件")]
public string CheckedExec
{
get { return (string)GetValue(CheckedExecProperty); }
set { SetValue(CheckedExecProperty, value); }
}
public static readonly DependencyProperty CheckedExecProperty =
DependencyProperty.Register("CheckedExec", typeof(string), typeof(TheToggleButton), new PropertyMetadata(string.Empty));

public void Register()
{
Checked += TheCheckBox_Checked;
Unchecked += TheCheckBox_Unchecked;
}

private void TheCheckBox_Unchecked(object sender, RoutedEventArgs e)
{
Config.GetInstance().RunJsScipt(UnCheckedExec);
}

private void TheCheckBox_Checked(object sender, RoutedEventArgs e)
{
Config.GetInstance().RunJsScipt(CheckedExec);
}
}
}

+ 185
- 0
BPASmartClient.SCADAControl/CustomerControls/WaveProgressBar.cs Целия файл

@@ -0,0 +1,185 @@
using BPASmartClient.Compiler;
using BPASmartClient.SCADAControl;
using System;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media;

namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// 波浪进度条
/// </summary>
[TemplatePart(Name = ElementWave, Type = typeof(FrameworkElement))]
[TemplatePart(Name = ElementClip, Type = typeof(FrameworkElement))]
public class WaveProgressBar : RangeBase, IExecutable
{
private const string ElementWave = "PART_Wave";

private const string ElementClip = "PART_Clip";

private FrameworkElement _waveElement;

private const double TranslateTransformMinY = -20;

private double _translateTransformYRange;

private TranslateTransform _translateTransform;

public WaveProgressBar()
{
Loaded += (s, e) => UpdateWave(Value);
SetCurrentValue(WidthProperty, 200d);
SetCurrentValue(HeightProperty, 200d);
SetCurrentValue(ValueProperty, 50d);
}

static WaveProgressBar()
{
FocusableProperty.OverrideMetadata(typeof(WaveProgressBar),
new FrameworkPropertyMetadata(ValueBoxes.FalseBox));
MaximumProperty.OverrideMetadata(typeof(WaveProgressBar),
new FrameworkPropertyMetadata(ValueBoxes.Double100Box));
}

protected override void OnValueChanged(double oldValue, double newValue)
{
base.OnValueChanged(oldValue, newValue);

UpdateWave(newValue);
}

private void UpdateWave(double value)
{
if (_translateTransform == null || IsVerySmall(Maximum)) return;
var scale = 1 - value / Maximum;
var y = _translateTransformYRange * scale + TranslateTransformMinY;
_translateTransform.Y = y;
}

public static bool IsVerySmall(double value) => Math.Abs(value) < 1E-06;

public override void OnApplyTemplate()
{
base.OnApplyTemplate();

_waveElement = GetTemplateChild(ElementWave) as FrameworkElement;
var clipElement = GetTemplateChild(ElementClip) as FrameworkElement;

if (_waveElement != null && clipElement != null)
{
_translateTransform = new TranslateTransform
{
Y = clipElement.Height
};
_translateTransformYRange = clipElement.Height - TranslateTransformMinY;
_waveElement.RenderTransform = new TransformGroup
{
Children = { _translateTransform }
};
}
}

public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
"Text", typeof(string), typeof(WaveProgressBar), new PropertyMetadata(default(string)));

public string Text
{
get => (string)GetValue(TextProperty);
set => SetValue(TextProperty, value);
}

public static readonly DependencyProperty ShowTextProperty = DependencyProperty.Register(
"ShowText", typeof(bool), typeof(WaveProgressBar), new PropertyMetadata(ValueBoxes.TrueBox));

public bool ShowText
{
get => (bool)GetValue(ShowTextProperty);
set => SetValue(ShowTextProperty, ValueBoxes.BooleanBox(value));
}

public static readonly DependencyProperty WaveFillProperty = DependencyProperty.Register(
"WaveFill", typeof(Brush), typeof(WaveProgressBar), new PropertyMetadata(default(Brush)));

public Brush WaveFill
{
get => (Brush)GetValue(WaveFillProperty);
set => SetValue(WaveFillProperty, value);
}

public static readonly DependencyProperty WaveThicknessProperty = DependencyProperty.Register(
"WaveThickness", typeof(double), typeof(WaveProgressBar), new PropertyMetadata(ValueBoxes.Double0Box));

public double WaveThickness
{
get => (double)GetValue(WaveThicknessProperty);
set => SetValue(WaveThicknessProperty, value);
}

public static readonly DependencyProperty WaveStrokeProperty = DependencyProperty.Register(
"WaveStroke", typeof(Brush), typeof(WaveProgressBar), new PropertyMetadata(default(Brush)));

public Brush WaveStroke
{
get => (Brush)GetValue(WaveStrokeProperty);
set => SetValue(WaveStrokeProperty, value);
}

public string ControlType => "控件";

private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
}
}
}

public void Register()
{
}
}

internal static class ValueBoxes
{
internal static object TrueBox = true;

internal static object FalseBox = false;

internal static object Double0Box = .0;

internal static object Double01Box = .1;

internal static object Double1Box = 1.0;

internal static object Double10Box = 10.0;

internal static object Double20Box = 20.0;

internal static object Double100Box = 100.0;

internal static object Double200Box = 200.0;

internal static object Double300Box = 300.0;

internal static object DoubleNeg1Box = -1.0;

internal static object Int0Box = 0;

internal static object Int1Box = 1;

internal static object Int2Box = 2;

internal static object Int5Box = 5;

internal static object Int99Box = 99;

internal static object BooleanBox(bool value) => value ? TrueBox : FalseBox;
}
}

Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


+ 259
- 28
BPASmartClient.SCADAControl/Themes/Generic.xaml Целия файл

@@ -1,21 +1,25 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BPASmartClient.SCADAControl"
xmlns:ctrl="clr-namespace:BPASmartClient.SCADAControl"
xmlns:con="clr-namespace:BPASmartClient.SCADAControl.Converters">
<!--<Style TargetType="{x:Type local:CustomControl1}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:CustomControl1}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>-->
xmlns:con="clr-namespace:BPASmartClient.SCADAControl.Converters"
xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
xmlns:ctrl="clr-namespace:BPASmartClient.SCADAControl.CustomerControls">
<SolidColorBrush x:Key="AccentBrush" Color="#2B79E2"/>
<SolidColorBrush x:Key="ControlBorderBrush" Color="LightGray"/>
<SolidColorBrush x:Key="ControlBackground" Color="White"/>
<SolidColorBrush x:Key="ControlForeground" Color="Black"/>
<LinearGradientBrush x:Key="NormalBackground" StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStopCollection>
<GradientStop Color="White" />
<GradientStop Color="#D0D0D0" Offset="0.5"/>
<GradientStop Color="#E3E3E3" Offset="1"/>
</GradientStopCollection>
</LinearGradientBrush>
<con:HalfNumberConverter x:Key="HalfNumber"/>
<FontFamily x:Key="Digital">
pack://application:,,,/Fonts/#DS-Digital
</FontFamily>

<Style TargetType="{x:Type ctrl:ArcGauge}">
<Setter Property="Background" Value="#646464"/>
@@ -95,19 +99,6 @@
</Setter>
</Style>

<LinearGradientBrush x:Key="NormalBackground" StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStopCollection>
<GradientStop Color="White" />
<GradientStop Color="#D0D0D0" Offset="0.5"/>
<GradientStop Color="#E3E3E3" Offset="1"/>
</GradientStopCollection>
</LinearGradientBrush>

<SolidColorBrush x:Key="AccentBrush" Color="#2B79E2"/>
<SolidColorBrush x:Key="ControlBorderBrush" Color="LightGray"/>
<SolidColorBrush x:Key="ControlBackground" Color="White"/>
<SolidColorBrush x:Key="ControlForeground" Color="Black"/>
<con:HalfNumberConverter x:Key="HalfNumber"/>
<Style TargetType="{x:Type ctrl:SwitchButton}">
<Setter Property="Background" Value="#00F4D5"/>
<Setter Property="BorderBrush" Value="LightGray"/>
@@ -145,4 +136,244 @@
</Setter>
</Style>

<Style TargetType="ctrl:DigitalNumber">
<Setter Property="Background" Value="#FF1A1E22"/>
<Setter Property="Foreground" Value="#FF0AA74D"/>
<Setter Property="NumberValue" Value="0.01"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:DigitalNumber">
<Grid Background="{TemplateBinding Background}">
<TextBlock x:Name="line" VerticalAlignment="Center" HorizontalAlignment="Center"
FontFamily="{StaticResource Digital}" FontSize="{TemplateBinding FontSize}"
Text="{Binding NumberValue,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ctrl:DigitalNumber},Mode=TwoWay}"
Foreground="{TemplateBinding Foreground}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type ctrl:KnobButton}">
<Setter Property="Background" Value="#0068F4"/>
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:KnobButton">
<Grid x:Name="bdGrid" Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}">
<Grid Margin="16" RenderTransformOrigin="0.5,0.5">
<Grid.RenderTransform>
<RotateTransform x:Name="rotatevalue" Angle="00"/>
</Grid.RenderTransform>

<Ellipse Margin="4" Fill="#FFF6F6F6" Stroke="{StaticResource ControlBorderBrush}" >
<Ellipse.Effect>
<DropShadowEffect ShadowDepth="2" BlurRadius="8" Direction="-90" Color="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=Background.(SolidColorBrush.Color)}"/>
</Ellipse.Effect>
</Ellipse>
<Ellipse Margin="12" Fill="{TemplateBinding Background}" Width="8" Height="8" VerticalAlignment="Bottom">
</Ellipse>
</Grid>
<TextBlock Text="{Binding Value,RelativeSource={RelativeSource Mode=TemplatedParent}, StringFormat={}{0:F2}}"
VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type ctrl:TheRadioButton}" BasedOn="{StaticResource {x:Type RadioButton}}">
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>

<Style TargetType="{x:Type ctrl:TheSlider}" BasedOn="{StaticResource {x:Type Slider}}">
<Setter Property="Width" Value="140"/>
<Setter Property="Maximum" Value="100"/>
<Setter Property="IsSnapToTickEnabled" Value="True"/>
<Setter Property="Minimum" Value="0"/>
<Setter Property="AutoToolTipPlacement" Value="BottomRight"/>
<Setter Property="SmallChange" Value="0.1"/>
<Setter Property="LargeChange" Value="0.1"/>
</Style>

<Style TargetType="{x:Type ctrl:TheTextBox}" BasedOn="{StaticResource {x:Type TextBox}}"/>

<Style TargetType="{x:Type ctrl:TheTimer}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ctrl:TheTimer}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Image Source="../Images/timericon.png" RenderOptions.BitmapScalingMode="Fant"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="ComboBox" x:Key="DesignComboBox">
<Setter Property="Focusable" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Border BorderThickness="1" BorderBrush="{StaticResource ControlBorderBrush}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ControlBackground}"/>
<Border Grid.Column="1" Background="{StaticResource ControlBackground}" BorderThickness="0" IsEnabled="False">
<Path Data="M0,0 8,0 4,4z" Fill="{StaticResource ControlForeground}" Margin="3" VerticalAlignment="Center"/>
</Border>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="ToggleButton" x:Key="DesignToggleButton">
<Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border BorderThickness="1" Background="{StaticResource NormalBackground}" BorderBrush="{StaticResource ControlBorderBrush}" CornerRadius="2">
<TextBlock Text="{TemplateBinding Content}" FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="ToggleButton" x:Key="ExecuteToggleButton">
<Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="bd" BorderThickness="1" Background="{StaticResource NormalBackground}" BorderBrush="{StaticResource ControlBorderBrush}" CornerRadius="2">
<TextBlock Text="{TemplateBinding Content}" FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" TargetName="bd">
<Setter.Value>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStopCollection>
<GradientStop Color="#6AD456" />
<GradientStop Color="#1DAE06" Offset="0.5"/>
<GradientStop Color="#8BDC7C" Offset="1"/>
</GradientStopCollection>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type ctrl:WaveProgressBar}">
<Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="WaveFill" Value="#36E7AE"/>
<Setter Property="WaveThickness" Value="2"/>
<Setter Property="WaveStroke" Value="#3649E7"/>
<Setter Property="ShowText" Value="True" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:WaveProgressBar">
<ControlTemplate.Resources>
<Storyboard x:Key="StoryboardOnLoaded" RepeatBehavior="Forever">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" Storyboard.TargetName="PART_Wave">
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="-400"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<StackPanel>
<Border Background="{TemplateBinding Background}">
<Viewbox>
<Border x:Name="PART_Clip" BorderThickness="{TemplateBinding BorderThickness}" ClipToBounds="True"
BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="100" Width="200" Height="200">
<Border.Clip>
<EllipseGeometry RadiusX="100" RadiusY="100" Center="100,100"/>
</Border.Clip>
<Grid>
<Path x:Name="PART_Wave" Stroke="{TemplateBinding WaveStroke}" ClipToBounds="True" StrokeThickness="{TemplateBinding WaveThickness}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="600" Height="250" Fill="{TemplateBinding WaveFill}" Stretch="Fill" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" Margin="0,0,-400,-20">
<Path.Data>
<PathGeometry>
<PathFigure StartPoint="0,1">
<PolyBezierSegment Points="0.5,1 0.5,0 1,0"/>
<PolyBezierSegment Points="1.5,0 1.5,1 2,1"/>
<PolyBezierSegment Points="2.5,1 2.5,0 3,0"/>
<PolyLineSegment Points="3,0 3,10, 0,10 0,1"/>
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
<TextBlock Visibility="{Binding ShowText,RelativeSource={RelativeSource TemplatedParent},Converter={x:Static con:BoolToVisibilityConverter.Instance}}"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"
Text="{Binding Value,RelativeSource={RelativeSource Mode=TemplatedParent},StringFormat={}{0:f2}%}"/>
</Grid>

</Border>
</Viewbox>
</Border>

</StackPanel>
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded" SourceName="PART_Wave">
<BeginStoryboard Name="BeginStoryboardWave" Storyboard="{StaticResource StoryboardOnLoaded}"/>
</EventTrigger>
<EventTrigger RoutedEvent="FrameworkElement.Unloaded" SourceName="PART_Wave">
<StopStoryboard BeginStoryboardName="BeginStoryboardWave"/>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type ctrl:StatusLight}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ctrl:StatusLight}">
<Border Width="{Binding Path=ActualHeight,RelativeSource={RelativeSource Self}}">
<Grid>
<Image x:Name="ima" Source="../Images/State0.png" RenderOptions.BitmapScalingMode="Fant">
</Image>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type ctrl:NumberBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="input:InputMethod.IsInputMethodEnabled" Value="False"/>
</Style>

<Style x:Key="DesignNumberBox" TargetType="{x:Type ctrl:NumberBox}">
<Setter Property="input:InputMethod.IsInputMethodEnabled" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:NumberBox">
<Border BorderBrush="{StaticResource ControlBorderBrush}" BorderThickness="1" Background="{StaticResource ControlBackground}">
<TextBlock Margin="4 0 0 0" Text="{TemplateBinding Text}" VerticalAlignment="Center" Foreground="BlueViolet"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Зареждане…
Отказ
Запис