@@ -53,8 +53,6 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" /> | <ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" /> | ||||
<ProjectReference Include="..\BPASmartClient.DATABUS\BPASmartClient.DATABUS.csproj" /> | <ProjectReference Include="..\BPASmartClient.DATABUS\BPASmartClient.DATABUS.csproj" /> | ||||
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" /> | |||||
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
@@ -1,11 +1,4 @@ | |||||
using BPASmartClient.Compiler; | using BPASmartClient.Compiler; | ||||
using BPASmartClient.MessageCommunication; | |||||
using BPASmartClient.MessageCommunication.MsgControl; | |||||
using BPASmartClient.MessageName; | |||||
using BPASmartClient.MessageName.EnumHelp; | |||||
using BPASmartClient.MessageName.发送消息Model; | |||||
using BPASmartClient.MessageName.接收消息Model; | |||||
using BPASmartClient.MessageName.接收消息Model.滚动线; | |||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -55,26 +48,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||||
StrokeDashArray = new DoubleCollection { 1.5, 1.5 }; | StrokeDashArray = new DoubleCollection { 1.5, 1.5 }; | ||||
StrokeFillBrush = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#00BEFA")); | StrokeFillBrush = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#00BEFA")); | ||||
StrokeThickness = 2; | StrokeThickness = 2; | ||||
this.Loaded += NewConveyorBelt_Loaded; ; | |||||
} | |||||
private void NewConveyorBelt_Loaded(object sender, RoutedEventArgs e) | |||||
{ | |||||
EventReceiveNameList.CollectionChanged += EventNameList_CollectionChanged; | |||||
} | |||||
private void EventNameList_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) | |||||
{ | |||||
if (EventReceiveNameList.Count > 0) | |||||
{ | |||||
try | |||||
{ | |||||
EventReceiveNameListStr = JsonConvert.SerializeObject(EventReceiveNameList); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | |||||
} | } | ||||
public string ControlType => "滚动线"; | public string ControlType => "滚动线"; | ||||
@@ -315,84 +288,12 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||||
} | } | ||||
public static readonly DependencyProperty ConveyorBeltStopProperty = | public static readonly DependencyProperty ConveyorBeltStopProperty = | ||||
DependencyProperty.Register("ConveyorBeltStop", typeof(string), typeof(NewConveyorBelt), new PropertyMetadata(string.Empty)); | DependencyProperty.Register("ConveyorBeltStop", typeof(string), typeof(NewConveyorBelt), new PropertyMetadata(string.Empty)); | ||||
[Category("名称[自动生成]")] | |||||
public string EventReceiveNameListStr | |||||
{ | |||||
get { return (string)GetValue(EventReceiveNameListStrProperty); } | |||||
set { SetValue(EventReceiveNameListStrProperty, value); } | |||||
} | |||||
public static readonly DependencyProperty EventReceiveNameListStrProperty = | |||||
DependencyProperty.Register("EventReceiveNameListStr",typeof(string),typeof(NewConveyorBelt),new PropertyMetadata(string.Empty,new PropertyChangedCallback(onEventReceiveNameListStrChanged))); | |||||
private static void onEventReceiveNameListStrChanged(DependencyObject d,DependencyPropertyChangedEventArgs e) => (d as NewConveyorBelt)?.ReceiveNameRefresh(); | |||||
[Category("消息接收名称集合")] | |||||
public ObservableCollection<EventReceiveMessage> EventReceiveNameList | |||||
{ | |||||
get { return (ObservableCollection<EventReceiveMessage>)GetValue(EventReceiveNameListProperty); } | |||||
set { SetValue(EventReceiveNameListProperty, value); } | |||||
} | |||||
public static readonly DependencyProperty EventReceiveNameListProperty = | |||||
DependencyProperty.Register("EventReceiveNameList", typeof(ObservableCollection<EventReceiveMessage>), typeof(NewConveyorBelt), new PropertyMetadata(new ObservableCollection<EventReceiveMessage>(), onEventNameListChanged)); | |||||
private static void onEventNameListChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as NewConveyorBelt)?.RunNameRefresh(); | |||||
#endregion | #endregion | ||||
#region 属性变更事件 | #region 属性变更事件 | ||||
List<string> MessageNameL = null; | List<string> MessageNameL = null; | ||||
public void Register() | public void Register() | ||||
{ | { | ||||
if (!string.IsNullOrEmpty(EventReceiveNameListStr)) | |||||
{ | |||||
try | |||||
{ | |||||
EventReceiveNameList = JsonConvert.DeserializeObject<ObservableCollection<EventReceiveMessage>>(EventReceiveNameListStr); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | |||||
List<string> MessageNameNew = EventReceiveNameList?.Select(o => o.MeaageName.ToString())?.Distinct()?.ToList(); | |||||
if (MessageNameL == null || !MessageNameNew.SequenceEqual(MessageNameL)) | |||||
{ | |||||
MessageNameL?.ForEach(o => Class_InnerMessageBus.GetInstance().RemoveMessage(o,"NewConveyorBeltEventHandler")); | |||||
MessageNameNew?.ForEach(x => Class_InnerMessageBus.GetInstance().ListenMessage(this,x,"NewConveyorBeltEventHandler")); | |||||
MessageNameL = MessageNameNew; | |||||
} | |||||
} | |||||
public void NewConveyorBeltEventHandler(object sender, InnerMessageEventArgs e) | |||||
{ | |||||
try | |||||
{ | |||||
if (IsExecuteState = true) | |||||
{ | |||||
if (e.obj_MessageObj is RunEnumModel)//接收到运行消息 | |||||
{ | |||||
RunEnumModel mode = (RunEnumModel)e.obj_MessageObj; | |||||
var msg = EventReceiveNameList?.ToList().Find(par => par.MeaageName.ToString() == e.str_MessageStr && par.MeaageID == mode.MessageID); | |||||
//必对消息号: | |||||
if (msg != null) | |||||
{ | |||||
Direction = mode.Run == RunEnum.Run ? 1 : ((mode.Run == RunEnum.Run_Left) ? 2 : 0); | |||||
} | |||||
} | |||||
else if (e.obj_MessageObj is ConveyorBeltMessageModel)//接收到数据模型 | |||||
{ | |||||
ConveyorBeltMessageModel mode = (ConveyorBeltMessageModel)e.obj_MessageObj; | |||||
var msg = EventReceiveNameList?.ToList().Find(par => par.MeaageName.ToString() == e.str_MessageStr && par.MeaageID == mode.MessageID); | |||||
//必对消息号: | |||||
if (msg != null) | |||||
{ | |||||
Text = mode.Title; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | } | ||||
private void Refursh() | private void Refursh() | ||||
@@ -1,12 +1,5 @@ | |||||
using BPASmartClient.Compiler; | using BPASmartClient.Compiler; | ||||
using BPASmartClient.DATABUS; | using BPASmartClient.DATABUS; | ||||
using BPASmartClient.MessageCommunication; | |||||
using BPASmartClient.MessageCommunication.MsgControl; | |||||
using BPASmartClient.MessageName; | |||||
using BPASmartClient.MessageName.EnumHelp; | |||||
using BPASmartClient.MessageName.发送消息Model; | |||||
using BPASmartClient.MessageName.接收消息Model; | |||||
using BPASmartClient.MessageName.接收消息Model.物料仓; | |||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using System; | using System; | ||||
using System.Collections; | using System.Collections; | ||||
@@ -1,8 +1,8 @@ | |||||
using BPASmart.Model; | using BPASmart.Model; | ||||
using BPASmartClient.Compiler; | using BPASmartClient.Compiler; | ||||
using BPASmartClient.DATABUS; | using BPASmartClient.DATABUS; | ||||
using BPASmartClient.MessageName.EnumHelp; | |||||
using BPASmartClient.SCADAControl; | using BPASmartClient.SCADAControl; | ||||
using BPASmartClient.SCADAControl.EnumClass; | |||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using Newtonsoft.Json.Linq; | using Newtonsoft.Json.Linq; | ||||
using StackExchange.Redis; | using StackExchange.Redis; | ||||
@@ -1,8 +1,7 @@ | |||||
using BPASmartClient.Compiler; | using BPASmartClient.Compiler; | ||||
using BPASmartClient.DATABUS; | using BPASmartClient.DATABUS; | ||||
using BPASmartClient.MessageName.EnumHelp; | |||||
using BPASmartClient.MessageName.接收消息Model.物料仓; | |||||
using BPASmartClient.SCADAControl.Converters; | using BPASmartClient.SCADAControl.Converters; | ||||
using BPASmartClient.SCADAControl.EnumClass; | |||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -1,8 +1,7 @@ | |||||
using BPASmartClient.Compiler; | using BPASmartClient.Compiler; | ||||
using BPASmartClient.DATABUS; | using BPASmartClient.DATABUS; | ||||
using BPASmartClient.MessageName.EnumHelp; | |||||
using BPASmartClient.MessageName.接收消息Model.物料仓; | |||||
using BPASmartClient.SCADAControl.Converters; | using BPASmartClient.SCADAControl.Converters; | ||||
using BPASmartClient.SCADAControl.EnumClass; | |||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -1,7 +1,6 @@ | |||||
using BPASmart.Model; | using BPASmart.Model; | ||||
using BPASmartClient.Compiler; | using BPASmartClient.Compiler; | ||||
using BPASmartClient.DATABUS; | using BPASmartClient.DATABUS; | ||||
using BPASmartClient.MessageName.EnumHelp; | |||||
using BPASmartClient.SCADAControl; | using BPASmartClient.SCADAControl; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using StackExchange.Redis; | using StackExchange.Redis; | ||||
@@ -1,7 +1,6 @@ | |||||
using BPASmart.Model; | using BPASmart.Model; | ||||
using BPASmartClient.Compiler; | using BPASmartClient.Compiler; | ||||
using BPASmartClient.DATABUS; | using BPASmartClient.DATABUS; | ||||
using BPASmartClient.MessageName.EnumHelp; | |||||
using BPASmartClient.SCADAControl; | using BPASmartClient.SCADAControl; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using StackExchange.Redis; | using StackExchange.Redis; | ||||
@@ -1,12 +1,5 @@ | |||||
using BPASmartClient.Compiler; | using BPASmartClient.Compiler; | ||||
using BPASmartClient.DATABUS; | using BPASmartClient.DATABUS; | ||||
using BPASmartClient.MessageCommunication; | |||||
using BPASmartClient.MessageCommunication.MsgControl; | |||||
using BPASmartClient.MessageName; | |||||
using BPASmartClient.MessageName.EnumHelp; | |||||
using BPASmartClient.MessageName.发送消息Model; | |||||
using BPASmartClient.MessageName.接收消息Model; | |||||
using BPASmartClient.MessageName.接收消息Model.物料仓; | |||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using System; | using System; | ||||
using System.Collections; | using System.Collections; | ||||
@@ -0,0 +1,49 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.SCADAControl.EnumClass | |||||
{ | |||||
/// <summary> | |||||
/// 数据来源类型 | |||||
/// </summary> | |||||
public enum DataTypeEnum | |||||
{ | |||||
/// <summary> | |||||
/// POST接口,GET接口 | |||||
/// </summary> | |||||
API接口, | |||||
/// <summary> | |||||
/// 接收主题MQTT数据 | |||||
/// </summary> | |||||
MQTT, | |||||
/// <summary> | |||||
/// Redis拉取数据 | |||||
/// </summary> | |||||
Redis, | |||||
/// <summary> | |||||
/// 本地数据推送 | |||||
/// </summary> | |||||
本地源, | |||||
/// <summary> | |||||
/// 特定服务推送数据 | |||||
/// </summary> | |||||
服务推送, | |||||
/// <summary> | |||||
/// 静态数据 | |||||
/// </summary> | |||||
静态数据 | |||||
} | |||||
/// <summary> | |||||
/// 运行状态-枚举 | |||||
/// </summary> | |||||
public enum InterfaceModeEnum | |||||
{ | |||||
POST, | |||||
GET, | |||||
PUT | |||||
} | |||||
} |
@@ -42,6 +42,7 @@ | |||||
<Compile Remove="TheTextBox.cs" /> | <Compile Remove="TheTextBox.cs" /> | ||||
<Compile Remove="TheTimer.cs" /> | <Compile Remove="TheTimer.cs" /> | ||||
<Compile Remove="TheToggleButton.xaml.cs" /> | <Compile Remove="TheToggleButton.xaml.cs" /> | ||||
<Compile Remove="ViewModel\MainViewModel.cs" /> | |||||
<Compile Remove="WaveProgressBar.cs" /> | <Compile Remove="WaveProgressBar.cs" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -0,0 +1,513 @@ | |||||
<UserControl x:Class="BeDesignerSCADA.Controls.CanvasPanelNew" | |||||
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:BeDesignerSCADA.Controls" | |||||
xmlns:s="clr-namespace:BeDesignerSCADA.Converters" | |||||
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks" | |||||
xmlns:avae="http://icsharpcode.net/sharpdevelop/avalonedit" | |||||
xmlns:Compiler="clr-namespace:BPASmartClient.Compiler;assembly=BPASmartClient.Compiler" | |||||
xmlns:ctl="clr-namespace:BeDesignerSCADA.Controls" | |||||
xmlns:mypro="http://schemas.xceed.com/wpf/xaml/toolkit" | |||||
mc:Ignorable="d" | |||||
d:DesignHeight="900" d:DesignWidth="1400"> | |||||
<UserControl.Resources> | |||||
<ResourceDictionary> | |||||
<ResourceDictionary.MergedDictionaries> | |||||
<ResourceDictionary Source="/BeDesignerSCADA;component/Themes/Styles.xaml" /> | |||||
<ResourceDictionary Source="/BPASmartClient.SCADAControl;component/Themes/Generic.xaml" /> | |||||
</ResourceDictionary.MergedDictionaries> | |||||
<Style x:Key="TheTabItem1" TargetType="{x:Type TabItem}"> | |||||
<Setter Property="FocusVisualStyle" Value="{StaticResource TabItemFocusVisual}" /> | |||||
<Setter Property="Padding" Value="6,1,6,1" /> | |||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> | |||||
<Setter Property="VerticalContentAlignment" Value="Stretch" /> | |||||
<Setter Property="Cursor" Value="Hand" /> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="{x:Type TabItem}"> | |||||
<Border | |||||
x:Name="Bd" | |||||
Margin="5" | |||||
Padding="{TemplateBinding Padding}" | |||||
Background="{TemplateBinding Background}" | |||||
BorderBrush="{TemplateBinding BorderBrush}" | |||||
BorderThickness="{TemplateBinding BorderThickness}" | |||||
CornerRadius="0"> | |||||
<ContentPresenter x:Name="Content" HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" | |||||
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" | |||||
ContentSource="Header" | |||||
Cursor="Hand" | |||||
Margin="0,10,0,10" | |||||
RecognizesAccessKey="True" | |||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" > | |||||
<ContentPresenter.LayoutTransform> | |||||
<RotateTransform Angle="90" /> | |||||
</ContentPresenter.LayoutTransform> | |||||
</ContentPresenter> | |||||
</Border> | |||||
<ControlTemplate.Triggers> | |||||
<Trigger Property="IsSelected" Value="true"> | |||||
<Setter Property="Foreground" Value="#FFC1A800" /> | |||||
<Setter Property="FontSize" Value="14" /> | |||||
<Setter TargetName="Bd" Property="Background" Value="#FF1E535D"/> | |||||
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF707070"/> | |||||
<Setter TargetName="Bd" Property="BorderThickness" Value="1"/> | |||||
</Trigger> | |||||
<Trigger Property="IsSelected" Value="False"> | |||||
<Setter Property="Foreground" Value="Black" /> | |||||
<Setter Property="FontSize" Value="14" /> | |||||
<Setter TargetName="Bd" Property="Background" Value="#FFDDDDDD"/> | |||||
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF707070"/> | |||||
<Setter TargetName="Bd" Property="BorderThickness" Value="1"/> | |||||
</Trigger> | |||||
<!--<Trigger Property="IsMouseOver" Value="True"> | |||||
<Setter Property="Foreground" Value="Black" /> | |||||
<Setter Property="FontSize" Value="14" /> | |||||
<Setter TargetName="Bd" Property="Background" Value="#FFDDDDDD"/> | |||||
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF707070"/> | |||||
<Setter TargetName="Bd" Property="BorderThickness" Value="1"/> | |||||
</Trigger>--> | |||||
</ControlTemplate.Triggers> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Style> | |||||
</ResourceDictionary> | |||||
</UserControl.Resources> | |||||
<Grid x:Name="grid"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="260"/> | |||||
<ColumnDefinition/> | |||||
<ColumnDefinition Width="320"/> | |||||
</Grid.ColumnDefinitions> | |||||
<!--左侧选择区域--> | |||||
<Grid> | |||||
<TabControl TabStripPlacement="Left" Background="Transparent" BorderBrush="{StaticResource AccentBrush}" BorderThickness="1" Margin="4" Padding="5"> | |||||
<TabItem Header="导航布局" Style="{DynamicResource TheTabItem1}"></TabItem> | |||||
<TabItem Header="页面" Style="{DynamicResource TheTabItem1}"> | |||||
</TabItem> | |||||
<TabItem Header="组件树" Style="{DynamicResource TheTabItem1}"> | |||||
<ListBox x:Name="CtlList" Background="Transparent" ItemTemplate="{DynamicResource ToolBoxStyle}" FontSize="14" BorderThickness="0" PreviewMouseMove="CtlList_PreviewMouseMove"/> | |||||
</TabItem> | |||||
</TabControl> | |||||
<!--<Border BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Background="Transparent" Margin="4"> | |||||
</Border>--> | |||||
</Grid> | |||||
<!--中间控制区域--> | |||||
<DockPanel Grid.Column="1"> | |||||
<!--按钮控制--> | |||||
<DockPanel LastChildFill="False" DockPanel.Dock="Top" Height="24" Margin="4 4 4 0"> | |||||
<Button Margin="0" Width="24" Padding="0" Click="AglinLeftBtn_Click" ToolTip="左对齐"> | |||||
<icon:PackIconModern Kind="AlignLeft"/> | |||||
</Button> | |||||
<Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinRightBtn_Click" ToolTip="右对齐"> | |||||
<icon:PackIconModern Kind="AlignRight"/> | |||||
</Button> | |||||
<Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinCenterBtn_Click" ToolTip="中心对齐"> | |||||
<icon:PackIconModern Kind="AlignCenter"/> | |||||
</Button> | |||||
<Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinTopBtn_Click" ToolTip="上对齐"> | |||||
<icon:PackIconModern Kind="BorderTop"/> | |||||
</Button> | |||||
<Button Margin="4 0 0 0" Width="24" Padding="0" Click="AglinBottomBtn_Click" ToolTip="下对齐"> | |||||
<icon:PackIconModern Kind="BorderBottom"/> | |||||
</Button> | |||||
<Button Margin="16 0 0 0" Width="24" Padding="0" Click="HorizontalLayoutBtn_Click" ToolTip="水平分布"> | |||||
<icon:PackIconModern Kind="BorderHorizontal"/> | |||||
</Button> | |||||
<Button Margin="4 0 0 0" Width="24" Padding="0" Click="VerticalLayoutBtn_Click" ToolTip="垂直分布"> | |||||
<icon:PackIconModern Kind="BorderVertical"/> | |||||
</Button> | |||||
<ToggleButton IsChecked="{Binding UseAutoAlignment, ElementName=cav, Mode=TwoWay}" ToolTip="使用对齐网格" Margin="4 0 0 0" Width="24" Padding="0"> | |||||
<icon:PackIconModern Kind="CellAlign"/> | |||||
</ToggleButton> | |||||
<Button Margin="16 0 0 0" Width="24" Padding="0" ToolTip="复制" Command="{Binding ElementName=cav, Path=CopySelectItemsCommand}"> | |||||
<icon:PackIconModern Kind="PageCopy"/> | |||||
</Button> | |||||
<Button Margin="4 0 0 0" Width="24" Padding="0" ToolTip="粘贴" Command="{Binding ElementName=cav, Path=PasteSelectItemsCommand}"> | |||||
<icon:PackIconModern Kind="ClipboardPaste"/> | |||||
</Button> | |||||
<Button Margin="4 0 0 0" Width="24" Padding="0" ToolTip="删除" Command="{Binding ElementName=cav, Path=DeleteSelectItemsCommand}"> | |||||
<icon:PackIconModern Kind="Delete"/> | |||||
</Button> | |||||
<Button x:Name="RunBtn" Margin="16 0 0 0" Padding="0" Click="RunBtn_Click" Command="{Binding RunUiCommand}"> | |||||
<Button.Style> | |||||
<Style TargetType="Button"> | |||||
<Setter Property="Tag" Value="运行"/> | |||||
<Setter Property="Content"> | |||||
<Setter.Value> | |||||
<StackPanel Orientation="Horizontal" Margin="8 0"> | |||||
<icon:PackIconModern Kind="ControlPlay" VerticalAlignment="Center" Foreground="#28B60F" Width="8"/> | |||||
<TextBlock Text="运行" Margin="4 0" VerticalAlignment="Center"/> | |||||
</StackPanel> | |||||
</Setter.Value> | |||||
</Setter> | |||||
<Style.Triggers> | |||||
<DataTrigger Binding="{Binding IsRunning}" Value="True"> | |||||
<Setter Property="Tag" Value="停止"/> | |||||
<Setter Property="Content"> | |||||
<Setter.Value> | |||||
<StackPanel Orientation="Horizontal" Margin="8 0"> | |||||
<icon:PackIconModern Kind="ControlStop" VerticalAlignment="Center" Foreground="#B60F0F" Width="8"/> | |||||
<TextBlock Text="停止" Margin="4 0" VerticalAlignment="Center"/> | |||||
</StackPanel> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</DataTrigger> | |||||
</Style.Triggers> | |||||
</Style> | |||||
</Button.Style> | |||||
</Button> | |||||
<Button x:Name="Run1Btn" Margin="16 0 0 0" Padding="0" Click="MNRunBtn_Click"> | |||||
<StackPanel Orientation="Horizontal" Margin="8 0"> | |||||
<icon:PackIconModern Kind="ControlPlay" VerticalAlignment="Center" Foreground="#28B60F" Width="8"/> | |||||
<TextBlock Text="模拟运行" Margin="4 0" VerticalAlignment="Center"/> | |||||
</StackPanel> | |||||
</Button> | |||||
<Button x:Name="SaveBtn" Margin="16 0 0 0" Padding="0" Click="SaveBtn_Click"> | |||||
<StackPanel Orientation="Horizontal" Margin="8 0"> | |||||
<icon:PackIconModern Kind="Save" VerticalAlignment="Center" Width="12"/> | |||||
<TextBlock Text="保存" Margin="4 0" VerticalAlignment="Center"/> | |||||
</StackPanel> | |||||
</Button> | |||||
<Button x:Name="LoadBtn" Margin="4 0 0 0" Padding="0" Click="LoadBtn_Click"> | |||||
<StackPanel Orientation="Horizontal" Margin="8 0"> | |||||
<icon:PackIconModern Kind="DiskDownload" VerticalAlignment="Center" Width="14"/> | |||||
<TextBlock Text="加载" Margin="4 0" VerticalAlignment="Center"/> | |||||
</StackPanel> | |||||
</Button> | |||||
<Button x:Name="LoadBtnValue" Margin="4 0 0 0" Padding="0" Click="LoadBtnValue_Click"> | |||||
<StackPanel Orientation="Horizontal" Margin="8 0"> | |||||
<icon:PackIconModern Kind="DiskDownload" VerticalAlignment="Center" Width="14"/> | |||||
<TextBlock Text="变量管理" Margin="4 0" VerticalAlignment="Center"/> | |||||
</StackPanel> | |||||
</Button> | |||||
<ToggleButton x:Name="showCode" Click="showCode_Click" DockPanel.Dock="Right" Margin="4 0 0 0" Padding="4 0"> | |||||
<icon:Material Kind="FileCode"/> | |||||
</ToggleButton> | |||||
<!--<Slider DockPanel.Dock="Right" x:Name="slikl" Width="100" Maximum="16" Minimum="1" Margin="4 0 0 0" | |||||
HorizontalContentAlignment="Center" Value="{Binding ElementName=cav,Path=GridPxiel}" />--> | |||||
<!--<TextBlock DockPanel.Dock="Right" Text="对齐:" VerticalAlignment="Center" Margin="16 0 0 0"/>--> | |||||
<CheckBox x:Name="IsYSSX" Content="原生属性" DockPanel.Dock="Right" VerticalAlignment="Center" Margin="0 0 0 0"></CheckBox> | |||||
</DockPanel> | |||||
<!--中间画布--> | |||||
<Border BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Margin="4"> | |||||
<Border.Background> | |||||
<ImageBrush ImageSource="../Images/bj.png" Stretch="UniformToFill"/> | |||||
</Border.Background> | |||||
<Grid> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition/> | |||||
<ColumnDefinition Width="auto"/> | |||||
</Grid.ColumnDefinitions> | |||||
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible"> | |||||
<Grid> | |||||
<Compiler:CanvasPanel x:Name="cav" Width="1920" Height="1080" Visibility="{Binding CanvasPanelVisibility}" SelectedItem="{Binding CanSelectedItem,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AllowDrop="True" RenderTransformOrigin="0.5,0.5" ClipToBounds="True" UseLayoutRounding="True" Focusable="True" SnapsToDevicePixels="True"> | |||||
<Compiler:CanvasPanel.Background> | |||||
<VisualBrush TileMode="Tile" Viewport="0,0,20,20" ViewportUnits="Absolute"> | |||||
<VisualBrush.Visual> | |||||
<Rectangle Width="20" Height="20" StrokeDashArray="4,2" StrokeThickness="0.5" Stroke="#CBCBCB"> | |||||
<Rectangle.Style> | |||||
<Style TargetType="{x:Type Rectangle}"> | |||||
<Style.Triggers> | |||||
<DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type Compiler:CanvasPanel}, Mode=FindAncestor}}" Value="True"> | |||||
<Setter Property="Visibility" Value="Visible"/> | |||||
</DataTrigger> | |||||
<DataTrigger Binding="{Binding UseAutoAlignment, RelativeSource={RelativeSource AncestorType={x:Type Compiler:CanvasPanel}, Mode=FindAncestor}}" Value="False"> | |||||
<Setter Property="Visibility" Value="Collapsed"/> | |||||
</DataTrigger> | |||||
</Style.Triggers> | |||||
</Style> | |||||
</Rectangle.Style> | |||||
</Rectangle> | |||||
</VisualBrush.Visual> | |||||
</VisualBrush> | |||||
</Compiler:CanvasPanel.Background> | |||||
<Compiler:CanvasPanel.RenderTransform> | |||||
<TransformGroup> | |||||
<TranslateTransform x:Name="CanvasTranslate"/> | |||||
</TransformGroup> | |||||
</Compiler:CanvasPanel.RenderTransform> | |||||
</Compiler:CanvasPanel> | |||||
<ctl:RunCanvas x:Name="runCanvas" Visibility="{Binding RunCanvasVisibility}" /> | |||||
</Grid> | |||||
</ScrollViewer> | |||||
<avae:TextEditor x:Name="codeEditor" ShowLineNumbers="True" Padding="4" WordWrap="True" IsReadOnly="True" SyntaxHighlighting="XML" BorderThickness="1 0 0 0" BorderBrush="{StaticResource ControlBorderBrush}" Grid.Column="1" Width="480" Visibility="{Binding ElementName=showCode, Path=IsChecked, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"/> | |||||
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,20,20" FontSize="16" Foreground="Red">分辨率:1920×1080</TextBlock> | |||||
</Grid> | |||||
</Border> | |||||
</DockPanel> | |||||
<GridSplitter HorizontalAlignment="Right" Grid.Column="1" VerticalAlignment="Stretch" Width="5" Background="Transparent"/> | |||||
<!--右侧属性栏--> | |||||
<Grid Grid.Column="2"> | |||||
<TabControl SelectedIndex="0"> | |||||
<TabItem Header="属性设置"> | |||||
<mypro:PropertyGrid Margin="10" ShowAdvancedOptions="True" ShowDescriptionByTooltip="True" | |||||
FontSize="14" ShowTitle="False" ShowSortOptions="False" ShowSearchBox="False" | |||||
AutoGenerateProperties="False" | |||||
CategoryGroupHeaderTemplate="{DynamicResource Category}" SelectedObject="{Binding SelectedItem,ElementName=cav,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" > | |||||
<mypro:PropertyGrid.PropertyDefinitions> | |||||
<mypro:PropertyDefinition Name="FontSize" ></mypro:PropertyDefinition> | |||||
<mypro:PropertyDefinition DisplayName="名称" Category="基本属性" DisplayOrder="0" Name="Name" Description="设置控件的标识,可以在Js脚本中通过标识操作控件。"/> | |||||
<mypro:PropertyDefinition DisplayName="内容" Category="基本属性" DisplayOrder="1" Name="Content"/> | |||||
<mypro:PropertyDefinition DisplayName="标题" Category="基本属性" DisplayOrder="1" Name="Header" Description="Header"/> | |||||
<mypro:PropertyDefinition DisplayName="文本" Category="基本属性" DisplayOrder="1" Name="Text" Description="Text"/> | |||||
<mypro:PropertyDefinition DisplayName="值" Category="基本属性" DisplayOrder="2" Name="NumberValue" Description="NumberValue"/> | |||||
<mypro:PropertyDefinition DisplayName="数值" Category="基本属性" DisplayOrder="2" Name="CurValue" Description="CurValue"/> | |||||
<mypro:PropertyDefinition DisplayName="状态值" Category="基本属性" DisplayOrder="2" Name="StatusValue" Description="StatusValue"/> | |||||
<mypro:PropertyDefinition DisplayName="勾选状态" Category="基本属性" DisplayOrder="2" Name="IsChecked" Description="IsChecked"/> | |||||
<mypro:PropertyDefinition DisplayName="数值" Category="基本属性" DisplayOrder="2" Name="Value" Description="Value"/> | |||||
<mypro:PropertyDefinition DisplayName="物料重量(g)" Category="基本属性" DisplayOrder="2" Name="KgValue" 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="Title" Description="标题"/> | |||||
<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="2" Name="StartPath" Description="StartPath"/> | |||||
<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="Maximum" Description="Maximum"/> | |||||
<mypro:PropertyDefinition DisplayName="最小值" Category="基本属性" DisplayOrder="3" Name="Minimum" Description="Minimum"/> | |||||
<mypro:PropertyDefinition DisplayName="间隔" Category="基本属性" DisplayOrder="3" Name="Interval"/> | |||||
<mypro:PropertyDefinition DisplayName="宽度" Category="基本属性" DisplayOrder="3" Name="Width"/> | |||||
<mypro:PropertyDefinition DisplayName="高度" Category="基本属性" DisplayOrder="3" Name="Height"/> | |||||
<mypro:PropertyDefinition DisplayName="勾选状态" Category="基本属性" DisplayOrder="3" Name="BindingIsChecked"/> | |||||
<mypro:PropertyDefinition DisplayName="图片路径" Category="基本属性" DisplayOrder="3" Name="ImageStartPath" /> | |||||
<mypro:PropertyDefinition DisplayName="FontSize" Category="基本属性" DisplayOrder="4" Name="FontSize"/> | |||||
<mypro:PropertyDefinition DisplayName="字体" Category="基本属性" DisplayOrder="4" Name="FontFamily"/> | |||||
<mypro:PropertyDefinition DisplayName="字体样式" Category="基本属性" DisplayOrder="4" Name="FontWeight"/> | |||||
<mypro:PropertyDefinition DisplayName="斜体" Category="基本属性" DisplayOrder="4" Name="FontStyle"/> | |||||
<mypro:PropertyDefinition DisplayName="下划线" Category="基本属性" DisplayOrder="4" Name="TextDecorations"/> | |||||
<mypro:PropertyDefinition DisplayName="文字环绕样式" Category="基本属性" DisplayOrder="4" Name="TextWrapping"/> | |||||
<mypro:PropertyDefinition DisplayName="是否使能" Category="基本属性" DisplayOrder="5" Name="IsEnabled"/> | |||||
<mypro:PropertyDefinition DisplayName="是否显示" Category="基本属性" DisplayOrder="5" Name="Visibility"/> | |||||
<mypro:PropertyDefinition DisplayName="回车换行" Category="基本属性" DisplayOrder="5" Name="AcceptsReturn"/> | |||||
<mypro:PropertyDefinition DisplayName="鼠标样式" Category="基本属性" DisplayOrder="5" Name="Cursor"/> | |||||
<mypro:PropertyDefinition DisplayName="键盘触发顺序" Category="基本属性" DisplayOrder="5" Name="TabIndex"/> | |||||
<mypro:PropertyDefinition DisplayName="控件透明度" Category="基本属性" DisplayOrder="5" Name="Opacity"/> | |||||
<mypro:PropertyDefinition DisplayName="垂直滚动条" Category="基本属性" DisplayOrder="6" Name="VerticalScrollBarVisibility"/> | |||||
<mypro:PropertyDefinition DisplayName="水平滚动条" Category="基本属性" DisplayOrder="6" Name="HorizontalScrollBarVisibility"/> | |||||
<mypro:PropertyDefinition DisplayName="是否ESC触发" Category="基本属性" DisplayOrder="7" Name="IsCancel"/> | |||||
<mypro:PropertyDefinition DisplayName="是否Enter触发" Category="基本属性" DisplayOrder="7" Name="IsDefault"/> | |||||
<mypro:PropertyDefinition DisplayName="垂直对齐" Category="基本属性" DisplayOrder="8" Name="VerticalContentAlignment"/> | |||||
<mypro:PropertyDefinition DisplayName="水平对齐" Category="基本属性" DisplayOrder="8" Name="HorizontalContentAlignment"/> | |||||
<mypro:PropertyDefinition DisplayName="所属分组" Category="基本属性" DisplayOrder="9" Name="GroupName"/> | |||||
<mypro:PropertyDefinition DisplayName="文本提示" Category="基本属性" DisplayOrder="9" Name="ToolTip"/> | |||||
<mypro:PropertyDefinition DisplayName="左边距" Category="基本属性" DisplayOrder="9" Name="(Canvas.Left)"/> | |||||
<mypro:PropertyDefinition DisplayName="上边距" Category="基本属性" DisplayOrder="9" Name="(Canvas.Top)"/> | |||||
<mypro:PropertyDefinition DisplayName="启动测试" Category="基本属性" DisplayOrder="9" Name="TestData"/> | |||||
<mypro:PropertyDefinition DisplayName="气缸左执行" Category="基本属性" DisplayOrder="10" Name="LeftTogIsChecked"/> | |||||
<mypro:PropertyDefinition DisplayName="气缸右执行" Category="基本属性" DisplayOrder="10" Name="RightTogIsChecked"/> | |||||
<mypro:PropertyDefinition DisplayName="背景透明" Category="基本属性" DisplayOrder="10" Name="IsCheckedColor"/> | |||||
<mypro:PropertyDefinition DisplayName="边框宽度" Category="基本属性" DisplayOrder="10" Name="BKThickness"/> | |||||
<mypro:PropertyDefinition DisplayName="虚线绘制" Category="基本属性" DisplayOrder="10" Name="BKStrokeDashArray"/> | |||||
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="11" Name="WaveThickness"/> | |||||
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="11" Name="StrokeThickness"/> | |||||
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="11" Name="BorderThickness"/> | |||||
<mypro:PropertyDefinition DisplayName="布局方向" Category="基本属性" DisplayOrder="11" Name="Orientation"/> | |||||
<mypro:PropertyDefinition DisplayName="数据来源类型" Category="数据绑定模块" DisplayOrder="0" Name="DataSouceType"/> | |||||
<mypro:PropertyDefinition DisplayName="设备名称" Category="数据绑定模块" DisplayOrder="0" Name="DeviceName"/> | |||||
<mypro:PropertyDefinition DisplayName="接口类型" Category="数据绑定模块" DisplayOrder="1" Name="InterfaceMode"/> | |||||
<mypro:PropertyDefinition DisplayName="接口参数" Category="数据绑定模块" DisplayOrder="2" Name="InterfaceParameters"/> | |||||
<mypro:PropertyDefinition DisplayName="连接信息" Category="数据绑定模块" DisplayOrder="3" Name="DataSouceInformation"/> | |||||
<mypro:PropertyDefinition DisplayName="设备解析变量" Category="数据绑定模块" DisplayOrder="4" Name="DeviceValuleName"/> | |||||
<mypro:PropertyDefinition DisplayName="模拟运行" Category="数据绑定模块" DisplayOrder="4" Name="IsRun"/> | |||||
<mypro:PropertyDefinition DisplayName="数据源" Category="数据绑定模块" DisplayOrder="5" Name="FDataSouce"/> | |||||
<mypro:PropertyDefinition DisplayName="代码过滤脚本" Category="数据绑定模块" DisplayOrder="6" Name="Code"/> | |||||
<mypro:PropertyDefinition DisplayName="数据结果" Category="数据绑定模块" DisplayOrder="7" Name="GenerateData"/> | |||||
<mypro:PropertyDefinition DisplayName="定时间隔" Category="数据绑定模块" DisplayOrder="8" Name="TimeCount"/> | |||||
<mypro:PropertyDefinition DisplayName="列表项" Category="集合设置" Name="ItemsString" /> | |||||
<mypro:PropertyDefinition DisplayName="列表项" Category="集合设置" Name="TabItems" /> | |||||
<mypro:PropertyDefinition DisplayName="子控件模板" Category="集合设置" Name="ChildTemplateXml" /> | |||||
<mypro:PropertyDefinition DisplayName="前景色" Category="颜色设置" Name="Foreground"/> | |||||
<mypro:PropertyDefinition DisplayName="背景色" Category="颜色设置" Name="Background"/> | |||||
<mypro:PropertyDefinition DisplayName="填充颜色" Category="颜色设置" Name="BJColor"/> | |||||
<mypro:PropertyDefinition DisplayName="选中色" Category="颜色设置" Name="DKColor"/> | |||||
<mypro:PropertyDefinition DisplayName="边框色" Category="颜色设置" Name="BorderBrush"/> | |||||
<mypro:PropertyDefinition DisplayName="填充" Category="颜色设置" DisplayOrder="5" Name="WaveFill"/> | |||||
<mypro:PropertyDefinition DisplayName="边框" Category="颜色设置" DisplayOrder="5" Name="WaveStroke"/> | |||||
<mypro:PropertyDefinition DisplayName="填充" Category="颜色设置" DisplayOrder="5" Name="Fill"/> | |||||
<mypro:PropertyDefinition DisplayName="边框" Category="颜色设置" DisplayOrder="5" Name="Stroke"/> | |||||
<mypro:PropertyDefinition DisplayName="点击事件" Category="事件绑定" DisplayOrder="0" Name="ClickExec" /> | |||||
<mypro:PropertyDefinition DisplayName="值改变事件" Category="事件绑定" DisplayOrder="1" Name="ValueChangedExecute" /> | |||||
<mypro:PropertyDefinition DisplayName="定时触发" Category="事件绑定" DisplayOrder="2" Name="TikcExecute" /> | |||||
<mypro:PropertyDefinition DisplayName="勾选事件" Category="事件绑定" DisplayOrder="3" Name="CheckedExec" /> | |||||
<mypro:PropertyDefinition DisplayName="取消勾选事件" Category="事件绑定" DisplayOrder="4" Name="UnCheckedExec" /> | |||||
<mypro:PropertyDefinition DisplayName="接收消息集" Category="事件绑定" DisplayOrder="5" Name="EventReceiveNameList" /> | |||||
<mypro:PropertyDefinition DisplayName="出料单击事件" Category="事件绑定" DisplayOrder="6" Name="ChuLiaoExecute" /> | |||||
<mypro:PropertyDefinition DisplayName="停止出料单击事件" Category="事件绑定" DisplayOrder="7" Name="StopChuLiaoExecute" /> | |||||
</mypro:PropertyGrid.PropertyDefinitions> | |||||
<mypro:PropertyGrid.EditorDefinitions> | |||||
<mypro:EditorTemplateDefinition TargetProperties="Opacity"> | |||||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||||
<DataTemplate> | |||||
<Slider Maximum="1" Minimum="0" Value="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ></Slider> | |||||
<!--<mypro: SelectedColor="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={x:Static s:ColorToStringConverter.Instance}}" />--> | |||||
</DataTemplate> | |||||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||||
</mypro:EditorTemplateDefinition> | |||||
<mypro:EditorTemplateDefinition TargetProperties="Foreground,Background,BorderBrush,WaveFill,WaveStroke,Fill,Stroke,BJColor,DKColor"> | |||||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||||
<DataTemplate> | |||||
<mypro:ColorPicker SelectedColor="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={x:Static s:ColorToStringConverter.Instance}}" /> | |||||
</DataTemplate> | |||||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||||
</mypro:EditorTemplateDefinition> | |||||
<mypro:EditorTemplateDefinition TargetProperties="ImageStartPath"> | |||||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||||
<DataTemplate> | |||||
<Grid> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="*"/> | |||||
<ColumnDefinition Width="35"/> | |||||
</Grid.ColumnDefinitions> | |||||
<ToggleButton Grid.Column="1" Height="20" Content="..." Width="26" Margin="5,0,0,0" HorizontalAlignment="Left" Click="LJToggleButton_Click"></ToggleButton> | |||||
<TextBox Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center"/> | |||||
</Grid> | |||||
</DataTemplate> | |||||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||||
</mypro:EditorTemplateDefinition> | |||||
<mypro:EditorTemplateDefinition TargetProperties="StartPath"> | |||||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||||
<DataTemplate> | |||||
<Grid> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="*"/> | |||||
<ColumnDefinition Width="35"/> | |||||
</Grid.ColumnDefinitions> | |||||
<ToggleButton Grid.Column="1" Height="20" Content="选择" Width="26" Margin="5,0,0,0" HorizontalAlignment="Left" Click="XZToggleButton_Click"></ToggleButton> | |||||
<TextBox Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center"/> | |||||
</Grid> | |||||
</DataTemplate> | |||||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||||
</mypro:EditorTemplateDefinition> | |||||
<!--子控件模板编辑--> | |||||
<mypro:EditorTemplateDefinition TargetProperties="ChildTemplateXml"> | |||||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||||
<DataTemplate> | |||||
<Grid> | |||||
<ToggleButton Grid.Column="1" Height="30" Content=" 设置控件模板 " Margin="5,0,0,0" Click="ChildToggleButton_Click"></ToggleButton> | |||||
<TextBox Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Visibility="Collapsed"/> | |||||
</Grid> | |||||
</DataTemplate> | |||||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||||
</mypro:EditorTemplateDefinition> | |||||
<!--代码绑定模块--> | |||||
<mypro:EditorTemplateDefinition TargetProperties="ClickExec,ValueChangedExecute,TikcExecute,CheckedExec,UnCheckedExec,ChuLiaoExecute,StopChuLiaoExecute" > | |||||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||||
<DataTemplate> | |||||
<Grid> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="*"/> | |||||
<ColumnDefinition Width="40"/> | |||||
</Grid.ColumnDefinitions> | |||||
<ToggleButton Grid.Column="1" Height="20" Content="编辑" Width="30" Margin="5,0,5,0" HorizontalAlignment="Left" Click="ToggleButton_Click"></ToggleButton> | |||||
<TextBox Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center"/> | |||||
</Grid> | |||||
</DataTemplate> | |||||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||||
</mypro:EditorTemplateDefinition> | |||||
<mypro:EditorTemplateDefinition TargetProperties="Code" > | |||||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||||
<DataTemplate> | |||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> | |||||
<TextBox Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AcceptsReturn="True" TextWrapping="Wrap"></TextBox> | |||||
</ScrollViewer> | |||||
</DataTemplate> | |||||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||||
</mypro:EditorTemplateDefinition> | |||||
<mypro:EditorTemplateDefinition TargetProperties="IsRun,IsChecked" > | |||||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||||
<DataTemplate> | |||||
<StackPanel Grid.Column="1" Orientation="Horizontal"> | |||||
<CheckBox Margin="10,0,0,0" VerticalAlignment="Center" IsChecked="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></CheckBox> | |||||
<ToggleButton Grid.Column="1" Height="20" Content="绑定" Width="30" Margin="20,0,0,0" HorizontalAlignment="Left" Click="BingToggleButton_Click"></ToggleButton> | |||||
<ToggleButton Height="20" Content="解绑" Width="30" Margin="5,0,0,0" HorizontalAlignment="Right" Click="ClearBingToggleButton_Click"></ToggleButton> | |||||
</StackPanel> | |||||
</DataTemplate> | |||||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||||
</mypro:EditorTemplateDefinition> | |||||
<mypro:EditorTemplateDefinition TargetProperties="DeviceName" > | |||||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||||
<DataTemplate> | |||||
<ComboBox Grid.Column="1" Height="25" Width="{Binding Width, ElementName=com}" Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" | |||||
ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Path=DataContext.DevNameList}" | |||||
></ComboBox> | |||||
</DataTemplate> | |||||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||||
</mypro:EditorTemplateDefinition> | |||||
<mypro:EditorTemplateDefinition TargetProperties="Text,Title,Value,BindingIsChecked,Header,KgValue,WLText,WLTitle,DataSouceInformation,Direction,LeftTogIsChecked,RightTogIsChecked" > | |||||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||||
<DataTemplate> | |||||
<!--此处可自由发挥--> | |||||
<Grid > | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="*"/> | |||||
<ColumnDefinition Width="40"/> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBox Grid.Row="2" x:Name="wenben" Padding="5" Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap"></TextBox> | |||||
<StackPanel Grid.Column="1"> | |||||
<ToggleButton Grid.Column="1" Height="20" Content="绑定" Width="30" Margin="5,0,5,0" HorizontalAlignment="Left" Click="BingToggleButton_Click"></ToggleButton> | |||||
<ToggleButton Height="20" Content="解绑" Width="30" Margin="5,2,5,0" HorizontalAlignment="Right" Click="ClearBingToggleButton_Click"></ToggleButton> | |||||
</StackPanel> | |||||
</Grid> | |||||
</DataTemplate> | |||||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||||
</mypro:EditorTemplateDefinition> | |||||
</mypro:PropertyGrid.EditorDefinitions> | |||||
</mypro:PropertyGrid> | |||||
</TabItem> | |||||
<TabItem Header="原生属性" Visibility="{Binding ElementName=IsYSSX, Path=IsChecked, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"> | |||||
<mypro:PropertyGrid Margin="10" ShowAdvancedOptions="True" ShowDescriptionByTooltip="True" | |||||
FontSize="14" ShowTitle="False" ShowSortOptions="False" ShowSearchBox="False" | |||||
CategoryGroupHeaderTemplate="{DynamicResource Category}" SelectedObject="{Binding SelectedItem,ElementName=cav,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> | |||||
</TabItem> | |||||
</TabControl> | |||||
</Grid> | |||||
</Grid> | |||||
</UserControl> |
@@ -0,0 +1,513 @@ | |||||
using BeDesignerSCADA.Common; | |||||
using BeDesignerSCADA.View; | |||||
using BeDesignerSCADA.ViewModel; | |||||
using BPASmart.Model; | |||||
using BPASmartClient.Compiler; | |||||
using BPASmartClient.DATABUS; | |||||
using BPASmartClient.MessageName; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.ComponentModel; | |||||
using System.IO; | |||||
using System.Linq; | |||||
using System.Reflection; | |||||
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.Forms; | |||||
using System.Windows.Input; | |||||
using System.Windows.Markup; | |||||
using System.Windows.Media; | |||||
using System.Windows.Media.Animation; | |||||
using System.Windows.Media.Imaging; | |||||
using System.Windows.Navigation; | |||||
using System.Windows.Shapes; | |||||
namespace BeDesignerSCADA.Controls | |||||
{ | |||||
/// <summary> | |||||
/// CanvasPanelNew.xaml 的交互逻辑 | |||||
/// </summary> | |||||
public partial class CanvasPanelNew : System.Windows.Controls.UserControl | |||||
{ | |||||
/// <summary> | |||||
/// 布局文件路径 | |||||
/// </summary> | |||||
public string Path = string.Empty; | |||||
MainViewModelNew viewModel = new MainViewModelNew(); | |||||
public CanvasPanelNew(string _Path) | |||||
{ | |||||
InitializeComponent(); | |||||
EditorHelper.Register<BindingExpression, BindingConvertor>(); | |||||
Path = _Path; | |||||
viewModel.LayoutsPath = Path; | |||||
this.DataContext = viewModel; | |||||
viewModel.Loaded(cav, runCanvas); | |||||
//控件加载 | |||||
Assembly assembly = Assembly.LoadFile($"{System.AppDomain.CurrentDomain.BaseDirectory}\\BPASmartClient.SCADAControl.dll"); //Assembly.GetExecutingAssembly(); | |||||
CtlList.ItemsSource = assembly.GetTypes().Where(t => t.GetInterface("IExecutable") != null).OrderBy(o => o.Name)?.ToList(); | |||||
//读取文件 | |||||
FileRead(_Path); | |||||
} | |||||
#region 位置调整 | |||||
/// <summary> | |||||
/// 左对齐 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void AglinLeftBtn_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
cav.AlignLeft(); | |||||
} | |||||
/// <summary> | |||||
/// 底部对齐 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void AglinBottomBtn_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
cav.AlignBottom(); | |||||
} | |||||
/// <summary> | |||||
/// 顶部对齐 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void AglinTopBtn_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
cav.AlignTop(); | |||||
} | |||||
/// <summary> | |||||
/// 右对齐 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void AglinRightBtn_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
cav.AlignRight(); | |||||
} | |||||
/// <summary> | |||||
/// 居中 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void AglinCenterBtn_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
cav.AlignCenter(); | |||||
} | |||||
/// <summary> | |||||
/// 垂直分布 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void VerticalLayoutBtn_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
cav.VertialLayout(); | |||||
} | |||||
/// <summary> | |||||
/// 水平分布 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void HorizontalLayoutBtn_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
cav.HorizontalLayout(); | |||||
} | |||||
#endregion | |||||
#region 其他事件操作 | |||||
/// <summary> | |||||
/// 传入变量管理器地址 | |||||
/// </summary> | |||||
/// <param name="path"></param> | |||||
private void LoadBtnValue_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
OpenFileDialog ofd = new OpenFileDialog(); | |||||
ofd.Filter = "变量管理器文件|*.json"; | |||||
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) | |||||
{ | |||||
viewModel.VariablePath = ofd.FileName; | |||||
bool isSucess = DataBusModel.GetInstance().RefreshVariableManager(ofd.FileName); | |||||
System.Windows.MessageBox.Show(isSucess ? "加载成功!" : "加载失败!"); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 运行 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void RunBtn_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
if (sender is System.Windows.Controls.Button btn) | |||||
{ | |||||
if (btn.Tag.ToString() == "运行") | |||||
{ | |||||
cav.ClearSelection(); | |||||
runCanvas.Run(cav.Generator()); | |||||
} | |||||
else if (btn.Tag.ToString() == "停止") | |||||
{ | |||||
runCanvas.Destory(); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 模拟运行 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void MNRunBtn_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
cav.ClearSelection(); | |||||
RunWindows runWindows = new RunWindows(); | |||||
runWindows.LoadingData(cav.Generator()); | |||||
runWindows.Show(); | |||||
} | |||||
/// <summary> | |||||
/// 加载 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void LoadBtn_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
OpenFileDialog ofd = new OpenFileDialog(); | |||||
ofd.Filter = "布局文件|*.lay"; | |||||
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) | |||||
{ | |||||
cav.Load(ofd.FileName); | |||||
} | |||||
DoubleAnimation da = new DoubleAnimation(-200, 0, new Duration(TimeSpan.FromMilliseconds(250))); | |||||
da.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }; | |||||
CanvasTranslate.BeginAnimation(TranslateTransform.XProperty, da); | |||||
DoubleAnimation daop = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromMilliseconds(250))); | |||||
daop.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }; | |||||
cav.BeginAnimation(OpacityProperty, daop); | |||||
} | |||||
/// <summary> | |||||
/// 读取文件 | |||||
/// </summary> | |||||
/// <param name="path"></param> | |||||
public void FileRead(string path) | |||||
{ | |||||
try | |||||
{ | |||||
if (File.Exists(path)) | |||||
{ | |||||
cav.Load(path); | |||||
DoubleAnimation da = new DoubleAnimation(-200, 0, new Duration(TimeSpan.FromMilliseconds(250))); | |||||
da.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }; | |||||
CanvasTranslate.BeginAnimation(TranslateTransform.XProperty, da); | |||||
DoubleAnimation daop = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromMilliseconds(250))); | |||||
daop.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }; | |||||
cav.BeginAnimation(OpacityProperty, daop); | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 根据流加载数据 | |||||
/// </summary> | |||||
public void LoadFrameworkElement(UIElementCollection frameworks) | |||||
{ | |||||
try | |||||
{ | |||||
cav.Children.Clear(); | |||||
foreach (FrameworkElement element in frameworks) | |||||
{ | |||||
string xamlText = XamlWriter.Save(element); | |||||
FrameworkElement item = XamlReader.Parse(xamlText) as FrameworkElement; | |||||
cav.Children.Add(item); | |||||
} | |||||
cav.SelectedItems?.Clear(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
throw; | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 获取所有控件 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
public List<FrameworkElement> GetChildren() | |||||
{ | |||||
List<FrameworkElement> frameworks = new List<FrameworkElement>(); | |||||
foreach (FrameworkElement child in cav.Children) | |||||
{ | |||||
string xamlText = XamlWriter.Save(child); | |||||
FrameworkElement item = XamlReader.Parse(xamlText) as FrameworkElement; | |||||
frameworks.Add(item); | |||||
} | |||||
return frameworks; | |||||
} | |||||
/// <summary> | |||||
/// 保存文件 | |||||
/// </summary> | |||||
public void FileSave() | |||||
{ | |||||
SaveBtn_Click(null, null); | |||||
} | |||||
/// <summary> | |||||
/// 传入变量管理器地址 | |||||
/// </summary> | |||||
/// <param name="path"></param> | |||||
public void VariableManagerPath(string path) | |||||
{ | |||||
try | |||||
{ | |||||
viewModel.VariablePath = path; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 运行程序 | |||||
/// </summary> | |||||
public void Run() | |||||
{ | |||||
try | |||||
{ | |||||
cav.ClearSelection(); | |||||
runCanvas.Run(cav.Generator()); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 停止运行程序 | |||||
/// </summary> | |||||
public void Destory() | |||||
{ | |||||
try | |||||
{ | |||||
runCanvas.Destory(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
throw; | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 保存 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void SaveBtn_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
if (File.Exists(Path)) | |||||
{ | |||||
string str = cav.Save(); | |||||
File.WriteAllText(Path, str, Encoding.Unicode); | |||||
} | |||||
else | |||||
{ | |||||
SaveFileDialog sfd = new SaveFileDialog(); | |||||
sfd.Filter = "布局文件|*.lay"; | |||||
if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) | |||||
{ | |||||
string str = cav.Save(); | |||||
File.WriteAllText(sfd.FileName, str, Encoding.Unicode); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 模拟消息发送 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void MNBtn_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
} | |||||
#endregion | |||||
#region 左侧控件栏移动 | |||||
/// <summary> | |||||
/// 移动到右侧 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void CtlList_PreviewMouseMove(object sender, System.Windows.Input.MouseEventArgs e) | |||||
{ | |||||
if (CtlList.SelectedItem != null && e.LeftButton == MouseButtonState.Pressed) | |||||
{ | |||||
DragDrop.DoDragDrop(CtlList, CtlList.SelectedItem, System.Windows.DragDropEffects.Copy); | |||||
codeEditor.Text = cav.Save(); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 显示代码 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void showCode_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
codeEditor.Text = cav.Save(); | |||||
} | |||||
/// <summary> | |||||
/// 编辑 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void ToggleButton_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
try | |||||
{ | |||||
if (sender is ToggleButton) | |||||
{ | |||||
ToggleButton toggle = (ToggleButton)sender; | |||||
Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyGridCommand = toggle.DataContext as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; | |||||
if (propertyGridCommand != null) | |||||
{ | |||||
viewModel.Edit(propertyGridCommand); | |||||
} | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 路径资源选择 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void LJToggleButton_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
try | |||||
{ | |||||
if (sender is ToggleButton) | |||||
{ | |||||
ToggleButton toggle = (ToggleButton)sender; | |||||
Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyGridCommand = toggle.DataContext as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; | |||||
if (propertyGridCommand != null) | |||||
{ | |||||
viewModel.SelectPath(propertyGridCommand); | |||||
} | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 选择进程 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void XZToggleButton_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
try | |||||
{ | |||||
if (sender is ToggleButton) | |||||
{ | |||||
ToggleButton toggle = (ToggleButton)sender; | |||||
Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyGridCommand = toggle.DataContext as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; | |||||
if (propertyGridCommand != null) | |||||
{ | |||||
viewModel.SelectValuePath(propertyGridCommand); | |||||
} | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 设置子控件模板 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void ChildToggleButton_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
try | |||||
{ | |||||
if (sender is ToggleButton) | |||||
{ | |||||
ToggleButton toggle = (ToggleButton)sender; | |||||
Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyGridCommand = toggle.DataContext as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; | |||||
if (propertyGridCommand != null) | |||||
{ | |||||
viewModel.ChildEdit(propertyGridCommand); | |||||
} | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 数据绑定 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void BingToggleButton_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
try | |||||
{ | |||||
if (sender is ToggleButton) | |||||
{ | |||||
ToggleButton toggle = (ToggleButton)sender; | |||||
Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyGridCommand = toggle.DataContext as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; | |||||
if (propertyGridCommand != null) | |||||
{ | |||||
viewModel.BingEdit(propertyGridCommand); | |||||
} | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 清除绑定 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void ClearBingToggleButton_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
try | |||||
{ | |||||
if (sender is ToggleButton) | |||||
{ | |||||
ToggleButton toggle = (ToggleButton)sender; | |||||
Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyGridCommand = toggle.DataContext as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; | |||||
if (propertyGridCommand != null) | |||||
{ | |||||
viewModel.ClearBingEdit(propertyGridCommand); | |||||
} | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | |||||
#endregion | |||||
} | |||||
} |
@@ -1,7 +1,6 @@ | |||||
using BeDesignerSCADA.Common; | using BeDesignerSCADA.Common; | ||||
using BeDesignerSCADA.View; | using BeDesignerSCADA.View; | ||||
using BeDesignerSCADA.ViewModel; | using BeDesignerSCADA.ViewModel; | ||||
using BeDesignerSCADA.ViewModel; | |||||
using BPASmart.Model; | using BPASmart.Model; | ||||
using BPASmartClient.Compiler; | using BPASmartClient.Compiler; | ||||
using BPASmartClient.DATABUS; | using BPASmartClient.DATABUS; | ||||
@@ -34,7 +34,7 @@ namespace BeDesignerSCADA | |||||
/// </summary> | /// </summary> | ||||
public partial class MainWindow : Window | public partial class MainWindow : Window | ||||
{ | { | ||||
MainCanvasPanel mainCanvas = new MainCanvasPanel(""); | |||||
CanvasPanelNew mainCanvas = new CanvasPanelNew(""); | |||||
public MainWindow() | public MainWindow() | ||||
{ | { | ||||
InitializeComponent(); | InitializeComponent(); | ||||
@@ -1,80 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BeDesignerSCADA.ViewModel | |||||
{ | |||||
/// <summary> | |||||
/// 事件Model | |||||
/// </summary> | |||||
public class EventModel | |||||
{ | |||||
/// <summary> | |||||
/// 事件id | |||||
/// </summary> | |||||
public string EventId { get; set; } | |||||
/// <summary> | |||||
/// 事件名称 | |||||
/// </summary> | |||||
public string EventName { get; set; } | |||||
/// <summary> | |||||
/// 事件值 | |||||
/// </summary> | |||||
public string EventValue { get; set; } | |||||
/// <summary> | |||||
/// 特性:分组 | |||||
/// </summary> | |||||
public string Category { get; set; } | |||||
/// <summary> | |||||
/// 特性:描述 | |||||
/// </summary> | |||||
public string Description { get; set; } | |||||
/// <summary> | |||||
/// 特性:是否启用 | |||||
/// </summary> | |||||
public bool Browsable { get; set; } | |||||
public EventModel() | |||||
{ | |||||
EventId=Guid.NewGuid().ToString(); | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 数据Model | |||||
/// </summary> | |||||
public class ALLModel | |||||
{ | |||||
/// <summary> | |||||
/// 数据id | |||||
/// </summary> | |||||
public string DataId { get; set; } | |||||
/// <summary> | |||||
/// 数据名称 | |||||
/// </summary> | |||||
public string DataName { get; set; } | |||||
/// <summary> | |||||
/// 数据值 | |||||
/// </summary> | |||||
public string DataValue { get; set; } | |||||
/// <summary> | |||||
/// 特性:分组 | |||||
/// </summary> | |||||
public string Category { get; set; } | |||||
/// <summary> | |||||
/// 特性:描述 | |||||
/// </summary> | |||||
public string Description { get; set; } | |||||
/// <summary> | |||||
/// 特性:是否启用 | |||||
/// </summary> | |||||
public bool Browsable { get; set; } | |||||
public ALLModel() | |||||
{ | |||||
DataId = Guid.NewGuid().ToString(); | |||||
} | |||||
} | |||||
} |
@@ -136,17 +136,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WPFDemo", "WPFDemo\WPFDemo. | |||||
EndProject | EndProject | ||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0.SCADA", "0.SCADA", "{7B0175AD-BB74-4A98-B9A7-1E289032485E}" | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0.SCADA", "0.SCADA", "{7B0175AD-BB74-4A98-B9A7-1E289032485E}" | ||||
EndProject | EndProject | ||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MessageName", "BPASmartClient.MessageName\BPASmartClient.MessageName.csproj", "{0D769B3B-0332-4DB9-A657-B739EDB28567}" | |||||
EndProject | |||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DATABUS", "BPASmartClient.DATABUS\BPASmartClient.DATABUS.csproj", "{7C1AF86E-867C-427E-90DB-6473D88F51EB}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DATABUS", "BPASmartClient.DATABUS\BPASmartClient.DATABUS.csproj", "{7C1AF86E-867C-427E-90DB-6473D88F51EB}" | ||||
EndProject | EndProject | ||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.SCADAControl", "BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj", "{6A3FC66D-0B89-45E8-B39B-9D81538002D1}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.SCADAControl", "BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj", "{6A3FC66D-0B89-45E8-B39B-9D81538002D1}" | ||||
EndProject | EndProject | ||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1.可视化内存数据", "1.可视化内存数据", "{7BED8969-7EA7-409C-8BBC-D2777ECDA2F1}" | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1.可视化内存数据", "1.可视化内存数据", "{7BED8969-7EA7-409C-8BBC-D2777ECDA2F1}" | ||||
EndProject | EndProject | ||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2.消息名称管理", "2.消息名称管理", "{28BE5235-2399-4EBA-B1F0-88E0F32AC869}" | |||||
EndProject | |||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3.可视化控件集", "3.可视化控件集", "{5300552F-560D-474A-8D96-0A2747D08F64}" | |||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2.可视化控件集", "2.可视化控件集", "{5300552F-560D-474A-8D96-0A2747D08F64}" | |||||
EndProject | EndProject | ||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.VariableManager", "BPASmart.VariableManager\BPASmart.VariableManager.csproj", "{2C17B9A9-B27B-4F07-AFB0-0F56A975D501}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.VariableManager", "BPASmart.VariableManager\BPASmart.VariableManager.csproj", "{2C17B9A9-B27B-4F07-AFB0-0F56A975D501}" | ||||
EndProject | EndProject | ||||
@@ -160,7 +156,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.Server", "BPASmart | |||||
EndProject | EndProject | ||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerTestDemo", "ComputerTestDemo\ComputerTestDemo.csproj", "{8940F1E2-693D-407E-AD03-722718860609}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerTestDemo", "ComputerTestDemo\ComputerTestDemo.csproj", "{8940F1E2-693D-407E-AD03-722718860609}" | ||||
EndProject | EndProject | ||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "4.可视化配置工具", "4.可视化配置工具", "{06F0B369-0483-46DD-82D2-70431FB505C1}" | |||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3.可视化配置工具", "3.可视化配置工具", "{06F0B369-0483-46DD-82D2-70431FB505C1}" | |||||
EndProject | EndProject | ||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeDesignerSCADA", "BeDesignerSCADA\BeDesignerSCADA.csproj", "{DF8B4C38-39DE-4220-AB60-885CAE6D1E47}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeDesignerSCADA", "BeDesignerSCADA\BeDesignerSCADA.csproj", "{DF8B4C38-39DE-4220-AB60-885CAE6D1E47}" | ||||
EndProject | EndProject | ||||
@@ -1336,26 +1332,6 @@ Global | |||||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x64.Build.0 = Release|Any CPU | {A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x64.Build.0 = Release|Any CPU | ||||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x86.ActiveCfg = Release|Any CPU | {A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x86.ActiveCfg = Release|Any CPU | ||||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x86.Build.0 = Release|Any CPU | {A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x86.Build.0 = Release|Any CPU | ||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|ARM.Build.0 = Debug|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|ARM64.Build.0 = Debug|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|x64.ActiveCfg = Debug|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|x64.Build.0 = Debug|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|x86.ActiveCfg = Debug|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|x86.Build.0 = Debug|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|ARM.ActiveCfg = Release|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|ARM.Build.0 = Release|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|ARM64.ActiveCfg = Release|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|ARM64.Build.0 = Release|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|x64.ActiveCfg = Release|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|x64.Build.0 = Release|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|x86.ActiveCfg = Release|Any CPU | |||||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|x86.Build.0 = Release|Any CPU | |||||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | {7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|Any CPU.Build.0 = Debug|Any CPU | {7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|ARM.ActiveCfg = Debug|Any CPU | {7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|ARM.ActiveCfg = Debug|Any CPU | ||||
@@ -1758,11 +1734,9 @@ Global | |||||
{FA695D7E-6F12-4483-A16D-8494609FAE68} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | {FA695D7E-6F12-4483-A16D-8494609FAE68} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | ||||
{D609C4CF-FA5C-4D39-B12F-07A60FFE5E40} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | {D609C4CF-FA5C-4D39-B12F-07A60FFE5E40} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | ||||
{A456D582-D910-4CA2-8620-6D8F63344B47} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | {A456D582-D910-4CA2-8620-6D8F63344B47} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | ||||
{0D769B3B-0332-4DB9-A657-B739EDB28567} = {28BE5235-2399-4EBA-B1F0-88E0F32AC869} | |||||
{7C1AF86E-867C-427E-90DB-6473D88F51EB} = {7BED8969-7EA7-409C-8BBC-D2777ECDA2F1} | {7C1AF86E-867C-427E-90DB-6473D88F51EB} = {7BED8969-7EA7-409C-8BBC-D2777ECDA2F1} | ||||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1} = {5300552F-560D-474A-8D96-0A2747D08F64} | {6A3FC66D-0B89-45E8-B39B-9D81538002D1} = {5300552F-560D-474A-8D96-0A2747D08F64} | ||||
{7BED8969-7EA7-409C-8BBC-D2777ECDA2F1} = {7B0175AD-BB74-4A98-B9A7-1E289032485E} | {7BED8969-7EA7-409C-8BBC-D2777ECDA2F1} = {7B0175AD-BB74-4A98-B9A7-1E289032485E} | ||||
{28BE5235-2399-4EBA-B1F0-88E0F32AC869} = {7B0175AD-BB74-4A98-B9A7-1E289032485E} | |||||
{5300552F-560D-474A-8D96-0A2747D08F64} = {7B0175AD-BB74-4A98-B9A7-1E289032485E} | {5300552F-560D-474A-8D96-0A2747D08F64} = {7B0175AD-BB74-4A98-B9A7-1E289032485E} | ||||
{2C17B9A9-B27B-4F07-AFB0-0F56A975D501} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | {2C17B9A9-B27B-4F07-AFB0-0F56A975D501} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | ||||
{00C5B45D-9799-43F1-B07B-9F638AA9FF72} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | {00C5B45D-9799-43F1-B07B-9F638AA9FF72} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | ||||