@@ -0,0 +1,20 @@ | |||||
<UserControl x:Class="BPASmartClient.SCADAControl.CustomerControls.TheEllipse" | |||||
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" | |||||
Foreground="#FF00EDFF" | |||||
BorderBrush="Transparent" | |||||
BorderThickness="4" | |||||
d:DesignHeight="450" d:DesignWidth="800"> | |||||
<Ellipse Tag="Ellipse" | |||||
Fill="{Binding ElementName=root,Path=BJColor,Mode=TwoWay}" | |||||
Stroke="{Binding ElementName=root,Path=Foreground}" | |||||
StrokeThickness="{Binding ElementName=root,Path=BorderThickness}" | |||||
> | |||||
</Ellipse> | |||||
</UserControl> |
@@ -0,0 +1,122 @@ | |||||
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; | |||||
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> | |||||
/// TheEllipse.xaml 的交互逻辑 | |||||
/// </summary> | |||||
public partial class TheEllipse : UserControl, IExecutable | |||||
{ | |||||
Ellipse LeftTog = null; | |||||
public TheEllipse() | |||||
{ | |||||
InitializeComponent(); | |||||
this.Loaded += TheEllipse_Loaded; ; ; | |||||
this.SizeChanged += TheEllipse_SizeChanged; ; ; | |||||
} | |||||
private void TheEllipse_SizeChanged(object sender, SizeChangedEventArgs e) | |||||
{ | |||||
if (LeftTog == null) | |||||
{ | |||||
foreach (Ellipse tb in FindVisualChildren<Ellipse>(this)) | |||||
{ | |||||
if (tb.Tag != null) | |||||
{ | |||||
if (tb.Tag.ToString() == "Ellipse") LeftTog = tb; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject | |||||
{ | |||||
if (depObj != null) | |||||
{ | |||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++) | |||||
{ | |||||
DependencyObject child = VisualTreeHelper.GetChild(depObj, i); | |||||
if (child != null && child is T) | |||||
{ | |||||
yield return (T)child; | |||||
} | |||||
foreach (T childOfChild in FindVisualChildren<T>(child)) | |||||
{ | |||||
yield return childOfChild; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
private void TheEllipse_Loaded(object sender, RoutedEventArgs e) | |||||
{ | |||||
if (this.ActualWidth <= 20) | |||||
{ | |||||
Width = 80; | |||||
Height = 80; | |||||
} | |||||
} | |||||
public bool IsCheckedColor | |||||
{ | |||||
get { return (bool)GetValue(IsCheckedProperty); } | |||||
set { SetValue(IsCheckedProperty, value); } | |||||
} | |||||
public static readonly DependencyProperty IsCheckedProperty = | |||||
DependencyProperty.Register("IsChecked", typeof(bool), typeof(TheEllipse), new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged))); | |||||
public Brush BJColor | |||||
{ | |||||
get { return (Brush)GetValue(BJColorProperty); } | |||||
set { SetValue(BJColorProperty, value); } | |||||
} | |||||
public static readonly DependencyProperty BJColorProperty = | |||||
DependencyProperty.Register("BJColor", typeof(Brush), typeof(TheEllipse), new PropertyMetadata(new SolidColorBrush(Colors.Transparent))); | |||||
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||||
{ | |||||
(d as TheEllipse)?.Refresh(); | |||||
} | |||||
private void Refresh() | |||||
{ | |||||
//if (LeftTog != null) | |||||
//{ | |||||
// LeftTog.Fill = IsCheckedColor ? new SolidColorBrush(Colors.Transparent) : this.Foreground; | |||||
//} | |||||
} | |||||
public event EventHandler PropertyChange; //声明一个事件 | |||||
public string ControlType => "控件"; | |||||
private bool isExecuteState; | |||||
public bool IsExecuteState | |||||
{ | |||||
get { return isExecuteState; } | |||||
set | |||||
{ | |||||
isExecuteState = value; | |||||
if (IsExecuteState) | |||||
{ | |||||
Register(); | |||||
} | |||||
} | |||||
} | |||||
// <summary> | |||||
/// 运行事件 | |||||
/// </summary> | |||||
public void Register() | |||||
{ | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,20 @@ | |||||
<UserControl x:Class="BPASmartClient.SCADAControl.CustomerControls.TheRectangle" | |||||
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" | |||||
Foreground="#FF00EDFF" | |||||
BorderBrush="Transparent" | |||||
BorderThickness="4" | |||||
Tag="10" | |||||
d:DesignHeight="450" d:DesignWidth="800"> | |||||
<Border Tag="border" | |||||
Background="{Binding ElementName=root,Path=BJColor,Mode=TwoWay}" | |||||
BorderBrush="{Binding ElementName=root,Path=Foreground}" | |||||
BorderThickness="{Binding ElementName=root,Path=BorderThickness}" | |||||
CornerRadius="{Binding ElementName=root,Path=Tag}" | |||||
/> | |||||
</UserControl> |
@@ -0,0 +1,123 @@ | |||||
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; | |||||
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> | |||||
/// TheRectangle.xaml 的交互逻辑 | |||||
/// </summary> | |||||
public partial class TheRectangle : UserControl, IExecutable | |||||
{ | |||||
Border LeftTog = null; | |||||
public TheRectangle() | |||||
{ | |||||
InitializeComponent(); | |||||
this.Loaded += TheRectangle_Loaded; ; | |||||
this.SizeChanged += TheRectangle_SizeChanged; ; | |||||
} | |||||
private void TheRectangle_SizeChanged(object sender, SizeChangedEventArgs e) | |||||
{ | |||||
if (LeftTog == null) | |||||
{ | |||||
foreach (Border tb in FindVisualChildren<Border>(this)) | |||||
{ | |||||
if (tb.Tag != null) | |||||
{ | |||||
if (tb.Tag.ToString() == "border") LeftTog = tb; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject | |||||
{ | |||||
if (depObj != null) | |||||
{ | |||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++) | |||||
{ | |||||
DependencyObject child = VisualTreeHelper.GetChild(depObj, i); | |||||
if (child != null && child is T) | |||||
{ | |||||
yield return (T)child; | |||||
} | |||||
foreach (T childOfChild in FindVisualChildren<T>(child)) | |||||
{ | |||||
yield return childOfChild; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
private void TheRectangle_Loaded(object sender, RoutedEventArgs e) | |||||
{ | |||||
if (this.ActualWidth <= 20) | |||||
{ | |||||
Width = 80; | |||||
Height = 80; | |||||
} | |||||
} | |||||
public bool IsCheckedColor | |||||
{ | |||||
get { return (bool)GetValue(IsCheckedProperty); } | |||||
set { SetValue(IsCheckedProperty, value); } | |||||
} | |||||
public static readonly DependencyProperty IsCheckedProperty = | |||||
DependencyProperty.Register("IsChecked", typeof(bool), typeof(TheRectangle), new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged))); | |||||
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||||
{ | |||||
(d as TheRectangle)?.Refresh(); | |||||
} | |||||
private void Refresh() | |||||
{ | |||||
if (LeftTog != null) | |||||
{ | |||||
LeftTog.Background = IsCheckedColor ? new SolidColorBrush(Colors.Transparent) : this.Foreground; | |||||
} | |||||
} | |||||
public Brush BJColor | |||||
{ | |||||
get { return (Brush)GetValue(BJColorProperty); } | |||||
set { SetValue(BJColorProperty, value); } | |||||
} | |||||
public static readonly DependencyProperty BJColorProperty = | |||||
DependencyProperty.Register("BJColor", typeof(Brush), typeof(TheRectangle), new PropertyMetadata(new SolidColorBrush(Colors.Transparent))); | |||||
public event EventHandler PropertyChange; //声明一个事件 | |||||
public string ControlType => "控件"; | |||||
private bool isExecuteState; | |||||
public bool IsExecuteState | |||||
{ | |||||
get { return isExecuteState; } | |||||
set | |||||
{ | |||||
isExecuteState = value; | |||||
if (IsExecuteState) | |||||
{ | |||||
Register(); | |||||
} | |||||
} | |||||
} | |||||
// <summary> | |||||
/// 运行事件 | |||||
/// </summary> | |||||
public void Register() | |||||
{ | |||||
} | |||||
} | |||||
} |
@@ -225,9 +225,10 @@ | |||||
<mypro:PropertyDefinition DisplayName="物料描述" Category="基本属性" DisplayOrder="2" Name="WLText" Description="物料描述"/> | <mypro:PropertyDefinition DisplayName="物料描述" Category="基本属性" DisplayOrder="2" Name="WLText" Description="物料描述"/> | ||||
<mypro:PropertyDefinition DisplayName="物料标题" Category="基本属性" DisplayOrder="2" Name="WLTitle" Description="物料标题"/> | <mypro:PropertyDefinition DisplayName="物料标题" Category="基本属性" DisplayOrder="2" Name="WLTitle" Description="物料标题"/> | ||||
<mypro:PropertyDefinition DisplayName="标题" Category="基本属性" DisplayOrder="2" Name="Title" Description="标题"/> | <mypro:PropertyDefinition DisplayName="标题" Category="基本属性" DisplayOrder="2" Name="Title" Description="标题"/> | ||||
<mypro:PropertyDefinition DisplayName="运行状态" Category="基本属性" DisplayOrder="2" Name="Direction" Description="Direction"/> | |||||
<mypro:PropertyDefinition DisplayName="运行状态" Category="基本属性" DisplayOrder="2" Name="Direction" Description="Direction"/> | |||||
<mypro:PropertyDefinition DisplayName="Tag" Category="基本属性" DisplayOrder="2" Name="Tag" Description="Tag"/> | |||||
<mypro:PropertyDefinition DisplayName="最大值" Category="基本属性" DisplayOrder="3" Name="MaxValue" Description="MaxValue"/> | <mypro:PropertyDefinition DisplayName="最大值" Category="基本属性" DisplayOrder="3" Name="MaxValue" Description="MaxValue"/> | ||||
<mypro:PropertyDefinition DisplayName="最小值" Category="基本属性" DisplayOrder="3" Name="MinValue" Description="MinValue"/> | <mypro:PropertyDefinition DisplayName="最小值" Category="基本属性" DisplayOrder="3" Name="MinValue" Description="MinValue"/> | ||||
<mypro:PropertyDefinition DisplayName="最大值" Category="基本属性" DisplayOrder="3" Name="Maximum" Description="Maximum"/> | <mypro:PropertyDefinition DisplayName="最大值" Category="基本属性" DisplayOrder="3" Name="Maximum" Description="Maximum"/> | ||||
@@ -265,10 +266,9 @@ | |||||
<mypro:PropertyDefinition DisplayName="启动测试" Category="基本属性" DisplayOrder="9" Name="TestData"/> | <mypro:PropertyDefinition DisplayName="启动测试" Category="基本属性" DisplayOrder="9" Name="TestData"/> | ||||
<mypro:PropertyDefinition DisplayName="气缸左执行" Category="基本属性" DisplayOrder="10" Name="LeftTogIsChecked"/> | <mypro:PropertyDefinition DisplayName="气缸左执行" Category="基本属性" DisplayOrder="10" Name="LeftTogIsChecked"/> | ||||
<mypro:PropertyDefinition DisplayName="气缸右执行" Category="基本属性" DisplayOrder="10" Name="RightTogIsChecked"/> | <mypro:PropertyDefinition DisplayName="气缸右执行" Category="基本属性" DisplayOrder="10" Name="RightTogIsChecked"/> | ||||
<mypro:PropertyDefinition DisplayName="背景透明" Category="基本属性" DisplayOrder="10" Name="IsCheckedColor"/> | |||||
<mypro:PropertyDefinition DisplayName="数据来源类型" Category="数据绑定模块" DisplayOrder="0" Name="DataSouceType"/> | |||||
<mypro:PropertyDefinition DisplayName="数据来源类型" Category="数据绑定模块" DisplayOrder="0" Name="DataSouceType"/> | <mypro:PropertyDefinition DisplayName="数据来源类型" Category="数据绑定模块" DisplayOrder="0" Name="DataSouceType"/> | ||||
<mypro:PropertyDefinition DisplayName="设备名称" Category="数据绑定模块" DisplayOrder="0" Name="DeviceName"/> | <mypro:PropertyDefinition DisplayName="设备名称" Category="数据绑定模块" DisplayOrder="0" Name="DeviceName"/> | ||||
<mypro:PropertyDefinition DisplayName="接口类型" Category="数据绑定模块" DisplayOrder="1" Name="InterfaceMode"/> | <mypro:PropertyDefinition DisplayName="接口类型" Category="数据绑定模块" DisplayOrder="1" Name="InterfaceMode"/> | ||||
@@ -292,6 +292,8 @@ | |||||
<mypro:PropertyDefinition DisplayName="前景色" Category="颜色设置" Name="Foreground"/> | <mypro:PropertyDefinition DisplayName="前景色" Category="颜色设置" Name="Foreground"/> | ||||
<mypro:PropertyDefinition DisplayName="背景色" Category="颜色设置" Name="Background"/> | <mypro:PropertyDefinition DisplayName="背景色" Category="颜色设置" Name="Background"/> | ||||
<mypro:PropertyDefinition DisplayName="填充颜色" Category="颜色设置" Name="BJColor"/> | |||||
<mypro:PropertyDefinition DisplayName="边框色" Category="颜色设置" Name="BorderBrush"/> | <mypro:PropertyDefinition DisplayName="边框色" Category="颜色设置" Name="BorderBrush"/> | ||||
<mypro:PropertyDefinition DisplayName="填充" Category="基本属性" DisplayOrder="5" Name="WaveFill"/> | <mypro:PropertyDefinition DisplayName="填充" Category="基本属性" DisplayOrder="5" Name="WaveFill"/> | ||||
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="5" Name="WaveThickness"/> | <mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="5" Name="WaveThickness"/> | ||||
@@ -312,7 +314,7 @@ | |||||
</mypro:PropertyGrid.PropertyDefinitions> | </mypro:PropertyGrid.PropertyDefinitions> | ||||
<mypro:PropertyGrid.EditorDefinitions> | <mypro:PropertyGrid.EditorDefinitions> | ||||
<mypro:EditorTemplateDefinition TargetProperties="Foreground,Background,BorderBrush,WaveFill,WaveStroke,Fill,Stroke"> | |||||
<mypro:EditorTemplateDefinition TargetProperties="Foreground,Background,BorderBrush,WaveFill,WaveStroke,Fill,Stroke,BJColor"> | |||||
<mypro:EditorTemplateDefinition.EditingTemplate> | <mypro:EditorTemplateDefinition.EditingTemplate> | ||||
<DataTemplate> | <DataTemplate> | ||||
<mypro:ColorPicker SelectedColor="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={x:Static s:ColorToStringConverter.Instance}}" /> | <mypro:ColorPicker SelectedColor="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={x:Static s:ColorToStringConverter.Instance}}" /> | ||||
@@ -361,6 +361,16 @@ | |||||
<Setter TargetName="txt" Property="Text" Value="气缸控件" /> | <Setter TargetName="txt" Property="Text" Value="气缸控件" /> | ||||
</DataTrigger> | </DataTrigger> | ||||
<DataTrigger Binding="{Binding Name}" Value="TheRectangle"> | |||||
<Setter TargetName="icon" Property="Kind" Value="AlphaGCircleOutline" /> | |||||
<Setter TargetName="txt" Property="Text" Value="矩形" /> | |||||
</DataTrigger> | |||||
<DataTrigger Binding="{Binding Name}" Value="TheEllipse"> | |||||
<Setter TargetName="icon" Property="Kind" Value="AlphaGCircleOutline" /> | |||||
<Setter TargetName="txt" Property="Text" Value="圆形" /> | |||||
</DataTrigger> | |||||
</DataTemplate.Triggers> | </DataTemplate.Triggers> | ||||
</DataTemplate> | </DataTemplate> | ||||