|
|
@@ -0,0 +1,156 @@
|
|
|
+using SKMC.UI.CustomControls;
|
|
|
+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 SKMC.UI.UserControls
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// StatusControl.xaml 的交互逻辑
|
|
|
+ /// </summary>
|
|
|
+ public partial class StatusControl : UserControl
|
|
|
+ {
|
|
|
+ public SolidColorBrush ActiveBrush
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return (SolidColorBrush)base.GetValue(StatusControl.ActiveBrushProperty);
|
|
|
+ }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ base.SetValue(StatusControl.ActiveBrushProperty, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public SolidColorBrush InactiveBrush
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return (SolidColorBrush)base.GetValue(StatusControl.InactiveBrushProperty);
|
|
|
+ }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ base.SetValue(StatusControl.InactiveBrushProperty, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public string Label
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return (string)base.GetValue(StatusControl.LabelProperty);
|
|
|
+ }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ base.SetValue(StatusControl.LabelProperty, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool IsActive
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return (bool)base.GetValue(StatusControl.IsActiveProperty);
|
|
|
+ }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ base.SetValue(StatusControl.IsActiveProperty, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 是否闪烁
|
|
|
+ /// </summary>
|
|
|
+ public bool IsBlinking
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return (bool)base.GetValue(StatusControl.IsBlinkingProperty);
|
|
|
+ }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ base.SetValue(StatusControl.IsBlinkingProperty, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 第二状态是否激活
|
|
|
+ /// </summary>
|
|
|
+ public bool? IsSecondStatusActive
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return (bool?)base.GetValue(StatusControl.IsSecondStatusActiveProperty);
|
|
|
+ }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ base.SetValue(StatusControl.IsSecondStatusActiveProperty, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 第二状态是否闪烁
|
|
|
+ /// </summary>
|
|
|
+ public bool IsSecondStatusBlinking
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return (bool)base.GetValue(StatusControl.IsSecondStatusBlinkingProperty);
|
|
|
+ }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ base.SetValue(StatusControl.IsSecondStatusBlinkingProperty, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 边框是否可见
|
|
|
+ /// </summary>
|
|
|
+ public bool IsBorderVisible
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return (bool)base.GetValue(StatusControl.IsBorderVisibleProperty);
|
|
|
+ }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ base.SetValue(StatusControl.IsBorderVisibleProperty, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public CornerRadius CornerRadius
|
|
|
+ {
|
|
|
+ get { return (CornerRadius)GetValue(CornerRadiusProperty); }
|
|
|
+ set { SetValue(CornerRadiusProperty, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ public StatusControl()
|
|
|
+ {
|
|
|
+ InitializeComponent();
|
|
|
+ }
|
|
|
+ public static readonly DependencyProperty ActiveBrushProperty = DependencyProperty.Register("ActiveBrush", typeof(SolidColorBrush), typeof(StatusControl), new PropertyMetadata(new BrushConverter().ConvertFromString("#00F976")));
|
|
|
+
|
|
|
+ public static readonly DependencyProperty InactiveBrushProperty = DependencyProperty.Register("InactiveBrush", typeof(SolidColorBrush), typeof(StatusControl), new PropertyMetadata(new BrushConverter().ConvertFromString("#404040")));
|
|
|
+
|
|
|
+ public static readonly DependencyProperty LabelProperty = DependencyProperty.Register("Label", typeof(string), typeof(StatusControl));
|
|
|
+
|
|
|
+ public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register("IsActive", typeof(bool), typeof(StatusControl));
|
|
|
+
|
|
|
+ public static readonly DependencyProperty IsBlinkingProperty = DependencyProperty.Register("IsBlinking", typeof(bool), typeof(StatusControl));
|
|
|
+
|
|
|
+ public static readonly DependencyProperty IsSecondStatusActiveProperty = DependencyProperty.Register("IsSecondStatusActive", typeof(bool?), typeof(StatusControl));
|
|
|
+
|
|
|
+ public static readonly DependencyProperty IsSecondStatusBlinkingProperty = DependencyProperty.Register("IsSecondStatusBlinking", typeof(bool), typeof(StatusControl));
|
|
|
+
|
|
|
+ public static readonly DependencyProperty IsBorderVisibleProperty = DependencyProperty.Register("IsBorderVisible", typeof(bool), typeof(StatusControl), new PropertyMetadata(true));
|
|
|
+ public static readonly DependencyProperty CornerRadiusProperty =
|
|
|
+ DependencyProperty.Register(nameof(CornerRadius), typeof(CornerRadius), typeof(StatusControl), new PropertyMetadata(new CornerRadius(0, 0, 0, 0)));
|
|
|
+
|
|
|
+ }
|
|
|
+}
|