You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.7 KiB
54 lines
1.7 KiB
using System.ComponentModel;
|
|
using System.Windows;
|
|
|
|
namespace HMIControl
|
|
{
|
|
|
|
public class TubeArc : HMIControlBase
|
|
{
|
|
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation",
|
|
typeof(ConnectOrientation), typeof(TubeArc),
|
|
new PropertyMetadata(new PropertyChangedCallback(ValueChangedCallback)));
|
|
|
|
static TubeArc()
|
|
{
|
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(TubeArc), new FrameworkPropertyMetadata(typeof(TubeArc)));
|
|
}
|
|
|
|
#region HMI属性
|
|
[Category("HMI")]
|
|
public ConnectOrientation Orientation
|
|
{
|
|
set
|
|
{
|
|
SetValue(OrientationProperty, value);
|
|
}
|
|
get
|
|
{
|
|
return (ConnectOrientation)GetValue(OrientationProperty);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
private static void ValueChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArgs args)
|
|
{
|
|
var tube = obj as TubeArc;
|
|
switch ((ConnectOrientation)args.NewValue)
|
|
{
|
|
case ConnectOrientation.Top:
|
|
VisualStateManager.GoToState(tube, "_1stQuarter", true);
|
|
return;
|
|
case ConnectOrientation.Bottom:
|
|
VisualStateManager.GoToState(tube, "_2ndQuarter", true);
|
|
return;
|
|
case ConnectOrientation.Left:
|
|
VisualStateManager.GoToState(tube, "_3rdQuarter", true);
|
|
return;
|
|
case ConnectOrientation.Right:
|
|
VisualStateManager.GoToState(tube, "_4thQuarter", true);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|