首次上传
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using MECF.Framework.Common.SubstrateTrackings;
|
||||
|
||||
namespace SicSimulator.Views.Converters
|
||||
{
|
||||
public class CassetteVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameters, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
CarrierInfo state = (CarrierInfo)value;
|
||||
return state.Status==CarrierStatus.Empty ? Visibility.Hidden : Visibility.Visible;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameters, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace SicSimulator.Views.Converters
|
||||
{
|
||||
public class DiIndexDisplayConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return string.Format("DI-{0}", value == null ? "" : value.ToString());
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class DoIndexDisplayConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return string.Format("DO-{0}", value == null ? "" : value.ToString());
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class AiIndexDisplayConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return string.Format("AI-{0}", value == null ? "" : value.ToString());
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class AoIndexDisplayConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return string.Format("AO-{0}", value == null ? "" : value.ToString());
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class DiValueBackgroundConvert : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
|
||||
return (bool)value ? "LightGreen" : "LightGray";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace SicSimulator.Views
|
||||
{
|
||||
|
||||
public class IoButton : ToggleButton
|
||||
{
|
||||
public static readonly DependencyProperty ONProperty;
|
||||
static IoButton()
|
||||
{
|
||||
ONProperty = DependencyProperty.Register("ON", typeof(bool), typeof(IoButton));
|
||||
}
|
||||
|
||||
public bool ON
|
||||
{
|
||||
get { return (bool)GetValue(ONProperty); }
|
||||
set { SetValue(ONProperty, value); }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class BoolBackgroundConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
bool? ret = (bool?)value;
|
||||
return ret.HasValue && ret.Value ? "LightBlue" : "Transparent";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using Aitex.Core.UI.MVVM;
|
||||
using SicSimulator.Instances;
|
||||
using MECF.Framework.Common.IOCore;
|
||||
using MECF.Framework.Simulator.Core.IoProviders;
|
||||
|
||||
namespace SicSimulator.Views
|
||||
{
|
||||
public class IoViewModel : TimerViewModelBase
|
||||
{
|
||||
public SimulatorModulePlc PlcModule { get; set; }
|
||||
public SimulatorIO PlcSystem { get; set; }
|
||||
|
||||
public ObservableCollection<NotifiableIoItem> DIList { get; set; }
|
||||
public ObservableCollection<NotifiableIoItem> DOList { get; set; }
|
||||
public ObservableCollection<NotifiableIoItem> AIList { get; set; }
|
||||
public ObservableCollection<NotifiableIoItem> AOList { get; set; }
|
||||
|
||||
public IoViewModel(int port, string source, string ioMapPathFile, string module) : base(nameof(IoViewModel))
|
||||
{
|
||||
if (string.IsNullOrEmpty(module) || module == "TM")
|
||||
{
|
||||
PlcSystem = new SimulatorIO(port, source, ioMapPathFile);
|
||||
|
||||
DIList = PlcSystem.DiItemList;
|
||||
DOList = PlcSystem.DoItemList;
|
||||
AIList = PlcSystem.AiItemList;
|
||||
AOList = PlcSystem.AoItemList;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlcModule = new SimulatorModulePlc(port, source, ioMapPathFile, module);
|
||||
|
||||
DIList = PlcModule.DiItemList;
|
||||
DOList = PlcModule.DoItemList;
|
||||
AIList = PlcModule.AiItemList;
|
||||
AOList = PlcModule.AoItemList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected override void Poll()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
<UserControl x:Class="SicSimulator.Views.SimulatorIOPM1View"
|
||||
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:control="clr-namespace:MECF.Framework.UI.Core.Control;assembly=MECF.Framework.UI.Core"
|
||||
xmlns:ctrl="http://OpenSEMI.Ctrlib.com/presentation"
|
||||
xmlns:toolkit="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
|
||||
xmlns:views="clr-namespace:SicSimulator.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="1900">
|
||||
<UserControl.Resources>
|
||||
<views:BoolBackgroundConverter x:Key="BoolBackgroundConverter" />
|
||||
|
||||
<SolidColorBrush x:Key="DataGrid_Cell_BD" Color="Gray" />
|
||||
|
||||
<Style x:Key="Lamp-Button" TargetType="{x:Type views:IoButton}">
|
||||
<Setter Property="Width" Value="16" />
|
||||
<Setter Property="Height" Value="16" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type views:IoButton}">
|
||||
<Grid>
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content=""
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
|
||||
<Ellipse
|
||||
Fill="DarkGray"
|
||||
Stroke="Gray"
|
||||
StrokeThickness="2" />
|
||||
<Ellipse
|
||||
x:Name="Highlight"
|
||||
Fill="Lime"
|
||||
Stroke="Gray"
|
||||
StrokeThickness="2" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="Highlight" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="False">
|
||||
<Setter TargetName="Highlight" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="False">
|
||||
<Setter TargetName="Highlight" Property="Opacity" Value="1" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</UserControl.Resources>
|
||||
<Grid ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="470" />
|
||||
<ColumnDefinition Width="470" />
|
||||
<ColumnDefinition Width="495" />
|
||||
<ColumnDefinition Width="490" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TabControl Margin="0,0,0,0">
|
||||
<TabItem Header="DI">
|
||||
<ListView
|
||||
Name="DIListView"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Top"
|
||||
AlternationCount="2"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding Path=DIList}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn
|
||||
Width="35"
|
||||
DisplayMemberBinding="{Binding Path=Index}"
|
||||
Header="No" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Path=Name}"
|
||||
Header="Name" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
Header="Add"
|
||||
DisplayMemberBinding="{Binding Path=Address}"/>
|
||||
|
||||
<GridViewColumn Width="55" Header="Status">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Width="35">
|
||||
<views:IoButton
|
||||
HorizontalAlignment="Center"
|
||||
IsChecked="{Binding BoolValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
ON="{Binding Path=BoolValue}"
|
||||
Style="{StaticResource Lamp-Button}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="40" Header="Hold">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckHold"
|
||||
Width="25"
|
||||
Height="25"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding Path=HoldValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
<TabControl Grid.Column="1" Margin="0,0,0,0">
|
||||
<TabItem Header="DO">
|
||||
<ListView
|
||||
Name="DOListView"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Top"
|
||||
AlternationCount="2"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding Path=DOList}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn
|
||||
Width="35"
|
||||
DisplayMemberBinding="{Binding Path=Index}"
|
||||
Header="No" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Path=Name}"
|
||||
Header="Name" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
Header="Add"
|
||||
DisplayMemberBinding="{Binding Path=Address}"/>
|
||||
|
||||
<GridViewColumn Width="55" Header="Status">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Width="35">
|
||||
<views:IoButton
|
||||
HorizontalAlignment="Center"
|
||||
IsChecked="{Binding BoolValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
ON="{Binding Path=BoolValue}"
|
||||
Style="{StaticResource Lamp-Button}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="40" Header="Hold">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckHold"
|
||||
Width="25"
|
||||
Height="25"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding Path=HoldValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
<TabControl Grid.Column="2" Margin="0,0,0,0">
|
||||
<TabItem Header="AI">
|
||||
<ListView
|
||||
Name="AIListView"
|
||||
VerticalAlignment="Top"
|
||||
AlternationCount="2"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding Path=AIList}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn
|
||||
Width="35"
|
||||
DisplayMemberBinding="{Binding Path=Index}"
|
||||
Header="No" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Path=Name}"
|
||||
Header="Name" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
Header="Add"
|
||||
DisplayMemberBinding="{Binding Path=Address}"/>
|
||||
|
||||
<GridViewColumn Width="80" Header="Value">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Width="70"
|
||||
Height="20"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
Text="{Binding Path=FloatValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="40" Header="Hold">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckHold"
|
||||
Width="25"
|
||||
Height="25"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding Path=HoldValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
|
||||
<TabControl Grid.Column="3" Margin="0,0,0,0">
|
||||
<TabItem Header="AO">
|
||||
<ListView
|
||||
Name="AOListView"
|
||||
VerticalAlignment="Top"
|
||||
AlternationCount="2"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding Path=AOList}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn
|
||||
Width="35"
|
||||
DisplayMemberBinding="{Binding Path=Index}"
|
||||
Header="No" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Path=Name}"
|
||||
Header="Name" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
Header="Add"
|
||||
DisplayMemberBinding="{Binding Path=Address}"/>
|
||||
|
||||
<GridViewColumn Width="80" Header="Value">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Width="70"
|
||||
Height="20"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
Text="{Binding Path=FloatValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="40" Header="Hold">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckHold"
|
||||
Width="25"
|
||||
Height="25"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding Path=HoldValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Aitex.Common.Util;
|
||||
using Aitex.Core.UI.MVVM;
|
||||
using SicSimulator.Instances;
|
||||
using MECF.Framework.Common.IOCore;
|
||||
|
||||
namespace SicSimulator.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// SimulatorPMIOView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SimulatorIOPM1View : UserControl
|
||||
{
|
||||
public SimulatorIOPM1View()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new IoViewModel(6831, "PM1.PLC", PathManager.GetCfgDir() + "_ioDefinePM.xml", "PM1");
|
||||
|
||||
this.IsVisibleChanged += IOView_IsVisibleChanged;
|
||||
}
|
||||
|
||||
private void IOView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (this.DataContext == null)
|
||||
{
|
||||
}
|
||||
(DataContext as TimerViewModelBase).EnableTimer(IsVisible);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
<UserControl x:Class="SicSimulator.Views.SimulatorIOPM2View"
|
||||
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:control="clr-namespace:MECF.Framework.UI.Core.Control;assembly=MECF.Framework.UI.Core"
|
||||
xmlns:ctrl="http://OpenSEMI.Ctrlib.com/presentation"
|
||||
xmlns:toolkit="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
|
||||
xmlns:views="clr-namespace:SicSimulator.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="1900">
|
||||
<UserControl.Resources>
|
||||
<views:BoolBackgroundConverter x:Key="BoolBackgroundConverter" />
|
||||
|
||||
<SolidColorBrush x:Key="DataGrid_Cell_BD" Color="Gray" />
|
||||
|
||||
<Style x:Key="Lamp-Button" TargetType="{x:Type views:IoButton}">
|
||||
<Setter Property="Width" Value="16" />
|
||||
<Setter Property="Height" Value="16" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type views:IoButton}">
|
||||
<Grid>
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content=""
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
|
||||
<Ellipse
|
||||
Fill="DarkGray"
|
||||
Stroke="Gray"
|
||||
StrokeThickness="2" />
|
||||
<Ellipse
|
||||
x:Name="Highlight"
|
||||
Fill="Lime"
|
||||
Stroke="Gray"
|
||||
StrokeThickness="2" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="Highlight" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="False">
|
||||
<Setter TargetName="Highlight" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="False">
|
||||
<Setter TargetName="Highlight" Property="Opacity" Value="1" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</UserControl.Resources>
|
||||
<Grid ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="470" />
|
||||
<ColumnDefinition Width="470" />
|
||||
<ColumnDefinition Width="495" />
|
||||
<ColumnDefinition Width="490" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TabControl Margin="0,0,0,0">
|
||||
<TabItem Header="DI">
|
||||
<ListView
|
||||
Name="DIListView"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Top"
|
||||
AlternationCount="2"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding Path=DIList}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn
|
||||
Width="35"
|
||||
DisplayMemberBinding="{Binding Path=Index}"
|
||||
Header="No" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Path=Name}"
|
||||
Header="Name" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
Header="Add"
|
||||
DisplayMemberBinding="{Binding Path=Address}"/>
|
||||
|
||||
<GridViewColumn Width="55" Header="Status">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Width="35">
|
||||
<views:IoButton
|
||||
HorizontalAlignment="Center"
|
||||
IsChecked="{Binding BoolValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
ON="{Binding Path=BoolValue}"
|
||||
Style="{StaticResource Lamp-Button}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="40" Header="Hold">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckHold"
|
||||
Width="25"
|
||||
Height="25"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding Path=HoldValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
<TabControl Grid.Column="1" Margin="0,0,0,0">
|
||||
<TabItem Header="DO">
|
||||
<ListView
|
||||
Name="DOListView"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Top"
|
||||
AlternationCount="2"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding Path=DOList}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn
|
||||
Width="35"
|
||||
DisplayMemberBinding="{Binding Path=Index}"
|
||||
Header="No" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Path=Name}"
|
||||
Header="Name" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
Header="Add"
|
||||
DisplayMemberBinding="{Binding Path=Address}"/>
|
||||
|
||||
<GridViewColumn Width="55" Header="Status">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Width="35">
|
||||
<views:IoButton
|
||||
HorizontalAlignment="Center"
|
||||
IsChecked="{Binding BoolValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
ON="{Binding Path=BoolValue}"
|
||||
Style="{StaticResource Lamp-Button}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="40" Header="Hold">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckHold"
|
||||
Width="25"
|
||||
Height="25"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding Path=HoldValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
<TabControl Grid.Column="2" Margin="0,0,0,0">
|
||||
<TabItem Header="AI">
|
||||
<ListView
|
||||
Name="AIListView"
|
||||
VerticalAlignment="Top"
|
||||
AlternationCount="2"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding Path=AIList}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn
|
||||
Width="35"
|
||||
DisplayMemberBinding="{Binding Path=Index}"
|
||||
Header="No" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Path=Name}"
|
||||
Header="Name" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
Header="Add"
|
||||
DisplayMemberBinding="{Binding Path=Address}"/>
|
||||
|
||||
<GridViewColumn Width="80" Header="Value">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Width="70"
|
||||
Height="20"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
Text="{Binding Path=FloatValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="40" Header="Hold">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckHold"
|
||||
Width="25"
|
||||
Height="25"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding Path=HoldValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
|
||||
<TabControl Grid.Column="3" Margin="0,0,0,0">
|
||||
<TabItem Header="AO">
|
||||
<ListView
|
||||
Name="AOListView"
|
||||
VerticalAlignment="Top"
|
||||
AlternationCount="2"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding Path=AOList}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn
|
||||
Width="35"
|
||||
DisplayMemberBinding="{Binding Path=Index}"
|
||||
Header="No" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Path=Name}"
|
||||
Header="Name" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
Header="Add"
|
||||
DisplayMemberBinding="{Binding Path=Address}"/>
|
||||
|
||||
<GridViewColumn Width="80" Header="Value">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Width="70"
|
||||
Height="20"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
Text="{Binding Path=FloatValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="40" Header="Hold">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckHold"
|
||||
Width="25"
|
||||
Height="25"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding Path=HoldValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Aitex.Common.Util;
|
||||
using Aitex.Core.UI.MVVM;
|
||||
using SicSimulator.Instances;
|
||||
using MECF.Framework.Common.IOCore;
|
||||
|
||||
namespace SicSimulator.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// SimulatorPMIOView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SimulatorIOPM2View : UserControl
|
||||
{
|
||||
public SimulatorIOPM2View()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new IoViewModel(6832, "PM2.PLC", PathManager.GetCfgDir() + "_ioDefinePM.xml", "PM2");
|
||||
|
||||
this.IsVisibleChanged += IOView_IsVisibleChanged;
|
||||
}
|
||||
|
||||
private void IOView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (this.DataContext == null)
|
||||
{
|
||||
}
|
||||
(DataContext as TimerViewModelBase).EnableTimer(IsVisible);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
<UserControl x:Class="SicSimulator.Views.SimulatorIOTMView"
|
||||
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:control="clr-namespace:MECF.Framework.UI.Core.Control;assembly=MECF.Framework.UI.Core"
|
||||
xmlns:ctrl="http://OpenSEMI.Ctrlib.com/presentation"
|
||||
xmlns:toolkit="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
|
||||
xmlns:views="clr-namespace:SicSimulator.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="1900">
|
||||
<UserControl.Resources>
|
||||
<views:BoolBackgroundConverter x:Key="BoolBackgroundConverter" />
|
||||
|
||||
<SolidColorBrush x:Key="DataGrid_Cell_BD" Color="Gray" />
|
||||
|
||||
<Style x:Key="Lamp-Button" TargetType="{x:Type views:IoButton}">
|
||||
<Setter Property="Width" Value="16" />
|
||||
<Setter Property="Height" Value="16" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type views:IoButton}">
|
||||
<Grid>
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content=""
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
|
||||
<Ellipse
|
||||
Fill="DarkGray"
|
||||
Stroke="Gray"
|
||||
StrokeThickness="2" />
|
||||
<Ellipse
|
||||
x:Name="Highlight"
|
||||
Fill="Lime"
|
||||
Stroke="Gray"
|
||||
StrokeThickness="2" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="Highlight" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="False">
|
||||
<Setter TargetName="Highlight" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="False">
|
||||
<Setter TargetName="Highlight" Property="Opacity" Value="1" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</UserControl.Resources>
|
||||
<Grid ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="470" />
|
||||
<ColumnDefinition Width="470" />
|
||||
<ColumnDefinition Width="495" />
|
||||
<ColumnDefinition Width="495" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TabControl Margin="0,0,0,0">
|
||||
<TabItem Header="DI">
|
||||
<ListView
|
||||
Name="DIListView"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Top"
|
||||
AlternationCount="2"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding Path=DIList}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn
|
||||
Width="35"
|
||||
DisplayMemberBinding="{Binding Path=Index}"
|
||||
Header="No" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Path=Name}"
|
||||
Header="Name" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
Header="Add"
|
||||
DisplayMemberBinding="{Binding Path=Address}"/>
|
||||
|
||||
<GridViewColumn Width="55" Header="Status">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Width="35">
|
||||
<views:IoButton
|
||||
HorizontalAlignment="Center"
|
||||
IsChecked="{Binding BoolValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
ON="{Binding Path=BoolValue}"
|
||||
Style="{StaticResource Lamp-Button}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="40" Header="Hold">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckHold"
|
||||
Width="25"
|
||||
Height="25"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding Path=HoldValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
<TabControl Grid.Column="1" Margin="0,0,0,0">
|
||||
<TabItem Header="DO">
|
||||
<ListView
|
||||
Name="DOListView"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Top"
|
||||
AlternationCount="2"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding Path=DOList}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn
|
||||
Width="35"
|
||||
DisplayMemberBinding="{Binding Path=Index}"
|
||||
Header="No" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Path=Name}"
|
||||
Header="Name" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
Header="Add"
|
||||
DisplayMemberBinding="{Binding Path=Address}"/>
|
||||
|
||||
<GridViewColumn Width="55" Header="Status">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Width="35">
|
||||
<views:IoButton
|
||||
HorizontalAlignment="Center"
|
||||
IsChecked="{Binding BoolValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
ON="{Binding Path=BoolValue}"
|
||||
Style="{StaticResource Lamp-Button}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="40" Header="Hold">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckHold"
|
||||
Width="25"
|
||||
Height="25"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding Path=HoldValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
<TabControl Grid.Column="2" Margin="0,0,0,0">
|
||||
<TabItem Header="AI">
|
||||
<ListView
|
||||
Name="AIListView"
|
||||
VerticalAlignment="Top"
|
||||
AlternationCount="2"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding Path=AIList}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn
|
||||
Width="35"
|
||||
DisplayMemberBinding="{Binding Path=Index}"
|
||||
Header="No" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Path=Name}"
|
||||
Header="Name" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
Header="Add"
|
||||
DisplayMemberBinding="{Binding Path=Address}"/>
|
||||
|
||||
<GridViewColumn Width="80" Header="Value">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Width="70"
|
||||
Height="20"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
Text="{Binding Path=ShortValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="40" Header="Hold">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckHold"
|
||||
Width="25"
|
||||
Height="25"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding Path=HoldValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
|
||||
<TabControl Grid.Column="3" Margin="0,0,0,0">
|
||||
<TabItem Header="AO">
|
||||
<ListView
|
||||
Name="AOListView"
|
||||
VerticalAlignment="Top"
|
||||
AlternationCount="2"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding Path=AOList}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn
|
||||
Width="35"
|
||||
DisplayMemberBinding="{Binding Path=Index}"
|
||||
Header="No" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Path=Name}"
|
||||
Header="Name" />
|
||||
|
||||
<GridViewColumn
|
||||
Width="50"
|
||||
Header="Add"
|
||||
DisplayMemberBinding="{Binding Path=Address}"/>
|
||||
|
||||
<GridViewColumn Width="80" Header="Value">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Width="70"
|
||||
Height="20"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
Text="{Binding Path=FloatValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn Width="40" Header="Hold">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox
|
||||
x:Name="ckHold"
|
||||
Width="25"
|
||||
Height="25"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding Path=HoldValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,40 @@
|
||||
using Aitex.Common.Util;
|
||||
using Aitex.Core.UI.MVVM;
|
||||
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.Shapes;
|
||||
|
||||
namespace SicSimulator.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// SimulatorIOTMView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SimulatorIOTMView : UserControl
|
||||
{
|
||||
public SimulatorIOTMView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = new IoViewModel(6833, "TM.PLC", PathManager.GetCfgDir() + "IODefinePlatform.xml", "TM");
|
||||
|
||||
this.IsVisibleChanged += IOView_IsVisibleChanged;
|
||||
}
|
||||
private void IOView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (this.DataContext == null)
|
||||
{
|
||||
}
|
||||
(DataContext as TimerViewModelBase).EnableTimer(IsVisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user