refactor: 将Framework库和RT、UI放在同一个解决方案中。

This commit is contained in:
SL
2026-06-01 17:48:28 +08:00
parent 1948f4290d
commit b73d39a6b1
4331 changed files with 506148 additions and 49363 deletions
@@ -0,0 +1,19 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.AITHeaterControl"
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"
mc:Ignorable="d" d:DesignHeight="24" d:DesignWidth="45" BorderThickness="1" x:Name="self">
<Grid MouseLeftButtonUp="Grid_MouseLeftButtonUp" Cursor="Hand" Opacity="1" MouseEnter="Grid_MouseEnter">
<Border Background="Transparent" x:Name="bdRectangle" BorderThickness="1">
<Rectangle Style="{x:Null}" RadiusX="2" RadiusY="2" Name="rectBkground"
Stroke="Gray" Margin="1" Opacity="1" Fill="LightBlue" StrokeThickness="1"/>
</Border>
<Label Content="{Binding ElementName=self, Path=DeviceData.FeedBack}"
VerticalContentAlignment="Center"
ContentStringFormat="F1" FontFamily="Verdana"
FontSize="{Binding ElementName=self, Path=FontSizeSetting}"
HorizontalContentAlignment="Center"
x:Name="labelValue" Margin="0,-2,-2,-2" Foreground="{Binding ElementName=self, Path=ForegroundSetting}" />
</Grid>
</UserControl>
@@ -0,0 +1,254 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Aitex.Core.Common.DeviceData;
using Aitex.Core.UI.DeviceControl;
using MECF.Framework.Common.OperationCenter;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// AITHeaterControl.xaml 的交互逻辑
/// </summary>
public partial class AITHeaterControl : UserControl
{
public AITHeaterControl()
{
InitializeComponent();
}
// define dependency properties
public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(
"Command", typeof(ICommand), typeof(AITHeaterControl),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty DeviceDataProperty = DependencyProperty.Register(
"DeviceData", typeof(AITHeaterData), typeof(AITHeaterControl),
new FrameworkPropertyMetadata(new AITHeaterData(), FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty BackColorProperty = DependencyProperty.Register(
"BackColor", typeof(Brush), typeof(AITHeaterControl),
new FrameworkPropertyMetadata(Brushes.DarkMagenta, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty HideDialogProperty = DependencyProperty.Register(
"HideDialog", typeof(bool), typeof(AITHeaterControl),
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty AlwaysPowerOnProperty = DependencyProperty.Register(
"AlwaysPowerOn", typeof(bool), typeof(AITHeaterControl),
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty FontSizeSettingProperty = DependencyProperty.Register(
"FontSizeSetting", typeof(int), typeof(AITHeaterControl),
new FrameworkPropertyMetadata(13, FrameworkPropertyMetadataOptions.AffectsRender));
public int FontSizeSetting
{
get
{
return (int)this.GetValue(FontSizeSettingProperty);
}
set
{
this.SetValue(FontSizeSettingProperty, value);
}
}
public static readonly DependencyProperty ForegroundSettingProperty = DependencyProperty.Register(
"ForegroundSetting", typeof(string), typeof(AITHeaterControl),
new FrameworkPropertyMetadata("White", FrameworkPropertyMetadataOptions.AffectsRender));
public string ForegroundSetting
{
get
{
return (string)this.GetValue(ForegroundSettingProperty);
}
set
{
this.SetValue(ForegroundSettingProperty, value);
}
}
/// <summary>
/// 输入值是否百分比,默认否
/// </summary>
public bool IsPercent { get; set; }
public ICommand Command
{
get
{
return (ICommand)this.GetValue(CommandProperty);
}
set
{
this.SetValue(CommandProperty, value);
}
}
/// <summary>
/// set, get current progress value AnalogDeviceData
/// </summary>
public AITHeaterData DeviceData
{
get
{
return (AITHeaterData)this.GetValue(DeviceDataProperty);
}
set
{
this.SetValue(DeviceDataProperty, value);
}
}
public Brush BackColor
{
get
{
return (Brush)this.GetValue(BackColorProperty);
}
set
{
this.SetValue(BackColorProperty, value);
}
}
public bool HideDialog
{
get
{
return (bool)this.GetValue(HideDialogProperty);
}
set
{
this.SetValue(HideDialogProperty, value);
}
}
public bool AlwaysPowerOn
{
get
{
return (bool)this.GetValue(AlwaysPowerOnProperty);
}
set
{
this.SetValue(AlwaysPowerOnProperty, value);
}
}
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
//draw background color
if (DeviceData != null)
{
rectBkground.Fill = (DeviceData.IsPowerOn || AlwaysPowerOn) ? Brushes.DarkMagenta : Brushes.Gray;
//draw red board if mfc meets a warning
rectBkground.Stroke = DeviceData.IsWarning ? Brushes.Red : new SolidColorBrush(System.Windows.Media.Color.FromRgb(0X37, 0X37, 0X37));
labelValue.Foreground = DeviceData.IsWarning ? Brushes.Pink : Brushes.LightYellow;
rectBkground.StrokeThickness = DeviceData.IsWarning ? 2 : 1;
if (dialogBox != null)
{
dialogBox.RealValue = DeviceData.FeedBack.ToString("F1");
dialogBox.IsHeaterOn = DeviceData.IsPowerOn;
dialogBox.SetPoint = DeviceData.SetPoint;
}
}
}
private void ExecutePowerOnOff(bool value)
{
if (Command == null)
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.SetPowerOnOff", value.ToString());
}
else
{
Command.Execute(new object[] { DeviceData.DeviceName, AITHeaterOperation.SetPowerOnOff.ToString(), value.ToString() });
}
}
private void ExecuteSetHeaterValue(double power)
{
if (Command == null)
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.Ramp",
power.ToString());
}
else
{
Command.Execute(new object[]
{DeviceData.DeviceName, AITHeaterOperation.Ramp.ToString(), power.ToString()});
}
}
private AITHeaterInputDialogBox dialogBox;
public Window AnalogOwner { get; set; }
private void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (DeviceData == null)
return;
if (HideDialog)
return;
dialogBox = new AITHeaterInputDialogBox
{
SetHeaterValueCommandDelegate = ExecuteSetHeaterValue,
SetHeaterPowerOnOffCommandDelegate = ExecutePowerOnOff,
DeviceName = DeviceData.DisplayName,
DeviceId = DeviceData.DeviceSchematicId,
DefaultValue = DeviceData.DefaultValue,
RealValue = DeviceData.FeedBack.ToString("F1"),
SetPoint = Math.Round(DeviceData.SetPoint, 1),
MaxValue = DeviceData.Scale,
Unit = DeviceData.Unit,
IsHeaterOn = DeviceData.IsPowerOn,
};
if (AnalogOwner != null)
dialogBox.Owner = AnalogOwner;
dialogBox.Topmost = true;
dialogBox.WindowStartupLocation = WindowStartupLocation.CenterScreen;
dialogBox.FocasAll();
dialogBox.ShowDialog();
dialogBox = null;
}
private void Grid_MouseEnter(object sender, MouseEventArgs e)
{
if (DeviceData != null)
{
string tooltipValue =
string.Format("{0}:{1}\r\n\r\nID:{2}\r\nScale:{3} {4}\r\nSetPoint:{5} {4} \r\nFeedback:{6} {4}\r\nHeaterPower:{7}",
DeviceData.Type,
DeviceData.DisplayName,
DeviceData.DeviceSchematicId,
DeviceData.Scale,
DeviceData.Unit,
DeviceData.SetPoint.ToString("F1"),
DeviceData.FeedBack.ToString("F1"),
DeviceData.IsPowerOn ? "On" : "Off");
ToolTip = tooltipValue;
}
}
}
}
@@ -0,0 +1,128 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.AITMicrowaveSettingDialogView"
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:unitControls="clr-namespace:MECF.Framework.UI.Client.Ctrlib.UnitControls"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:micro="clr-namespace:Caliburn.Micro"
xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
xmlns:deviceControl="clr-namespace:Aitex.Core.UI.DeviceControl;assembly=MECF.Framework.UI.Core"
mc:Ignorable="d"
KeyDown="OnEnterKeyIsHit"
d:DesignHeight="440" d:DesignWidth="600">
<UserControl.Resources>
<Style x:Key="textBoxInError" TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
</Style>
<unitControls:DoubleConverter x:Key="doubleConverter"/>
</UserControl.Resources>
<Border Height="320" Width="400" Background="{DynamicResource Color_BG_Dialog_Inner}" BorderThickness="1" BorderBrush="SteelBlue" >
<Grid Margin="2">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="70"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="1" Content="DeviceName :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="1" Grid.Column="1" Content="Unit :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="2" Grid.Column="1" Content="Max :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="3" Grid.Column="1" Content="Heat Up:" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="4" Grid.Column="1" Content="Forward Power :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="5" Grid.Column="1" Content="Reflect Power :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="6" Grid.Column="1" Content="SetPoint :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="0" Grid.Column="2" Content="{Binding Path=DeviceData.DisplayName}" Width="150" Height="28" HorizontalAlignment="Left" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" VerticalContentAlignment="Center" />
<Label Grid.Row="1" Grid.Column="2" Content="{Binding Path=DeviceData.UnitPower}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<Label Grid.Row="2" Grid.Column="2" Content="{Binding Path=DeviceData.ScalePower}" ContentStringFormat="F1" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<StackPanel Grid.Row="3" Grid.Column="2" Margin="0,10,0,0"
VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Center">
<deviceControl:AITSensor GreenColor="True" LightOnValue="{Binding IsHeatOn}" Width="30" Height="25" VerticalAlignment="Center">
</deviceControl:AITSensor>
<Button IsEnabled="{Binding IsEnableHeatOn}" Margin="10,0,0,0" Content="On" Width="40" Padding="0" Height="25" VerticalAlignment="Center">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="SetHeatOn">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button IsEnabled="{Binding IsEnableHeatOff}" Margin="10,0,0,0" Content="OFF" Width="40" Padding="0" Height="25" VerticalAlignment="Center">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="SetHeatOff">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</StackPanel>
<Label Grid.Row="4" Grid.Column="2" Content="{Binding Path=DeviceData.ForwardPower}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<Label Grid.Row="5" Grid.Column="2" Content="{Binding Path=DeviceData.ReflectPower}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<controls:TextBoxEx Grid.Row="6" Grid.Column="2" Text="{Binding Path=InputSetPoint, UpdateSourceTrigger=PropertyChanged}"
x:Name="inputBox" BorderBrush="Green" BorderThickness="0,0,0,1"
AllowBackgroundChange="False" Width="150"
EditBoxMode="UnSignDecimal"
TextChanged="InputTextBox_TextChanged"
HorizontalAlignment="Stretch" FontSize="13" FontFamily="Arial,SimSun"
Height="30" VerticalContentAlignment="Center" />
<StackPanel Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="4" Margin="0,10,0,0"
VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Content="Set" Width="80" Height="30">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="SetPower">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button IsEnabled="{Binding IsEnablePowerOn}" Margin="10,0,0,0" Content="PowerON" Width="80" Padding="0" Height="30">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="SetPowerOn">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button IsEnabled="{Binding IsEnablePowerOff}" Margin="10,0,0,0" Content="PowerOFF" Width="80" Padding="0" Height="30">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="SetPowerOff">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button Margin="10,0,0,0" Content="Cancel" Width="80" Height="30">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="Cancel">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<!--<CheckBox Margin="20,0,0,0" Content="Stick" IsChecked="{Binding IsSticked}" VerticalAlignment="Center" ></CheckBox>-->
</StackPanel>
</Grid>
</Border>
</UserControl>
@@ -0,0 +1,53 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Aitex.Core.Common.DeviceData;
using Aitex.Core.RT.Log;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// InputFileNameDialogView.xaml 的交互逻辑
/// </summary>
public partial class AITMicrowaveSettingDialogView : UserControl
{
public AITMicrowaveSettingDialogView()
{
InitializeComponent();
}
private void InputTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
double input;
if (!double.TryParse(inputBox.Text, out input))
(this.DataContext as AITMicrowaveSettingDialogViewModel).IsEnableOk = false;
else if (input < 0 || input > (this.DataContext as AITMicrowaveSettingDialogViewModel).DeviceData.ScalePower)
(this.DataContext as AITMicrowaveSettingDialogViewModel).IsEnableOk = false;
else
(this.DataContext as AITMicrowaveSettingDialogViewModel).IsEnableOk = true;
inputBox.Foreground = (this.DataContext as AITMicrowaveSettingDialogViewModel).IsEnableOk ?
System.Windows.Media.Brushes.Black : System.Windows.Media.Brushes.Red;
}
private void OnEnterKeyIsHit(object sender, KeyEventArgs e)
{
try
{
if (!(this.DataContext as AITMicrowaveSettingDialogViewModel).IsEnableOk) return;
if (e.Key == Key.Return)
{
(this.DataContext as AITMicrowaveSettingDialogViewModel).SetPower();
}
}
catch (Exception ex)
{
LOG.Error(ex.Message);
}
}
}
}
@@ -0,0 +1,151 @@
using System.ComponentModel;
using System.Windows.Input;
using Aitex.Core.Common.DeviceData;
using DocumentFormat.OpenXml.Presentation;
using MECF.Framework.Common.OperationCenter;
using MECF.Framework.UI.Client.CenterViews.Editors;
using OpenSEMI.ClientBase;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
public class AITMicrowaveSettingDialogViewModel : DialogViewModel<string>, INotifyPropertyChanged
{
public AITMicrowaveSettingDialogViewModel(string dialogName = "")
{
this.DisplayName = dialogName;
}
private AITRfData _data;
public AITRfData DeviceData
{
get
{
return _data;
}
set
{
_data = value;
NotifyOfPropertyChange(nameof(DeviceData));
}
}
private string _setPoint;
public string InputSetPoint
{
get { return _setPoint; }
set
{
_setPoint = value;
NotifyOfPropertyChange(nameof(InputSetPoint));
}
}
private bool _enableOk;
public bool IsEnableOk
{
get
{
return _enableOk;
}
set
{
_enableOk = value;
NotifyOfPropertyChange(nameof(IsEnableOk));
}
}
public bool IsEnablePowerOn
{
get
{
return DeviceData != null && !DeviceData.IsRfOn;
}
}
public bool IsEnablePowerOff
{
get
{
return DeviceData != null && DeviceData.IsRfOn;
}
}
public bool IsEnableHeatOn
{
get
{
if (DeviceData == null || !DeviceData.AttrValue.ContainsKey("HeatOnSetPoint"))
return false;
return !(bool)DeviceData.AttrValue["HeatOnSetPoint"];
}
}
public bool IsEnableHeatOff
{
get
{
if (DeviceData == null || !DeviceData.AttrValue.ContainsKey("HeatOnSetPoint"))
return false;
return (bool)DeviceData.AttrValue["HeatOnSetPoint"];
}
}
public bool IsHeatOn
{
get
{
if (DeviceData == null || !DeviceData.AttrValue.ContainsKey("HeatOnComplete"))
return false;
return (bool)DeviceData.AttrValue["HeatOnComplete"];
}
}
public void Cancel()
{
IsCancel = true;
TryClose(false);
}
protected override void OnViewLoaded(object view)
{
base.OnViewLoaded(view);
}
public void SetPower()
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPower}", InputSetPoint);
}
public void SetPowerOn()
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPowerOnOff}", "true");
}
public void SetPowerOff()
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPowerOnOff}", "false");
}
public void SetHeatOn()
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetHeatOnOff}", "true");
}
public void SetHeatOff()
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetHeatOnOff}", "false");
}
}
}
@@ -0,0 +1,22 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.AITPressureMeter"
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:unitControls="clr-namespace:MECF.Framework.UI.Client.Ctrlib.UnitControls"
mc:Ignorable="d" d:DesignHeight="24" d:DesignWidth="45" BorderThickness="1" x:Name="self">
<UserControl.Resources>
<unitControls:AITPressureMeterFillColorConverter x:Key="AITPressureMeterFillColorConverter"/>
</UserControl.Resources>
<Grid Cursor="Hand" Opacity="1" MouseEnter="Grid_MouseEnter">
<Border Style="{x:Null}" Background="Transparent" x:Name="bdRectangle" BorderThickness="1">
<Rectangle Style="{x:Null}" RadiusX="2" RadiusY="2" Name="rectBkground" Stroke="{Binding ElementName=self, Path=DeviceData, Converter={StaticResource AITPressureMeterFillColorConverter}}"
Margin="1" Opacity="1" Fill="SteelBlue" StrokeThickness="2"/>
</Border>
<Label Content="{Binding ElementName=self, Path=DeviceData.Display}"
HorizontalContentAlignment="Center" x:Name="labelValue" Margin="0,-2,-2,-2"
VerticalContentAlignment="Center" Foreground="White" />
</Grid>
</UserControl>
@@ -0,0 +1,66 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using Aitex.Core.Common.DeviceData;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
public class AITPressureMeterFillColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
AITPressureMeterData DeviceData = (AITPressureMeterData) value;
if (DeviceData!=null)
{
if (DeviceData.IsError) return "OrangeRed";
if (DeviceData.IsWarning) return "Yellow";
}
return "Gray";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
/// <summary>
/// AITPressureMeter.xaml 的交互逻辑
/// </summary>
public partial class AITPressureMeter : UserControl
{
public static readonly DependencyProperty DeviceDataProperty = DependencyProperty.Register(
"DeviceData", typeof(AITPressureMeterData), typeof(AITPressureMeter),
new FrameworkPropertyMetadata(new AITPressureMeterData(), FrameworkPropertyMetadataOptions.AffectsRender));
public AITPressureMeterData DeviceData
{
get
{
return (AITPressureMeterData)this.GetValue(DeviceDataProperty);
}
set
{
this.SetValue(DeviceDataProperty, value);
}
}
public AITPressureMeter()
{
InitializeComponent();
}
private void Grid_MouseEnter(object sender, MouseEventArgs e)
{
if (DeviceData != null)
{
ToolTip = $"{DeviceData.Type}:{DeviceData.DisplayName}\r\n{DeviceData.FeedBack.ToString(DeviceData.FormatString)} {DeviceData.Unit}";
}
}
}
}
@@ -0,0 +1,23 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.AITRf"
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"
mc:Ignorable="d" d:DesignHeight="78" d:DesignWidth="90" BorderThickness="1" x:Name="self" >
<Grid MouseLeftButtonUp="Grid_MouseLeftButtonUp" Cursor="Hand" Opacity="1" MouseEnter="Grid_MouseEnter">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Rectangle RadiusX="2" RadiusY="2" Name="rectFeedback" Stroke="Gray" Margin="0" Opacity="1" Fill="MediumPurple" StrokeThickness="2"/>
<Label Content="0.0" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" x:Name="labelValue" Margin="0,-1,-2,0" Foreground="White" />
</Grid>
<Grid Grid.Row="1">
<Rectangle Name="rectSetPoint" RadiusX="2" RadiusY="2" Stroke="Gray" Margin="0" Opacity="1" Fill="CadetBlue" StrokeThickness="2"/>
<Label Content="0.0" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" x:Name="labelSetPoint" Margin="0,-2,-2,0" Foreground="DarkSlateGray" />
</Grid>
</Grid>
</UserControl>
@@ -0,0 +1,288 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Aitex.Core.Common.DeviceData;
using Aitex.Core.RT.Log;
using Caliburn.Micro;
using MECF.Framework.Common.OperationCenter;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// AITRfGenerator.xaml 的交互逻辑
/// </summary>
public partial class AITRf : UserControl
{
public AITRf()
{
InitializeComponent();
}
// define dependency properties
public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(
"Command", typeof(ICommand), typeof(AITRf),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty DeviceDataProperty = DependencyProperty.Register(
"DeviceData", typeof(AITRfData), typeof(AITRf),
new FrameworkPropertyMetadata(new AITRfData(), FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty IsMicrowaveModeProperty = DependencyProperty.Register(
"IsMicrowaveMode", typeof(bool), typeof(AITRf),
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
public bool IsMicrowaveMode
{
get
{
return (bool)this.GetValue(IsMicrowaveModeProperty);
}
set
{
this.SetValue(IsMicrowaveModeProperty, value);
}
}
public ICommand Command
{
get
{
return (ICommand)this.GetValue(CommandProperty);
}
set
{
this.SetValue(CommandProperty, value);
}
}
/// <summary>
/// set, get current progress value AnalogDeviceData
/// </summary>
public AITRfData DeviceData
{
get
{
return (AITRfData)this.GetValue(DeviceDataProperty);
}
set
{
this.SetValue(DeviceDataProperty, value);
}
}
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
if (DeviceData != null)
{
if (DeviceData.IsToleranceError)
{
rectFeedback.Stroke = Brushes.OrangeRed;
}else if (DeviceData.IsToleranceWarning)
{
rectFeedback.Stroke = Brushes.Yellow;
}
else
{
rectFeedback.Stroke = Brushes.Gray;
}
if (DeviceData.IsRfAlarm)
{
rectSetPoint.Stroke = Brushes.OrangeRed;
}
else if (!DeviceData.IsInterlockOk)
{
rectSetPoint.Stroke = Brushes.Yellow;
}
else
{
rectSetPoint.Stroke = Brushes.Gray;
}
if (DeviceData.IsRfOn)
{
rectFeedback.Fill = Brushes.HotPink;
}
else
{
rectFeedback.Fill = Brushes.MediumPurple;
}
labelValue.Content = $"{DeviceData.ForwardPower:F1} : {DeviceData.ReflectPower:F1}";
labelSetPoint.Content = $"{DeviceData.PowerSetPoint:F1} {DeviceData.UnitPower}";
if (IsMicrowaveMode)
{
if (_dialogMicrowave != null)
{
_dialogMicrowave.DeviceData = DeviceData;
_dialogMicrowave.DeviceData.InvokePropertyChanged();
_dialogMicrowave.NotifyOfPropertyChange(nameof(_dialogMicrowave.IsEnablePowerOff));
_dialogMicrowave.NotifyOfPropertyChange(nameof(_dialogMicrowave.IsEnablePowerOn));
_dialogMicrowave.NotifyOfPropertyChange(nameof(_dialogMicrowave.IsEnableHeatOff));
_dialogMicrowave.NotifyOfPropertyChange(nameof(_dialogMicrowave.IsEnableHeatOn));
_dialogMicrowave.NotifyOfPropertyChange(nameof(_dialogMicrowave.IsHeatOn));
}
}
else
{
if (_dialogRf != null)
{
_dialogRf.DeviceData = DeviceData;
_dialogRf.DeviceData.InvokePropertyChanged();
_dialogRf.NotifyOfPropertyChange(nameof(_dialogRf.IsEnablePowerOff));
_dialogRf.NotifyOfPropertyChange(nameof(_dialogRf.IsEnablePowerOn));
}
}
}
}
private AITRfSettingDialogViewModel _dialogRf;
private AITMicrowaveSettingDialogViewModel _dialogMicrowave;
private void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (DeviceData == null)
return;
if (IsMicrowaveMode)
{
_dialogMicrowave = new AITMicrowaveSettingDialogViewModel($"{DeviceData.DisplayName} Setting");
_dialogMicrowave.DeviceData = DeviceData;
_dialogMicrowave.InputSetPoint = DeviceData.PowerSetPoint.ToString("F1");
WindowManager wm1 = new WindowManager();
Window owner1 = Application.Current.MainWindow;
if (owner1 != null)
{
Mouse.Capture(owner1);
Point pointToWindow = Mouse.GetPosition(owner1);
Point pointToScreen = owner1.PointToScreen(pointToWindow);
pointToScreen.X = pointToScreen.X + 50;
pointToScreen.Y = pointToScreen.Y - 150;
Mouse.Capture(null);
wm1.ShowDialog(_dialogMicrowave, pointToScreen);
}
else
{
wm1.ShowDialog(_dialogMicrowave);
}
return;
}
_dialogRf = new AITRfSettingDialogViewModel($"{DeviceData.DisplayName} Setting");
_dialogRf.DeviceData = DeviceData;
_dialogRf.InputSetPoint = DeviceData.PowerSetPoint.ToString("F1");
WindowManager wm = new WindowManager();
Window owner = Application.Current.MainWindow;
if (owner != null)
{
Mouse.Capture(owner);
Point pointToWindow = Mouse.GetPosition(owner);
Point pointToScreen = owner.PointToScreen(pointToWindow);
pointToScreen.X = pointToScreen.X + 50;
pointToScreen.Y = pointToScreen.Y - 150;
Mouse.Capture(null);
wm.ShowDialog(_dialogRf, pointToScreen);
}
else
{
wm.ShowDialog(_dialogRf);
}
}
private void ExecuteSetMode(RfMode value)
{
if (Command == null)
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetMode}", value.ToString());
return;
}
Command.Execute(new object[] { DeviceData.DeviceName, AITRfOperation.SetMode.ToString(), value.ToString() });
}
private void ExecutePowerOnOff(bool value)
{
if (Command == null)
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPowerOnOff}", value.ToString());
return;
}
Command.Execute(new object[] { DeviceData.DeviceName, AITRfOperation.SetPowerOnOff.ToString(), value.ToString() });
}
private void ExecuteContinuous(double power)
{
if (Command == null)
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetContinuousPower}", power.ToString());
return;
}
Command.Execute(new object[] { DeviceData.DeviceName, AITRfOperation.SetContinuousPower.ToString(), power.ToString() });
}
private void ExecutePulsing(double power, double frequency, double duty)
{
if (Command == null)
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPulsingPower}", power.ToString());
return;
}
Command.Execute(new object[] { DeviceData.DeviceName, AITRfOperation.SetPulsingPower.ToString(), power.ToString(), frequency.ToString(), duty.ToString() });
}
private void Grid_MouseEnter(object sender, MouseEventArgs e)
{
if (DeviceData != null)
{
try
{
string tooltipValue =
DeviceData.EnableVoltageCurrent
? string.Format("{0}:{1}\r\n\r\nID:{2}\r\nForward Power:{3} w\r\nVoltage:{4} \r\nCurrent:{5} \r\nSetPoint:{6} w",
"RF",
DeviceData.DisplayName,
DeviceData.DeviceSchematicId,
DeviceData.ForwardPower.ToString("F1"),
DeviceData.Voltage.ToString("F1"),
DeviceData.Current.ToString("F1"),
DeviceData.PowerSetPoint.ToString("F1"))
: string.Format("{0}:{1}\r\n\r\nID:{2}\r\nForward Power:{3} w\r\nReflect Power:{4} w \r\nSetPoint:{5} w",
"RF",
DeviceData.DisplayName,
DeviceData.DeviceSchematicId,
DeviceData.ForwardPower.ToString("F1"),
DeviceData.ReflectPower.ToString("F1"),
DeviceData.PowerSetPoint.ToString("F1"));
ToolTip = tooltipValue;
}
catch (Exception ex)
{
LOG.Write(ex);
}
}
}
}
}
@@ -0,0 +1,103 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.AITRfSettingDialogView"
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:unitControls="clr-namespace:MECF.Framework.UI.Client.Ctrlib.UnitControls"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:micro="clr-namespace:Caliburn.Micro"
xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
mc:Ignorable="d"
KeyDown="OnEnterKeyIsHit"
d:DesignHeight="450" d:DesignWidth="600">
<UserControl.Resources>
<Style x:Key="textBoxInError" TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
</Style>
<unitControls:DoubleConverter x:Key="doubleConverter"/>
</UserControl.Resources>
<Border Height="300" Width="400" Background="{DynamicResource Color_BG_Dialog_Inner}" BorderThickness="1" BorderBrush="SteelBlue" >
<Grid Margin="2">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="70"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="1" Content="DeviceName :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="1" Grid.Column="1" Content="Unit :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="2" Grid.Column="1" Content="Max :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="3" Grid.Column="1" Content="Forward Power :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="4" Grid.Column="1" Content="Reflect Power :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="5" Grid.Column="1" Content="SetPoint :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="0" Grid.Column="2" Content="{Binding Path=DeviceData.DisplayName}" Width="150" Height="28" HorizontalAlignment="Left" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" VerticalContentAlignment="Center" />
<Label Grid.Row="1" Grid.Column="2" Content="{Binding Path=DeviceData.UnitPower}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<Label Grid.Row="2" Grid.Column="2" Content="{Binding Path=DeviceData.ScalePower}" ContentStringFormat="F1" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<Label Grid.Row="3" Grid.Column="2" Content="{Binding Path=DeviceData.ForwardPower}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<Label Grid.Row="4" Grid.Column="2" Content="{Binding Path=DeviceData.ReflectPower}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<controls:TextBoxEx Grid.Row="5" Grid.Column="2" Text="{Binding Path=InputSetPoint, UpdateSourceTrigger=PropertyChanged}"
x:Name="inputBox" BorderBrush="Green" BorderThickness="0,0,0,1"
AllowBackgroundChange="False" Width="150"
EditBoxMode="UnSignDecimal"
TextChanged="InputTextBox_TextChanged"
HorizontalAlignment="Stretch" FontSize="13" FontFamily="Arial,SimSun"
Height="30" VerticalContentAlignment="Center" />
<StackPanel Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="4" Margin="0,10,0,0"
VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Content="Set" Width="80" Height="30">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="SetPower">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button IsEnabled="{Binding IsEnablePowerOn}" Margin="10,0,0,0" Content="PowerON" Width="80" Padding="0" Height="30">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="SetPowerOn">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button IsEnabled="{Binding IsEnablePowerOff}" Margin="10,0,0,0" Content="PowerOFF" Width="80" Padding="0" Height="30">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="SetPowerOff">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button Margin="10,0,0,0" Content="Cancel" Width="80" Height="30">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="Cancel">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<!--<CheckBox Margin="20,0,0,0" Content="Stick" IsChecked="{Binding IsSticked}" VerticalAlignment="Center" ></CheckBox>-->
</StackPanel>
</Grid>
</Border>
</UserControl>
@@ -0,0 +1,53 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Aitex.Core.Common.DeviceData;
using Aitex.Core.RT.Log;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// InputFileNameDialogView.xaml 的交互逻辑
/// </summary>
public partial class AITRfSettingDialogView : UserControl
{
public AITRfSettingDialogView()
{
InitializeComponent();
}
private void InputTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
double input;
if (!double.TryParse(inputBox.Text, out input))
(this.DataContext as AITRfSettingDialogViewModel).IsEnableOk = false;
else if (input < 0 || input > (this.DataContext as AITRfSettingDialogViewModel).DeviceData.ScalePower)
(this.DataContext as AITRfSettingDialogViewModel).IsEnableOk = false;
else
(this.DataContext as AITRfSettingDialogViewModel).IsEnableOk = true;
inputBox.Foreground = (this.DataContext as AITRfSettingDialogViewModel).IsEnableOk ?
System.Windows.Media.Brushes.Black : System.Windows.Media.Brushes.Red;
}
private void OnEnterKeyIsHit(object sender, KeyEventArgs e)
{
try
{
if (!(this.DataContext as AITRfSettingDialogViewModel).IsEnableOk) return;
if (e.Key == Key.Return)
{
(this.DataContext as AITRfSettingDialogViewModel).SetPower();
}
}
catch (Exception ex)
{
LOG.Error(ex.Message);
}
}
}
}
@@ -0,0 +1,108 @@
using System.ComponentModel;
using System.Windows.Input;
using Aitex.Core.Common.DeviceData;
using MECF.Framework.Common.OperationCenter;
using MECF.Framework.UI.Client.CenterViews.Editors;
using OpenSEMI.ClientBase;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
public class AITRfSettingDialogViewModel : DialogViewModel<string>, INotifyPropertyChanged
{
public AITRfSettingDialogViewModel(string dialogName = "")
{
this.DisplayName = dialogName;
}
private AITRfData _data;
public AITRfData DeviceData
{
get
{
return _data;
}
set
{
_data = value;
NotifyOfPropertyChange(nameof(DeviceData));
}
}
private string _setPoint;
public string InputSetPoint
{
get { return _setPoint; }
set
{
_setPoint = value;
NotifyOfPropertyChange(nameof(InputSetPoint));
}
}
private bool _enableOk;
public bool IsEnableOk
{
get
{
return _enableOk;
}
set
{
_enableOk = value;
NotifyOfPropertyChange(nameof(IsEnableOk));
}
}
public bool IsEnablePowerOn
{
get
{
return DeviceData != null && !DeviceData.IsRfOn;
}
}
public bool IsEnablePowerOff
{
get
{
return DeviceData != null && DeviceData.IsRfOn;
}
}
public void Cancel()
{
IsCancel = true;
TryClose(false);
}
protected override void OnViewLoaded(object view)
{
base.OnViewLoaded(view);
}
public void SetPower()
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPower}", InputSetPoint);
}
public void SetPowerOn()
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPowerOnOff}", "true");
}
public void SetPowerOff()
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPowerOnOff}", "false");
}
}
}
@@ -0,0 +1,96 @@
<Window x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.AITThrottleValveInputDialogBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:Aitex.Core.UI.Control;assembly=MECF.Framework.UI.Core"
xmlns:converters="clr-namespace:Aitex.Core.UI.Converters;assembly=MECF.Framework.UI.Core"
Height="265" Width="280" MaxHeight="265" MinHeight="265" MaxWidth="300" MinWidth="300" WindowStyle="ToolWindow"
WindowStartupLocation="CenterOwner"
KeyDown="OnEnterKeyIsHit"
Title="{Binding Path=DeviceId, StringFormat={}{0} SetPoint}">
<Window.Resources>
<Style TargetType="Button">
<Setter Property="FontSize" Value="12" />
<Setter Property="Height" Value="23" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Width" Value="50" />
</Style>
<Style TargetType="Label">
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="FontSize" Value="13" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Height" Value="25" />
</Style>
<Style x:Key="textBoxInError" TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
</Style>
<my:DoubleConverter x:Key="doubleConverter"/>
<converters:BoolToValueConverter x:Key="BoolToValueConverter"/>
</Window.Resources>
<Grid>
<Grid.Resources>
<Style TargetType="RadioButton"/>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="1" Content="Device Name:" />
<Label Grid.Row="1" Grid.Column="1" Content="Work Mode:" />
<Label Grid.Row="2" Grid.Column="1" Content="Max:" />
<Label Grid.Row="3" Grid.Column="1" Content="Unit:" />
<Label Grid.Row="4" Grid.Column="1" Content="Feedback:" />
<Label Grid.Row="5" Grid.Column="1" Content="Set Point:" />
<Label Grid.Row="0" Grid.Column="2" Content="{Binding Path=DeviceName}" Width="150" Height="28" HorizontalAlignment="Left" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" VerticalContentAlignment="Center" />
<Label Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="12" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" >
<StackPanel Orientation="Horizontal">
<CheckBox x:Name="ckPosition" Checked="CkPosition_OnChecked" ButtonBase.Click="CkPosition_OnClick" VerticalContentAlignment="Center">Position</CheckBox>
<CheckBox x:Name="ckPressure" Checked="CkPressure_OnChecked" ButtonBase.Click="CkPressure_OnClick" Margin="10,0,0,0" VerticalContentAlignment="Center">Pressure</CheckBox>
</StackPanel>
</Label>
<Label Grid.Row="2" Grid.Column="2" Content="{Binding Path=MaxValuePosition}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPosition, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<Label Grid.Row="2" Grid.Column="2" Content="{Binding Path=MaxValuePressure}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPressure, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<Label Grid.Row="3" Grid.Column="2" Content="{Binding Path=UnitPosition}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPosition, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<Label Grid.Row="3" Grid.Column="2" Content="{Binding Path=UnitPressure}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPressure, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<Label Grid.Row="4" Grid.Column="2" Content="{Binding Path=FeedbackPosition}" ContentStringFormat="F1" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPosition, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<Label Grid.Row="4" Grid.Column="2" Content="{Binding Path=FeedbackPressure}" ContentStringFormat="F1" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPressure, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<TextBox Grid.Row="5" Grid.Column="2" x:Name="inputBoxPosition" BorderBrush="Green" BorderThickness="0,0,0,1" Style="{StaticResource textBoxInError}" Padding="3,0,0,0"
TextChanged="InputTextBoxPosition_TextChanged" Width="150" HorizontalAlignment="Left" FontSize="13" FontFamily="Arial,SimSun" Height="30" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPosition, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<TextBox Grid.Row="5" Grid.Column="2" x:Name="inputBoxPressure" BorderBrush="Green" BorderThickness="0,0,0,1" Style="{StaticResource textBoxInError}" Padding="3,0,0,0"
TextChanged="InputTextBoxPressure_TextChanged" Width="150" HorizontalAlignment="Left" FontSize="13" FontFamily="Arial,SimSun" Height="30" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPressure, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<Button Grid.Row="6" Grid.ColumnSpan="2" Content="Set" x:Name="buttonSet" Click="ButtonSet_Click" Width="80" Height="26" VerticalAlignment="Top" Grid.Column="1" Margin="5,3,0,0" />
<Button Grid.Row="6" Grid.Column="2" Content="Cancel" Click="ButtonCancel_Click" Width="80" Height="26" VerticalAlignment="Top" Margin="44,3,0,0" />
</Grid>
</Window>
@@ -0,0 +1,358 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Aitex.Core.Common.DeviceData;
using Aitex.Core.RT.Log;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// Interaction logic for InputDialogBox.xaml
/// </summary>
public partial class AITThrottleValveInputDialogBox : Window
{
public AITThrottleValveInputDialogBox()
{
InitializeComponent();
DataContext = this;
WindowStartupLocation = WindowStartupLocation.CenterOwner;
}
public void FocasAll()
{
inputBoxPosition.Text = Math.Round(SetPointPosition, 2).ToString();
if (IsPositionMode)
{
inputBoxPosition.Focus();
inputBoxPosition.SelectAll();
}
inputBoxPressure.Text = Math.Round(SetPointPressure, 2).ToString();
if (IsPressureMode)
{
inputBoxPressure.Focus();
inputBoxPressure.SelectAll();
}
}
/// <summary>
/// Vilidate input range
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void InputTextBoxPosition_TextChanged(object sender, TextChangedEventArgs e)
{
double input;
if (!double.TryParse(inputBoxPosition.Text, out input)) buttonSet.IsEnabled = false;
else if (input < 0 || input > MaxValuePosition) buttonSet.IsEnabled = false;
else buttonSet.IsEnabled = true;
inputBoxPosition.Foreground = buttonSet.IsEnabled ?
System.Windows.Media.Brushes.Black : System.Windows.Media.Brushes.Red;
}
private void InputTextBoxPressure_TextChanged(object sender, TextChangedEventArgs e)
{
double input;
if (!double.TryParse(inputBoxPressure.Text, out input)) buttonSet.IsEnabled = false;
else if (input < 0 || input > MaxValuePressure) buttonSet.IsEnabled = false;
else buttonSet.IsEnabled = true;
inputBoxPressure.Foreground = buttonSet.IsEnabled ?
System.Windows.Media.Brushes.Black : System.Windows.Media.Brushes.Red;
}
public static readonly DependencyProperty DeviceNameProperty = DependencyProperty.Register(
"DeviceName", typeof(string), typeof(AITThrottleValveInputDialogBox),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty DeviceIdProperty = DependencyProperty.Register(
"DeviceId", typeof(string), typeof(AITThrottleValveInputDialogBox),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty MaxValuePositionProperty = DependencyProperty.Register(
"MaxValuePosition", typeof(double), typeof(AITThrottleValveInputDialogBox),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty MaxValuePressureProperty = DependencyProperty.Register(
"MaxValuePressure", typeof(double), typeof(AITThrottleValveInputDialogBox),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty UnitPositionProperty = DependencyProperty.Register(
"UnitPosition", typeof(string), typeof(AITThrottleValveInputDialogBox),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty UnitPressureProperty = DependencyProperty.Register(
"UnitPressure", typeof(string), typeof(AITThrottleValveInputDialogBox),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty SetPointPositionProperty = DependencyProperty.Register(
"SetPointPosition", typeof(double), typeof(AITThrottleValveInputDialogBox),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty SetPointPressureProperty = DependencyProperty.Register(
"SetPointPressure", typeof(double), typeof(AITThrottleValveInputDialogBox),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty FeedbackPositionProperty = DependencyProperty.Register(
"FeedbackPosition", typeof(double), typeof(AITThrottleValveInputDialogBox),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty FeedbackPressureProperty = DependencyProperty.Register(
"FeedbackPressure", typeof(double), typeof(AITThrottleValveInputDialogBox),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty IsPositionModeProperty = DependencyProperty.Register(
"IsPositionMode", typeof(bool), typeof(AITThrottleValveInputDialogBox),
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty IsPressureModeProperty = DependencyProperty.Register(
"IsPressureMode", typeof(bool), typeof(AITThrottleValveInputDialogBox),
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
/// <summary>
/// 是否百分比显示
/// </summary>
public bool IsPercent { get; set; }
public string DeviceName
{
get
{
return (string)this.GetValue(DeviceNameProperty);
}
set
{
if (!string.IsNullOrEmpty(value) && !value.StartsWith("_"))
value = "_" + value;
this.SetValue(DeviceNameProperty, value);
}
}
public string DeviceId
{
get
{
return (string)this.GetValue(DeviceIdProperty);
}
set
{
this.SetValue(DeviceIdProperty, value);
}
}
public double MaxValuePosition
{
get
{
return (double)this.GetValue(MaxValuePositionProperty);
}
set
{
this.SetValue(MaxValuePositionProperty, value);
}
}
public double MaxValuePressure
{
get
{
return (double)this.GetValue(MaxValuePressureProperty);
}
set
{
this.SetValue(MaxValuePressureProperty, value);
}
}
public string UnitPosition
{
get
{
return (string)this.GetValue(UnitPositionProperty);
}
set
{
this.SetValue(UnitPositionProperty, value);
}
}
public string UnitPressure
{
get
{
return (string)this.GetValue(UnitPressureProperty);
}
set
{
this.SetValue(UnitPressureProperty, value);
}
}
public double SetPointPosition
{
get
{
return (double)this.GetValue(SetPointPositionProperty);
}
set
{
this.SetValue(SetPointPositionProperty, value);
}
}
public double SetPointPressure
{
get
{
return (double)this.GetValue(SetPointPressureProperty);
}
set
{
this.SetValue(SetPointPressureProperty, value);
}
}
public double FeedbackPosition
{
get
{
return (double)this.GetValue(FeedbackPositionProperty);
}
set
{
this.SetValue(FeedbackPositionProperty, value);
}
}
public double FeedbackPressure
{
get
{
return (double)this.GetValue(FeedbackPressureProperty);
}
set
{
this.SetValue(FeedbackPressureProperty, value);
}
}
public bool IsPositionMode
{
get
{
return (bool)this.GetValue(IsPositionModeProperty);
}
set
{
this.SetValue(IsPositionModeProperty, value);
ckPosition.IsChecked = IsPositionMode;
}
}
public bool IsPressureMode
{
get
{
return (bool)this.GetValue(IsPressureModeProperty);
}
set
{
this.SetValue(IsPressureModeProperty, value);
ckPressure.IsChecked = IsPressureMode;
}
}
public Action<PressureCtrlMode> SetThrottleModeCommandDelegate;
public Action<double> SetPositionCommandDelegate;
public Action<double> SetPressureCommandDelegate;
private void ButtonSet_Click(object sender, RoutedEventArgs e)
{
if (IsPressureMode)
SetPressureCommandDelegate(Convert.ToDouble(inputBoxPressure.Text));
else if (IsPositionMode)
SetPositionCommandDelegate(Convert.ToDouble(inputBoxPosition.Text));
//Close();
}
private void OnEnterKeyIsHit(object sender, KeyEventArgs e)
{
try
{
if (!buttonSet.IsEnabled) return;
if (e.Key == Key.Return)
{
ButtonSet_Click(null, null);
}
}
catch (Exception ex)
{
LOG.Error(ex.Message);
}
}
private void ButtonCancel_Click(object sender, RoutedEventArgs e)
{
Close();
}
private void CkPosition_OnChecked(object sender, RoutedEventArgs e)
{
if (IsPositionMode)
return;
ckPosition.IsChecked = false;
try
{
if (SetThrottleModeCommandDelegate != null)
{
SetThrottleModeCommandDelegate(PressureCtrlMode.TVPositionCtrl);
}
}
catch (Exception ex)
{
LOG.Error(ex.Message);
}
}
private void CkPressure_OnChecked(object sender, RoutedEventArgs e)
{
if (IsPressureMode)
return;
ckPressure.IsChecked = false;
try
{
if (SetThrottleModeCommandDelegate != null)
{
SetThrottleModeCommandDelegate(PressureCtrlMode.TVPressureCtrl);
}
}
catch (Exception ex)
{
LOG.Error(ex.Message);
}
}
private void CkPosition_OnClick(object sender, RoutedEventArgs e)
{
ckPosition.IsChecked = IsPositionMode;
}
private void CkPressure_OnClick(object sender, RoutedEventArgs e)
{
ckPressure.IsChecked = IsPressureMode;
}
}
}
@@ -0,0 +1,62 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.CassetteTopView"
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"
mc:Ignorable="d"
d:DesignHeight="80" d:DesignWidth="70">
<Viewbox>
<Viewbox.ContextMenu>
<ContextMenu>
<MenuItem Header="Create Cassette" Command="{Binding CreateCassetteCommand}" CommandParameter="{Binding PlacementTarget.Parent.CarrierModule, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}}}" />
<MenuItem Header="Delete Cassette" Command="{Binding DeleteCassetteCommand}" CommandParameter="{Binding PlacementTarget.Parent.CarrierModule, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}}}" />
</ContextMenu>
</Viewbox.ContextMenu>
<Grid Background="Transparent">
<Grid.Resources>
<Style TargetType="Grid">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Border.BorderBrush" Value="DarkGray"/>
<Setter Property="Background" Value="DarkGray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Border.BorderBrush" Value="Transparent"/>
</Trigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<Image x:Name="VerticalImage">
<Image.Resources>
<Style TargetType="Image" >
<Style.Triggers>
<DataTrigger Binding="{Binding CarrierData.HasWaferIn, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
Value="true">
<Setter Property="Source" Value="pack://application:,,,/MECF.Framework.UI.Client;component/Resources/Images/units/CassetteTopviewWithWafer.png" />
</DataTrigger>
<DataTrigger Binding="{Binding CarrierData.HasWaferIn, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
Value="false">
<Setter Property="Source" Value="pack://application:,,,/MECF.Framework.UI.Client;component/Resources/Images/units/CassetteTopViewNoWafer.png" />
</DataTrigger>
<DataTrigger Binding="{Binding CarrierData.Status, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
Value="Normal">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding CarrierData.Status, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
Value="Empty">
<Setter Property="Visibility" Value="Hidden" />
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Resources>
</Image>
</Grid>
</Viewbox>
</UserControl>
@@ -0,0 +1,81 @@
using MECF.Framework.UI.Client.Annotations;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using MECF.Framework.Common.SubstrateTrackings;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// CassetteTopView.xaml 的交互逻辑
/// </summary>
public partial class CassetteTopView : UserControl, INotifyPropertyChanged
{
public string CarrierModule
{
get { return (string)GetValue(CarrierModuleProperty); }
set
{
SetValue(CarrierModuleProperty, value);
}
}
public static readonly DependencyProperty CarrierModuleProperty =
DependencyProperty.Register("CarrierModule", typeof(string), typeof(CassetteTopView), new PropertyMetadata("System"));
public int CarrierSlot
{
get { return (int)GetValue(CarrierSlotProperty); }
set
{
SetValue(CarrierSlotProperty, value);
}
}
public static readonly DependencyProperty CarrierSlotProperty =
DependencyProperty.Register("CarrierSlot", typeof(int), typeof(CassetteTopView), new PropertyMetadata(0));
public CarrierInfo CarrierData
{
get { return (CarrierInfo)GetValue(CarrierDataProperty); }
set
{
SetValue(CarrierDataProperty, value);
}
}
public static readonly DependencyProperty CarrierDataProperty =
DependencyProperty.Register("CarrierData", typeof(CarrierInfo), typeof(CassetteTopView), new PropertyMetadata(new CarrierInfo(1)));
public CassetteTopView()
{
InitializeComponent();
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
static void PropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
}
}
}
@@ -0,0 +1,22 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.ChillerControl"
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:converters="clr-namespace:Aitex.Core.UI.Converters;assembly=MECF.Framework.UI.Core"
mc:Ignorable="d" x:Name="Self" >
<UserControl.Resources>
<converters:bool2VisibilityConverter x:Key="Bool2VisibilityConvert"/>
</UserControl.Resources>
<Viewbox>
<Image x:Name="imagePicture" Source="pack://application:,,,/MECF.Framework.UI.Client;component/Resources/Images/units/chiller_right_off.png" >
<Image.ContextMenu>
<ContextMenu Visibility="{Binding ElementName=Self, Path=EnableControl,Converter= {StaticResource Bool2VisibilityConvert}, Mode=OneWay}">
<MenuItem Header="Chiller On" IsEnabled="{Binding ElementName=Self, Path=EnableControl,Mode=OneWay}" Click="ChillerOn"/>
<MenuItem Header="Chiller Off" IsEnabled="{Binding ElementName=Self, Path=EnableControl,Mode=OneWay}" Click="ChillerOff" />
</ContextMenu>
</Image.ContextMenu>
</Image>
</Viewbox>
</UserControl>
@@ -0,0 +1,93 @@
using Aitex.Core.Common.DeviceData;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using MECF.Framework.Common.OperationCenter;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// ChillerControl.xaml 的交互逻辑
/// </summary>
public partial class ChillerControl : UserControl
{
public static readonly DependencyProperty DeviceDataProperty = DependencyProperty.Register(
"DeviceData", typeof(AITChillerData), typeof(ChillerControl),
new FrameworkPropertyMetadata(new AITChillerData(), FrameworkPropertyMetadataOptions.AffectsRender));
public AITChillerData DeviceData
{
get
{
return (AITChillerData)this.GetValue(DeviceDataProperty);
}
set
{
this.SetValue(DeviceDataProperty, value);
}
}
public static readonly DependencyProperty EnableControlProperty = DependencyProperty.Register(
"EnableControl", typeof(bool), typeof(ChillerControl),
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
public bool EnableControl
{
get
{
return (bool)this.GetValue(EnableControlProperty);
}
set
{
this.SetValue(EnableControlProperty, value);
}
}
public ChillerControl()
{
InitializeComponent();
}
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
if (DeviceData == null)
return;
if (DeviceData.IsError)
imagePicture.Source = new BitmapImage(new Uri("pack://application:,,,/MECF.Framework.UI.Client;component/Resources/Images/units/chiller_right_error.png"));
else if (DeviceData.IsRunning)
imagePicture.Source = new BitmapImage(new Uri("pack://application:,,,/MECF.Framework.UI.Client;component/Resources/Images/units/chiller_right_on.png"));
else
imagePicture.Source = new BitmapImage(new Uri("pack://application:,,,/MECF.Framework.UI.Client;component/Resources/Images/units/chiller_right_off.png"));
if (imagePicture.ContextMenu != null && imagePicture.ContextMenu.Items.Count == 2)
{
((MenuItem)imagePicture.ContextMenu.Items[0]).IsEnabled = !DeviceData.IsRunning;
((MenuItem)imagePicture.ContextMenu.Items[1]).IsEnabled = DeviceData.IsRunning;
}
}
private void ChillerOn(object sender, RoutedEventArgs e)
{
if (EnableControl)
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITChillerOperation.ChillerOn}");
}
}
private void ChillerOff(object sender, RoutedEventArgs e)
{
if (EnableControl)
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITChillerOperation.ChillerOff}");
}
}
}
}
@@ -0,0 +1,58 @@
<UserControl
x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.Door"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="20"
d:DesignWidth="100"
mc:Ignorable="d">
<UserControl.Resources>
<Storyboard x:Key="Door_Open">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)">
<EasingDoubleKeyFrame KeyTime="0" Value="55" />
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="15" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="Door_Close">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)">
<EasingDoubleKeyFrame KeyTime="0" Value="15" />
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="55" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Style x:Key="Door_Animation" TargetType="{x:Type Rectangle}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsDoorOpen, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" Value="true">
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Door_Open}" />
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource Door_Close}" />
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Rectangle
x:Name="Door_Left"
Width="55"
HorizontalAlignment="Left"
Fill="DimGray"
Style="{StaticResource Door_Animation}" />
<Rectangle
x:Name="Door_Right"
Grid.Column="1"
Width="55"
HorizontalAlignment="Right"
Fill="DimGray"
Style="{StaticResource Door_Animation}" />
</Grid>
</UserControl>
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// Door.xaml 的交互逻辑
/// </summary>
public partial class Door : UserControl
{
public bool IsDoorOpen
{
get { return (bool)GetValue(IsDoorOpenProperty); }
set { SetValue(IsDoorOpenProperty, value); }
}
public static readonly DependencyProperty IsDoorOpenProperty =
DependencyProperty.Register("IsDoorOpen", typeof(bool), typeof(Door), new FrameworkPropertyMetadata(false));
public Door()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,187 @@
<UserControl
x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.FOUPFrontView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
xmlns:converter="clr-namespace:MECF.Framework.UI.Client.Ctrlib.Converter"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:micro="clr-namespace:Caliburn.Micro"
xmlns:lex="http://wpflocalizeextension.codeplex.com"
lex:LocalizeDictionary.DesignCulture="zh"
lex:ResxLocalizationProvider.DefaultAssembly="Sicentury.Localization"
lex:ResxLocalizationProvider.DefaultDictionary="lang_terms"
mc:Ignorable="d">
<UserControl.Resources>
<converter:FOUPStatusConverter x:Key="FOUPStatusConverter" />
<converter:WaferTrayStatusConvert x:Key="WaferTrayStatusConvert" />
</UserControl.Resources>
<Grid>
<StackPanel>
<TextBlock
Width="110"
Height="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="Arial"
FontSize="14"
Foreground="Black"
Text="{lex:Loc {Binding UnitData.ModuleID, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}}"
TextAlignment="Center"
TextWrapping="Wrap" />
<Border
Width="130"
Margin="0,5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{DynamicResource FOUP_OuterBG}"
BorderBrush="{DynamicResource FOUP_OuterBD}"
BorderThickness="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="31*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Rectangle Margin="5,5,11,5" Fill="{DynamicResource FOUP_InnerBG}" />
<Rectangle Margin="8,8,14,8" Fill="{DynamicResource FOUP_InnerGrow}">
<Rectangle.Effect>
<BlurEffect Radius="15" />
</Rectangle.Effect>
</Rectangle>
<Grid Grid.ColumnSpan="2" Margin="5,10,0,10">
<Grid.RowDefinitions>
<RowDefinition Height="0" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="15" />
</Grid.ColumnDefinitions>
<!--<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="Arial"
FontSize="12"
Text="{Binding UnitData.Status, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Converter={StaticResource FOUPStatusConverter}}"
TextAlignment="Center"
TextWrapping="Wrap" />-->
</Grid>
<StackPanel Grid.Row="1" VerticalAlignment="Top">
<ListBox
ItemContainerStyle="{DynamicResource NoSelection_ListBoxItem}"
ItemsSource="{Binding UnitData.WaferManager.Wafers, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Height="24">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="108" />
<ColumnDefinition Width="15" />
</Grid.ColumnDefinitions>
<Rectangle
Width="30"
Height="4"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Fill="{DynamicResource FOUP_PathBG}">
<Rectangle.Effect>
<DropShadowEffect
BlurRadius="0"
Direction="270"
ShadowDepth="1" />
</Rectangle.Effect>
</Rectangle>
<Rectangle
Width="30"
Height="4"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Fill="{DynamicResource FOUP_PathBG}">
<Rectangle.Effect>
<DropShadowEffect
BlurRadius="0"
Direction="270"
ShadowDepth="1" />
</Rectangle.Effect>
</Rectangle>
<controls:Slot
Margin="0,9,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
LotID="{Binding LotID}"
ModuleID="{Binding ModuleID}"
RecipeName="{Binding RecipeName}"
TrayBelongTo="{Binding TrayBelongTo}"
SlotID="{Binding SlotID}"
SourceName="{Binding SourceName}"
ToolTip="{Binding ToolTip}"
ToolTipService.ShowOnDisabled="True"
TrayProcessCount="{Binding TrayProcessCount}"
TrayStatus="{Binding TrayStatus}"
ViewType="Front">
<controls:Slot.WaferStatus>
<MultiBinding Converter="{StaticResource WaferTrayStatusConvert}">
<Binding Path="WaferStatus" />
<Binding Path="TrayStatus" />
</MultiBinding>
</controls:Slot.WaferStatus>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SlotMouseButtonDown">
<micro:ActionMessage MethodName="OnMouseUp">
<micro:Parameter Value="$source" />
<micro:Parameter Value="$eventargs" />
</micro:ActionMessage>
</i:EventTrigger>
<i:EventTrigger EventName="WaferTransferStarted">
<micro:ActionMessage MethodName="OnWaferTransfer">
<micro:Parameter Value="$eventargs" />
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</controls:Slot>
<TextBlock
x:Name="Foup_Text"
Grid.Column="1"
Width="13"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Background="#FF646464"
FontFamily="Arial"
FontSize="10"
Foreground="White"
Text="{Binding SlotIndex}"
TextAlignment="Center"
TextWrapping="Wrap" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Foup_Text" Property="Foreground" Value="White" />
<Setter TargetName="Foup_Text" Property="FontWeight" Value="Bold" />
<Setter TargetName="Foup_Text" Property="FontSize" Value="11" />
<Setter TargetName="Foup_Text" Property="Background" Value="Green" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>
</Grid>
</Border>
<StackPanel.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding UnitData.IsInstalled, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" Value="False">
<Setter Property="StackPanel.Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
</StackPanel>
</Grid>
</UserControl>
@@ -0,0 +1,36 @@
using System;
using System.Windows;
using System.Windows.Controls;
using MECF.Framework.UI.Client.ClientBase;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// Interaction logic for FOUPFrontView.xaml
/// </summary>
public partial class FOUPFrontView : UserControl
{
public FOUPFrontView()
{
InitializeComponent();
}
#region UnitData (DependencyProperty)
public ModuleInfo UnitData
{
get { return (ModuleInfo)GetValue(UnitDataProperty); }
set { SetValue(UnitDataProperty, value); }
}
public static readonly DependencyProperty UnitDataProperty =
DependencyProperty.Register("UnitData", typeof(ModuleInfo), typeof(FOUPFrontView), new UIPropertyMetadata(null));
public bool ShowTitle
{
get { return (bool)GetValue(ShowTitleProperty); }
set { SetValue(ShowTitleProperty, value); }
}
public static readonly DependencyProperty ShowTitleProperty =
DependencyProperty.Register("ShowTitle", typeof(bool), typeof(FOUPFrontView), new UIPropertyMetadata(true));
#endregion
}
}
@@ -0,0 +1,176 @@
<UserControl
x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.FOUPFrontViewPro"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
xmlns:converter="clr-namespace:MECF.Framework.UI.Client.Ctrlib.Converter"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:micro="clr-namespace:Caliburn.Micro"
mc:Ignorable="d">
<UserControl.Resources>
<converter:FOUPStatusConverter x:Key="FOUPStatusConverter" />
<converter:WaferStatusConverter x:Key="WaferStatusConverter" />
</UserControl.Resources>
<Grid>
<StackPanel>
<TextBlock
Width="110"
Height="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="Arial"
FontSize="14"
Foreground="Black"
Text="{Binding UnitData.ModuleID, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
TextAlignment="Center"
TextWrapping="Wrap" />
<Border
Width="310"
Margin="0,5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{DynamicResource FOUP_OuterBG}"
BorderBrush="{DynamicResource FOUP_OuterBD}"
BorderThickness="1">
<Grid>
<Rectangle Margin="5,5,5,5" Fill="{DynamicResource FOUP_InnerBG}" />
<Rectangle Margin="8,8,18,8" Fill="{DynamicResource FOUP_InnerGrow}">
<Rectangle.Effect>
<BlurEffect Radius="15" />
</Rectangle.Effect>
</Rectangle>
<Grid Margin="5,10,0,10">
<Grid.RowDefinitions>
<RowDefinition Height="0" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="15" />
</Grid.ColumnDefinitions>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="Arial"
FontSize="12"
Text="{Binding UnitData.Status, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Converter={StaticResource FOUPStatusConverter}}"
TextAlignment="Center"
TextWrapping="Wrap" />
</Grid>
<StackPanel Grid.Row="1" VerticalAlignment="Top">
<ListBox
ItemContainerStyle="{DynamicResource NoSelection_ListBoxItem}"
ItemsSource="{Binding UnitData.WaferManager.Wafers, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Height="24">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25" />
<ColumnDefinition Width="250" />
<ColumnDefinition Width="15" />
</Grid.ColumnDefinitions>
<CheckBox
HorizontalAlignment="Center"
IsChecked="{Binding IsChecked}"
IsEnabled="{Binding WaferStatus, Converter={StaticResource WaferStatusConverter}}" />
<Rectangle
Grid.Column="1"
Width="30"
Height="4"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Fill="{DynamicResource FOUP_PathBG}">
<Rectangle.Effect>
<DropShadowEffect
BlurRadius="0"
Direction="270"
ShadowDepth="1" />
</Rectangle.Effect>
</Rectangle>
<Rectangle
Grid.Column="1"
Width="30"
Height="4"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Fill="{DynamicResource FOUP_PathBG}">
<Rectangle.Effect>
<DropShadowEffect
BlurRadius="0"
Direction="270"
ShadowDepth="1" />
</Rectangle.Effect>
</Rectangle>
<controls:Slot
x:Name="SlotCls"
Grid.Column="1"
Margin="0,9,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
ModuleID="{Binding ModuleID}"
SlotID="{Binding SlotID}"
SourceName="{Binding SourceName}"
ViewType="Front"
WaferStatus="{Binding WaferStatus}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SlotMouseButtonDown">
<micro:ActionMessage MethodName="OnMouseUp">
<micro:Parameter Value="$source" />
<micro:Parameter Value="$eventargs" />
</micro:ActionMessage>
</i:EventTrigger>
<i:EventTrigger EventName="WaferTransferStarted">
<micro:ActionMessage MethodName="OnWaferTransfer">
<micro:Parameter Value="$eventargs" />
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</controls:Slot>
<TextBlock
x:Name="Foup_Text"
Grid.Column="2"
Width="13"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Background="#FF646464"
FontFamily="Arial"
FontSize="10"
Foreground="White"
Text="{Binding SlotIndex}"
TextAlignment="Center"
TextWrapping="Wrap" />
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Foup_Text" Property="Foreground" Value="White" />
<Setter TargetName="Foup_Text" Property="FontWeight" Value="Bold" />
<Setter TargetName="Foup_Text" Property="FontSize" Value="11" />
<Setter TargetName="Foup_Text" Property="Background" Value="Green" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>
</Grid>
</Border>
<StackPanel.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding UnitData.IsInstalled, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" Value="False">
<Setter Property="StackPanel.Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
</StackPanel>
</Grid>
</UserControl>
@@ -0,0 +1,46 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
using MECF.Framework.UI.Client.ClientBase;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// Interaction logic for FOUPFrontViewPro.xaml
/// </summary>
public partial class FOUPFrontViewPro : UserControl
{
public FOUPFrontViewPro()
{
InitializeComponent();
}
#region UnitData (DependencyProperty)
public ModuleInfo UnitData
{
get { return (ModuleInfo)GetValue(UnitDataProperty); }
set { SetValue(UnitDataProperty, value); }
}
public static readonly DependencyProperty UnitDataProperty =
DependencyProperty.Register("UnitData", typeof(ModuleInfo), typeof(FOUPFrontViewPro), new UIPropertyMetadata(null));
public bool ShowTitle
{
get { return (bool)GetValue(ShowTitleProperty); }
set { SetValue(ShowTitleProperty, value); }
}
public static readonly DependencyProperty ShowTitleProperty =
DependencyProperty.Register("ShowTitle", typeof(bool), typeof(FOUPFrontViewPro), new UIPropertyMetadata(true));
#endregion
}
}
@@ -0,0 +1,130 @@
<UserControl x:Class="LeadUI.Client.Models.Controls.FOUPTopView2"
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"
mc:Ignorable="d">
<UserControl.Resources>
<Storyboard x:Key="FOUPDoor_Close">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" >
<EasingDoubleKeyFrame KeyTime="0" Value="10"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="43.5"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="FOUPDoor_Open">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)">
<EasingDoubleKeyFrame KeyTime="0" Value="43.5"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="10"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="body_up">
<ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" >
<EasingThicknessKeyFrame KeyTime="0" Value="2,10,2,0"/>
<EasingThicknessKeyFrame KeyTime="0:0:0.2" Value="2,0,2,0"/>
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="body_down">
<ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)">
<EasingThicknessKeyFrame KeyTime="0" Value="2,0,2,0"/>
<EasingThicknessKeyFrame KeyTime="0:0:0.2" Value="2,10,2,0"/>
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
<Style TargetType="{x:Type Rectangle}" x:Key="Door_Animation" >
<Style.Triggers>
<DataTrigger Binding="{Binding DoorState}" Value="Open">
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource FOUPDoor_Open}"/>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource FOUPDoor_Close}"/>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid x:Name="root" Width="85" Height="100">
<Border BorderBrush="Black" BorderThickness="1" CornerRadius="0,0,5,5">
<Border BorderThickness="1,0,1,1" Margin="4,-1,4,4" CornerRadius="0,0,4,4" Background="#FFB4B4B4" BorderBrush="#FF7C7C7C">
<Grid x:Name="FOUP_Body" >
<Grid.Style>
<Style>
<Setter Property="Grid.Visibility" Value="Collapsed" />
<Style.Triggers>
<DataTrigger Binding="{Binding CassetteState}" Value="Normal">
<Setter Property="Grid.Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
<Grid.ContextMenu>
<ContextMenu>
<MenuItem Header="Home" Click="MenuItem_Click" Tag="LoadportHome" />
<MenuItem Header="Abort" Click="MenuItem_Click" Tag="LoadportAbort" />
<MenuItem Header="Stop" Click="MenuItem_Click" Tag="LoadportStop" />
<Separator />
<MenuItem Header="Clamp" Click="MenuItem_Click" Tag="LoadportClamp" />
<MenuItem Header="Unlamp" Click="MenuItem_Click" Tag="LoadportUnlamp" />
<MenuItem Header="Load" Click="MenuItem_Click" Tag="LoadportLoad" />
<MenuItem Header="Unload" Click="MenuItem_Click" Tag="LoadportUnload" />
<MenuItem Header="Open Door" Click="MenuItem_Click" Tag="LoadportOpenDoor" />
<MenuItem Header="Close Door" Click="MenuItem_Click" Tag="LoadportCloseDoor" />
<MenuItem Header="Dock" Click="MenuItem_Click" Tag="LoadportDock" />
<MenuItem Header="Undock" Click="MenuItem_Click" Tag="LoadportUndock" />
<MenuItem Header="Map" Click="MenuItem_Click" Tag="LoadportMap" />
</ContextMenu>
</Grid.ContextMenu>
<Rectangle Fill="#FFD8D8D8" Margin="4,0,4,4" Stroke="Black" RadiusY="5" RadiusX="5">
<Rectangle.Effect>
<BlurEffect Radius="25"/>
</Rectangle.Effect>
</Rectangle>
<Grid x:Name="FOUP_Body_Inner" Margin="2,10,2,0" VerticalAlignment="Top">
<Rectangle Fill="#FF3484B6" Height="6" VerticalAlignment="Top"/>
<Path Data="M0,0 L65,0 65,53.6665 65,54 64.98787,54 64.957711,54.30118 C64.087258,60.817829 49.88834,66 32.5,66 15.11166,66 0.91274095,60.817829 0.042288512,54.30118 L0.012133257,54 0,54 0,53.6665 z" Fill="#FF72ADCC" Margin="2,5,2,0" VerticalAlignment="Top" Width="65" Height="66" Stroke="#FF4399C6"/>
<Path Data="M0.5,0.5 L34.5,0.5 34.5,63.642655 33.637119,63.844716 C28.89949,64.896935 23.385284,65.5 17.5,65.5 11.614716,65.5 6.1005077,64.896935 1.3628788,63.844716 L0.5,63.642655 z" Fill="#FF7EB8D6" Margin="17,5,17,0" VerticalAlignment="Top" Stroke="#FF4399C6"/>
<Grid.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding DoorState}" Value="Open">
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource body_up}"/>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource body_down}"/>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
</Grid>
<Rectangle Fill="#FFABABAB" HorizontalAlignment="Center" Height="10" Stroke="#FF838383" VerticalAlignment="Bottom" Width="45" RadiusX="1" RadiusY="1" Margin="0,0,0,2"/>
</Grid>
</Border>
<Border.Style>
<Style>
<Setter Property="Border.Background" Value="Gray"/>
</Style>
</Border.Style>
</Border>
<Grid x:Name="FOUP_Door" Height="10" VerticalAlignment="Top" Margin="-1,0">
<Rectangle x:Name="FOUPDoor_Left" Fill="Black" Style="{StaticResource Door_Animation}" HorizontalAlignment="Left" Width="43.5" Height="6" VerticalAlignment="Center"/>
<Rectangle x:Name="FOUPDoor_Right" Fill="Black" Style="{StaticResource Door_Animation}" HorizontalAlignment="Right" Width="43.5" Height="6" VerticalAlignment="Center"/>
<Rectangle HorizontalAlignment="Left" Stroke="#FF434343" Width="10">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<GradientStop Color="#FF4D4D4D" Offset="0"/>
<GradientStop Color="#FFCCCCCC" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle HorizontalAlignment="Right" Stroke="#FF434343" Width="10">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
<GradientStop Color="#FF4D4D4D" Offset="0"/>
<GradientStop Color="#FFCCCCCC" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
</Grid>
</Grid>
</UserControl>
@@ -0,0 +1,94 @@
using Aitex.Sorter.Common;
using MECF.Framework.Common.Equipment;
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
namespace LeadUI.Client.Models.Controls
{
/// <summary>
/// FOUPTopView.xaml 的交互逻辑
/// </summary>
public partial class FOUPTopView2 : UserControl
{
public FOUPTopView2()
{
InitializeComponent();
root.DataContext = this;
}
public string Label
{
get { return (string)GetValue(LabelProperty); }
set { SetValue(LabelProperty, value); }
}
// Using a DependencyProperty as the backing store for Label. This enables animation, styling, binding, etc...
public static readonly DependencyProperty LabelProperty =
DependencyProperty.Register("Label", typeof(string), typeof(FOUPTopView2), new PropertyMetadata(null));
public ICommand Command
{
get { return (ICommand)GetValue(CommandProperty); }
set { SetValue(CommandProperty, value); }
}
// Using a DependencyProperty as the backing store for Command. This enables animation, styling, binding, etc...
public static readonly DependencyProperty CommandProperty =
DependencyProperty.Register("Command", typeof(ICommand), typeof(FOUPTopView2), new PropertyMetadata(null));
public LoadportCassetteState CassetteState
{
get { return (LoadportCassetteState)GetValue(CassetteStateProperty); }
set { SetValue(CassetteStateProperty, value); }
}
// Using a DependencyProperty as the backing store for Present. This enables animation, styling, binding, etc...
public static readonly DependencyProperty CassetteStateProperty =
DependencyProperty.Register("CassetteState", typeof(LoadportCassetteState), typeof(FOUPTopView2), new FrameworkPropertyMetadata(LoadportCassetteState.Unknown));
public FoupDoorState DoorState
{
get { return (FoupDoorState)GetValue(DoorStateProperty); }
set { SetValue(DoorStateProperty, value); }
}
// Using a DependencyProperty as the backing store for Open. This enables animation, styling, binding, etc...
public static readonly DependencyProperty DoorStateProperty =
DependencyProperty.Register("DoorState", typeof(FoupDoorState), typeof(FOUPTopView2), new FrameworkPropertyMetadata(FoupDoorState.Unknown)); //FrameworkPropertyMetadataOptions.AffectsRender
public ModuleName Station
{
get { return (ModuleName)GetValue(StationProperty); }
set { SetValue(StationProperty, value); }
}
// Using a DependencyProperty as the backing store for Station. This enables animation, styling, binding, etc...
public static readonly DependencyProperty StationProperty =
DependencyProperty.Register("Station", typeof(ModuleName), typeof(FOUPTopView2), new PropertyMetadata(ModuleName.System));
private void MenuItem_Click(object sender, RoutedEventArgs e)
{
var cmd = ((MenuItem)sender).Tag;
Command.Execute(new[] { Station.ToString(), cmd });
}
//protected override void OnRender(DrawingContext drawingContext)
//{
// base.OnRender(drawingContext);
// if (DoorState == FoupDoorState.Open)
// {
// // cassette.VerticalAlignment = VerticalAlignment.Top;
// }
// else if (DoorState == FoupDoorState.Close)
// {
// //cassette.VerticalAlignment = VerticalAlignment.Bottom;
// }
//}
}
}
@@ -0,0 +1,62 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.FoupTopView"
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:myCtrl="clr-namespace:MECF.Framework.UI.Client.Ctrlib.UnitControls"
mc:Ignorable="d" Width="73" Height="66"
d:DesignHeight="120" d:DesignWidth="100">
<UserControl.Resources>
<Storyboard x:Key="FoupLoaded">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Canvas.Top)" >
<EasingDoubleKeyFrame KeyTime="0" Value="20"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="FoupUnloaded">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Canvas.Top)" >
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="20"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Style TargetType="{x:Type Image}" x:Key="LP_Animation" >
<Style.Triggers>
<DataTrigger Binding="{Binding IsFoupLoaded, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" Value="true">
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource FoupLoaded}"/>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource FoupUnloaded}"/>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Canvas x:Name="canvas" Width="75" Height="100" >
<Canvas.ContextMenu>
<ContextMenu>
<MenuItem Header="Home" Click="Home"/>
<MenuItem Header="Reset" Click="Reset" />
<MenuItem Header="Abort" Click="Abort" />
<MenuItem Header="Load" Click="Load"/>
<MenuItem Header="Unload" Click="Unload"/>
<MenuItem Header="Read Carrier ID" Click="ReadCarrierID"/>
<MenuItem Header="Clamp" Click="Clamp" />
<MenuItem Header="Unclamp" Click="Unclamp"/>
<MenuItem Header="Dock" Click="Dock" />
<MenuItem Header="Undock" Click="Undock"/>
<MenuItem Header="Open Door" Click="OpenDoor"/>
<MenuItem Header="Close Door" Click="CloseDoor" />
<MenuItem Header="Map" Click="Map"/>
</ContextMenu>
</Canvas.ContextMenu>
<Image Canvas.Top="20" Style="{StaticResource LP_Animation}" Source="pack://application:,,,/MECF.Framework.UI.Client;component/Resources/Images/foupTopView.png" Width="73" Height="66" />
<Canvas.RenderTransform>
<TranslateTransform Y="{Binding CanvasYPosition}">
</TranslateTransform>
</Canvas.RenderTransform>
</Canvas>
</UserControl>
@@ -0,0 +1,208 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using MECF.Framework.Common.CommonData;
using MECF.Framework.Common.OperationCenter;
using MECF.Framework.UI.Client.Annotations;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// Door.xaml 的交互逻辑
/// </summary>
public partial class FoupTopView : UserControl, INotifyPropertyChanged
{
public double CanvasYPosition { get; set; }
public bool _isFoupLoaded;
public bool IsFoupLoaded
{
get { return (bool)GetValue(IsFoupLoadedProperty); }
set
{
SetValue(IsFoupLoadedProperty, value);
CanvasYPosition = value ? -20 : 0;
OnPropertyChanged(nameof(CanvasYPosition));
}
}
public static readonly DependencyProperty IsFoupLoadedProperty =
DependencyProperty.Register("IsFoupLoaded", typeof(bool), typeof(FoupTopView),
new PropertyMetadata(false, PropertyChangedCallback));
public string ModuleName
{
get { return (string)GetValue(ModuleNameProperty); }
set { SetValue(ModuleNameProperty, value); }
}
public static readonly DependencyProperty ModuleNameProperty =
DependencyProperty.Register("ModuleName", typeof(string), typeof(FoupTopView),
new PropertyMetadata("LP1", PropertyChangedCallback));
public Visibility MenuVisibility
{
get { return (Visibility)this.GetValue(MenuVisibilityProperty); }
set { this.SetValue(MenuVisibilityProperty, value); }
}
public static readonly DependencyProperty MenuVisibilityProperty =
DependencyProperty.Register("MenuVisibility", typeof(Visibility), typeof(FoupTopView),
new FrameworkPropertyMetadata(Visibility.Visible, FrameworkPropertyMetadataOptions.AffectsRender));
public LPMenuEnable DeviceData
{
get
{
return (LPMenuEnable)this.GetValue(DeviceDataProperty);
}
set
{
this.SetValue(DeviceDataProperty, value);
}
}
public static readonly DependencyProperty DeviceDataProperty = DependencyProperty.Register(
"DeviceData", typeof(LPMenuEnable), typeof(FoupTopView),
new FrameworkPropertyMetadata(new LPMenuEnable(), FrameworkPropertyMetadataOptions.AffectsRender));
public FoupTopView()
{
InitializeComponent();
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
static void PropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var self = (FoupTopView)d;
switch (e.Property.Name)
{
case "IsFoupLoaded":
self.CanvasYPosition = (bool)e.NewValue ? -30 : 0;
self.OnPropertyChanged(nameof(CanvasYPosition));
break;
default:
self.OnPropertyChanged(nameof(e.Property.Name));
break;
}
}
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
canvas.ContextMenu.Visibility = MenuVisibility;
if (DeviceData == null)
return;
if (MenuVisibility == Visibility.Visible && canvas.ContextMenu.Items != null && canvas.ContextMenu.Items.Count == 13)
{
((MenuItem)canvas.ContextMenu.Items[1]).IsEnabled = DeviceData.IsResetEnable;
((MenuItem)canvas.ContextMenu.Items[2]).IsEnabled = DeviceData.IsAbortEnable;
((MenuItem)canvas.ContextMenu.Items[3]).IsEnabled = DeviceData.IsLoadEnable;
((MenuItem)canvas.ContextMenu.Items[4]).IsEnabled = DeviceData.IsUnloadEnable;
((MenuItem)canvas.ContextMenu.Items[5]).IsEnabled = DeviceData.IsReadCarrierIDEnable;
((MenuItem)canvas.ContextMenu.Items[6]).IsEnabled = DeviceData.IsClampEnable;
((MenuItem)canvas.ContextMenu.Items[7]).IsEnabled = DeviceData.IsUnclampEnable;
((MenuItem)canvas.ContextMenu.Items[8]).IsEnabled = DeviceData.IsDockEnable;
((MenuItem)canvas.ContextMenu.Items[9]).IsEnabled = DeviceData.IsUndockEnable;
((MenuItem)canvas.ContextMenu.Items[10]).IsEnabled = DeviceData.IsOpenEnable;
((MenuItem)canvas.ContextMenu.Items[11]).IsEnabled = DeviceData.IsCloseEnable;
((MenuItem)canvas.ContextMenu.Items[12]).IsEnabled = DeviceData.IsMapEnable;
}
}
private void Home(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Home");
}
private void Reset(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Reset");
}
private void Abort(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Abort");
}
private void ReadCarrierID(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ReadCarrierId");
}
private void Load(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Load");
}
private void Unload(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Unload");
}
private void Clamp(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Clamp");
}
private void Unclamp(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Unclamp");
}
private void Dock(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Dock");
}
private void Undock(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Undock");
}
private void OpenDoor(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.OpenDoor");
}
private void CloseDoor(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.CloseDoor");
}
private void Map(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Map");
}
}
public class LPMenuEnable : NotifiableItem
{
public bool IsResetEnable { get; set; }
public bool IsAbortEnable { get; set; }
public bool IsReadCarrierIDEnable { get; set; }
public bool IsLoadEnable { get; set; }
public bool IsUnloadEnable { get; set; }
public bool IsClampEnable { get; set; }
public bool IsUnclampEnable { get; set; }
public bool IsDockEnable { get; set; }
public bool IsUndockEnable { get; set; }
public bool IsOpenEnable { get; set; }
public bool IsCloseEnable { get; set; }
public bool IsMapEnable { get; set; }
}
}
@@ -0,0 +1,62 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.FoupTopView3"
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:myCtrl="clr-namespace:MECF.Framework.UI.Client.Ctrlib.UnitControls"
mc:Ignorable="d" Width="73" Height="66"
d:DesignHeight="120" d:DesignWidth="100">
<UserControl.Resources>
<Storyboard x:Key="FoupLoaded">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Canvas.Top)" >
<EasingDoubleKeyFrame KeyTime="0" Value="20"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="FoupUnloaded">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Canvas.Top)" >
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="20"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Style TargetType="{x:Type Image}" x:Key="LP_Animation" >
<Style.Triggers>
<DataTrigger Binding="{Binding IsFoupLoaded, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" Value="true">
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource FoupLoaded}"/>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource FoupUnloaded}"/>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Canvas x:Name="canvas" Width="75" Height="100" >
<Canvas.ContextMenu>
<ContextMenu>
<MenuItem Header="Home" Click="Home"/>
<MenuItem Header="Reset" Click="Reset" />
<MenuItem Header="Abort" Click="Abort" />
<MenuItem Header="Load" Click="Load"/>
<MenuItem Header="Unload" Click="Unload"/>
<MenuItem Header="Read Carrier ID" Click="ReadCarrierID"/>
<MenuItem Header="Clamp" Click="Clamp" />
<MenuItem Header="Unclamp" Click="Unclamp"/>
<MenuItem Header="Dock" Click="Dock" />
<MenuItem Header="Undock" Click="Undock"/>
<MenuItem Header="Open Door" Click="OpenDoor"/>
<MenuItem Header="Close Door" Click="CloseDoor" />
<MenuItem Header="Map" Click="Map"/>
</ContextMenu>
</Canvas.ContextMenu>
<Image Style="{StaticResource LP_Animation}" Source="pack://application:,,,/MECF.Framework.UI.Client;component/Resources/Images/foupTopView3.png" Width="79" Height="71" Canvas.Left="-2" Canvas.Top="16"/>
<Canvas.RenderTransform>
<TranslateTransform Y="{Binding CanvasYPosition}">
</TranslateTransform>
</Canvas.RenderTransform>
</Canvas>
</UserControl>
@@ -0,0 +1,192 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using MECF.Framework.Common.CommonData;
using MECF.Framework.Common.OperationCenter;
using MECF.Framework.UI.Client.Annotations;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// Door.xaml 的交互逻辑
/// </summary>
public partial class FoupTopView3 : UserControl, INotifyPropertyChanged
{
public double CanvasYPosition { get; set; }
public bool _isFoupLoaded;
public bool IsFoupLoaded
{
get { return (bool)GetValue(IsFoupLoadedProperty); }
set
{
SetValue(IsFoupLoadedProperty, value);
CanvasYPosition = value ? -20 : 0;
OnPropertyChanged(nameof(CanvasYPosition));
}
}
public static readonly DependencyProperty IsFoupLoadedProperty =
DependencyProperty.Register("IsFoupLoaded", typeof(bool), typeof(FoupTopView3),
new PropertyMetadata(false, PropertyChangedCallback));
public string ModuleName
{
get { return (string)GetValue(ModuleNameProperty); }
set { SetValue(ModuleNameProperty, value); }
}
public static readonly DependencyProperty ModuleNameProperty =
DependencyProperty.Register("ModuleName", typeof(string), typeof(FoupTopView3),
new PropertyMetadata("LP1", PropertyChangedCallback));
public Visibility MenuVisibility
{
get { return (Visibility)this.GetValue(MenuVisibilityProperty); }
set { this.SetValue(MenuVisibilityProperty, value); }
}
public static readonly DependencyProperty MenuVisibilityProperty =
DependencyProperty.Register("MenuVisibility", typeof(Visibility), typeof(FoupTopView3),
new FrameworkPropertyMetadata(Visibility.Visible, FrameworkPropertyMetadataOptions.AffectsRender));
public LPMenuEnable DeviceData
{
get
{
return (LPMenuEnable)this.GetValue(DeviceDataProperty);
}
set
{
this.SetValue(DeviceDataProperty, value);
}
}
public static readonly DependencyProperty DeviceDataProperty = DependencyProperty.Register(
"DeviceData", typeof(LPMenuEnable), typeof(FoupTopView3),
new FrameworkPropertyMetadata(new LPMenuEnable(), FrameworkPropertyMetadataOptions.AffectsRender));
public FoupTopView3()
{
InitializeComponent();
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
static void PropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var self = (FoupTopView3)d;
switch (e.Property.Name)
{
case "IsFoupLoaded":
self.CanvasYPosition = (bool)e.NewValue ? -30 : 0;
self.OnPropertyChanged(nameof(CanvasYPosition));
break;
default:
self.OnPropertyChanged(nameof(e.Property.Name));
break;
}
}
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
canvas.ContextMenu.Visibility = MenuVisibility;
if (DeviceData == null)
return;
if (MenuVisibility == Visibility.Visible && canvas.ContextMenu.Items != null && canvas.ContextMenu.Items.Count == 13)
{
((MenuItem)canvas.ContextMenu.Items[1]).IsEnabled = DeviceData.IsResetEnable;
((MenuItem)canvas.ContextMenu.Items[2]).IsEnabled = DeviceData.IsAbortEnable;
((MenuItem)canvas.ContextMenu.Items[3]).IsEnabled = DeviceData.IsLoadEnable;
((MenuItem)canvas.ContextMenu.Items[4]).IsEnabled = DeviceData.IsUnloadEnable;
((MenuItem)canvas.ContextMenu.Items[5]).IsEnabled = DeviceData.IsReadCarrierIDEnable;
((MenuItem)canvas.ContextMenu.Items[6]).IsEnabled = DeviceData.IsClampEnable;
((MenuItem)canvas.ContextMenu.Items[7]).IsEnabled = DeviceData.IsUnclampEnable;
((MenuItem)canvas.ContextMenu.Items[8]).IsEnabled = DeviceData.IsDockEnable;
((MenuItem)canvas.ContextMenu.Items[9]).IsEnabled = DeviceData.IsUndockEnable;
((MenuItem)canvas.ContextMenu.Items[10]).IsEnabled = DeviceData.IsOpenEnable;
((MenuItem)canvas.ContextMenu.Items[11]).IsEnabled = DeviceData.IsCloseEnable;
((MenuItem)canvas.ContextMenu.Items[12]).IsEnabled = DeviceData.IsMapEnable;
}
}
private void Home(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Home");
}
private void Reset(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Reset");
}
private void Abort(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Abort");
}
private void ReadCarrierID(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ReadCarrierId");
}
private void Load(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Load");
}
private void Unload(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Unload");
}
private void Clamp(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Clamp");
}
private void Unclamp(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Unclamp");
}
private void Dock(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Dock");
}
private void Undock(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Undock");
}
private void OpenDoor(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.OpenDoor");
}
private void CloseDoor(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.CloseDoor");
}
private void Map(object sender, RoutedEventArgs e)
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.Map");
}
}
}
@@ -0,0 +1,65 @@
<Window x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.InputDialogBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:MECF.Framework.UI.Client.Ctrlib.UnitControls"
Height="265" Width="260" MaxHeight="265" MinHeight="265" MaxWidth="300" MinWidth="300" WindowStyle="ToolWindow"
WindowStartupLocation="CenterOwner"
KeyDown="OnEnterKeyIsHit"
Title="{Binding DeviceTitle}">
<Window.Resources>
<Style TargetType="Button">
<Setter Property="FontSize" Value="12" />
<Setter Property="Height" Value="23" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Width" Value="50" />
</Style>
<Style TargetType="Label">
<Setter Property="FontFamily" Value="Arial,SimSun" />
<Setter Property="FontSize" Value="13" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Height" Value="25" />
</Style>
<Style x:Key="textBoxInError" TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
</Style>
<my:DoubleConverter x:Key="doubleConverter"/>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="1" Content="DeviceName" />
<Label Grid.Row="1" Grid.Column="1" Content="Unit" />
<Label Grid.Row="2" Grid.Column="1" Content="Max" />
<Label Grid.Row="3" Grid.Column="1" Content="Default" />
<Label Grid.Row="4" Grid.Column="1" Content="Feedback" />
<Label Grid.Row="5" Grid.Column="1" Content="SetPoint" />
<Label Grid.Row="0" Grid.Column="2" Content="{Binding Path=DeviceName}" Width="150" Height="28" HorizontalAlignment="Left" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" VerticalContentAlignment="Center" />
<Label Grid.Row="1" Grid.Column="2" Content="{Binding Path=Unit}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<Label Grid.Row="2" Grid.Column="2" Content="{Binding Path=MaxValue}" ContentStringFormat="F1" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<Label Grid.Row="3" Grid.Column="2" Content="{Binding Path=DefaultValue}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<Label Grid.Row="4" Grid.Column="2" Content="{Binding Path=RealValue}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<TextBox Grid.Row="5" Grid.Column="2" x:Name="inputBox" BorderBrush="Green" BorderThickness="0,0,0,1" Style="{StaticResource textBoxInError}" TextChanged="InputTextBox_TextChanged" Width="150" HorizontalAlignment="Left" FontSize="13" FontFamily="Arial,SimSun" Height="30" VerticalContentAlignment="Center" />
<Button Grid.Row="6" Grid.ColumnSpan="2" Content="Set" x:Name="buttonSet" Click="ButtonSet_Click" Width="80" Height="26" VerticalAlignment="Top" Grid.Column="1" Margin="5,3,0,0" />
<Button Grid.Row="6" Grid.Column="2" Content="Cancel" Click="ButtonCancel_Click" Width="80" Height="26" VerticalAlignment="Top" Margin="44,3,0,0" />
</Grid>
</Window>
@@ -0,0 +1,319 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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;
using System.Globalization;
using Aitex.Core.RT.Log;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
public class DoubleConverter : IValueConverter
{
public DoubleConverter()
{
}
// Summary:
// Converts a value.
//
// Parameters:
// value:
// The value produced by the binding source.
//
// targetType:
// The type of the binding target property.
//
// parameter:
// The converter parameter to use.
//
// culture:
// The culture to use in the converter.
//
// Returns:
// A converted value. If the method returns null, the valid null value is used.
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value.ToString();
}
//
// Summary:
// Converts a value.
//
// Parameters:
// value:
// The value that is produced by the binding target.
//
// targetType:
// The type to convert to.
//
// parameter:
// The converter parameter to use.
//
// culture:
// The culture to use in the converter.
//
// Returns:
// A converted value. If the method returns null, the valid null value is used.
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
string input = (string)value;
double result = 0;
if (double.TryParse(input, out result))
{
return result;
}
return DependencyProperty.UnsetValue;
}
}
public class InputDialogValidationRule : ValidationRule
{
double minInput;
double maxInput;
public double MinInput
{
get { return this.minInput; }
set { this.minInput = value; }
}
public double MaxInput
{
get { return this.maxInput; }
set { this.maxInput = value; }
}
public InputDialogValidationRule()
{
}
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
double result;
// Is a number?
if (!double.TryParse((string)value, out result))
{
string msg = string.Format("‘{0}’不是一个数.", value);
return new ValidationResult(false, msg);
}
// Is in range?
if ((result < this.minInput) || (result > this.maxInput))
{
string msg = string.Format("输入值必须在‘{0}’与‘{1}’之间.", this.minInput, this.maxInput);
return new ValidationResult(false, msg);
}
// Number is valid
return new ValidationResult(true, null);
}
}
/// <summary>
/// Interaction logic for InputDialogBox.xaml
/// </summary>
public partial class InputDialogBox : Window
{
public InputDialogBox()
{
InitializeComponent();
DataContext = this;
WindowStartupLocation = WindowStartupLocation.CenterOwner;
}
public void FocasAll()
{
inputBox.Text = Math.Round(SetPoint, 2).ToString();
inputBox.Focus();
inputBox.SelectAll();
}
/// <summary>
/// Vilidate input range
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void InputTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
double input;
if (!double.TryParse(inputBox.Text, out input)) buttonSet.IsEnabled = false;
else if (input < 0 || input > MaxValue) buttonSet.IsEnabled = false;
else buttonSet.IsEnabled = true;
inputBox.Foreground = buttonSet.IsEnabled ?
System.Windows.Media.Brushes.Black : System.Windows.Media.Brushes.Red;
}
public static readonly DependencyProperty DeviceNameProperty = DependencyProperty.Register(
"DeviceName", typeof(string), typeof(InputDialogBox),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty DeviceIdProperty = DependencyProperty.Register(
"DeviceId", typeof(string), typeof(InputDialogBox),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty MaxValueProperty = DependencyProperty.Register(
"MaxValue", typeof(double), typeof(InputDialogBox),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty DefaultValueProperty = DependencyProperty.Register(
"DefaultValue", typeof(double), typeof(InputDialogBox),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty RealValueProperty = DependencyProperty.Register(
"RealValue", typeof(string), typeof(InputDialogBox),
new FrameworkPropertyMetadata("0.0", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty UnitProperty = DependencyProperty.Register(
"Unit", typeof(string), typeof(InputDialogBox),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty SetPointProperty = DependencyProperty.Register(
"SetPoint", typeof(double), typeof(InputDialogBox),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
/// <summary>
/// 是否百分比显示
/// </summary>
public bool IsPercent { get; set; }
public string DeviceName
{
get
{
return (string)this.GetValue(DeviceNameProperty);
}
set
{
if (!string.IsNullOrEmpty(value) && !value.StartsWith("_"))
value = "_" + value;
this.SetValue(DeviceNameProperty, value);
}
}
public string DeviceTitle
{
get
{
return string.Format("{0} {1}", Application.Current.Resources["GlobalLableSetPointTitle"], DeviceId);
}
}
public string DeviceId
{
get
{
return (string)this.GetValue(DeviceIdProperty);
}
set
{
this.SetValue(DeviceIdProperty, value);
}
}
public double MaxValue
{
get
{
return (double)this.GetValue(MaxValueProperty);
}
set
{
this.SetValue(MaxValueProperty, value);
// validationRule.MaxInput = value;
}
}
public double DefaultValue
{
get
{
return (double)this.GetValue(DefaultValueProperty);
}
set
{
this.SetValue(DefaultValueProperty, value);
}
}
public string RealValue
{
get
{
return (string)this.GetValue(RealValueProperty);
}
set
{
this.SetValue(RealValueProperty, value);
}
}
public string Unit
{
get
{
return (string)this.GetValue(UnitProperty);
}
set
{
this.SetValue(UnitProperty, value);
}
}
public double SetPoint
{
get
{
return (double)this.GetValue(SetPointProperty);
}
set
{
this.SetValue(SetPointProperty, value);
}
}
public Action<double> CommandDelegate;
private void ButtonSet_Click(object sender, RoutedEventArgs e)
{
try
{
if (CommandDelegate != null)
{
double setp = Convert.ToDouble(inputBox.Text);
if (IsPercent)
setp = setp / 100.0;
CommandDelegate(setp);
}
//Close();
}
catch (Exception ex)
{
LOG.Error(ex.Message);
}
}
private void OnEnterKeyIsHit(object sender, KeyEventArgs e)
{
try
{
if (!buttonSet.IsEnabled) return;
if (e.Key == Key.Return)
{
ButtonSet_Click(null, null);
}
}
catch (Exception ex)
{
LOG.Error(ex.Message);
}
}
private void ButtonCancel_Click(object sender, RoutedEventArgs e)
{
Close();
}
}
}
@@ -0,0 +1,21 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.MfcControl"
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"
mc:Ignorable="d" d:DesignHeight="70" d:DesignWidth="100" BorderThickness="1">
<Grid MouseLeftButtonUp="Grid_MouseLeftButtonUp" Cursor="Hand" Opacity="1" MouseEnter="Grid_MouseEnter">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Rectangle RadiusX="2" RadiusY="2" Name="rectBkground" Stroke="Gray" Margin="0" Opacity="1" Fill="Green" StrokeThickness="2"/>
<Label Content="0.0" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" x:Name="labelValue" Margin="0,-1,-2,0" Foreground="White" />
</Grid>
<Grid Grid.Row="1">
<Rectangle Name="rectSetPoint" RadiusX="2" RadiusY="2" Stroke="Gray" Margin="0" Opacity="1" Fill="CadetBlue" StrokeThickness="2"/>
<Label Content="0.0" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" x:Name="labelSetPoint" Margin="0,-2,-2,0" Foreground="DarkSlateGray" />
</Grid>
</Grid>
</UserControl>
@@ -0,0 +1,170 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Aitex.Core.Common.DeviceData;
using Caliburn.Micro;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// Interaction logic for AnalogControl.xaml
/// </summary>
public partial class MfcControl : UserControl
{
public MfcControl()
{
InitializeComponent();
}
// define dependency properties
public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(
"Command", typeof(ICommand), typeof(MfcControl),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty DeviceDataProperty = DependencyProperty.Register(
"DeviceData", typeof(AITMfcData), typeof(MfcControl),
new FrameworkPropertyMetadata(new AITMfcData(), FrameworkPropertyMetadataOptions.AffectsRender,
new PropertyChangedCallback(OnDeviceDataChanged)));
public static readonly DependencyProperty BackColorProperty = DependencyProperty.Register(
"BackColor", typeof(Brush), typeof(MfcControl),
new FrameworkPropertyMetadata(Brushes.Green, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty HideDialogProperty = DependencyProperty.Register(
"HideDialog", typeof(bool), typeof(MfcControl),
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
private static void OnDeviceDataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
public ICommand Command
{
get
{
return (ICommand)this.GetValue(CommandProperty);
}
set
{
this.SetValue(CommandProperty, value);
}
}
/// <summary>
/// set, get current progress value AnalogDeviceData
/// </summary>
public AITMfcData DeviceData
{
get
{
return (AITMfcData)this.GetValue(DeviceDataProperty);
}
set
{
this.SetValue(DeviceDataProperty, value);
}
}
public Brush BackColor
{
get
{
return (Brush)this.GetValue(BackColorProperty);
}
set
{
this.SetValue(BackColorProperty, value);
}
}
public bool HideDialog
{
get
{
return (bool)this.GetValue(HideDialogProperty);
}
set
{
this.SetValue(HideDialogProperty, value);
}
}
//
/// <summary>
/// MFC 控件的显示逻辑:
///
/// 下面:设定值SetPoint
///
/// </summary>
/// <param name="drawingContext"></param>
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
//draw background color
rectBkground.Fill = BackColor;
if (DeviceData != null)
{
rectBkground.Stroke = DeviceData.IsError ? Brushes.Red : (DeviceData.IsWarning ? Brushes.Yellow : Brushes.DimGray);
labelValue.Content = DeviceData.FeedBack.ToString("F1");
if (_dialog != null)
{
_dialog.DeviceData = DeviceData;
_dialog.DeviceData.InvokePropertyChanged();
}
labelSetPoint.Content = DeviceData.SetPoint.ToString("F1");
}
}
private MfcSettingDialogViewModel _dialog;
private void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (DeviceData == null)
return;
if (HideDialog)
return;
_dialog = new MfcSettingDialogViewModel($"MFC {DeviceData.DisplayName} Setting");
_dialog.DeviceData = DeviceData;
_dialog.InputSetPoint = DeviceData.SetPoint.ToString("F1");
WindowManager wm = new WindowManager();
Window owner = Application.Current.MainWindow;
if (owner != null)
{
Mouse.Capture(owner);
Point pointToWindow = Mouse.GetPosition(owner);
Point pointToScreen = owner.PointToScreen(pointToWindow);
pointToScreen.X = pointToScreen.X + 50;
pointToScreen.Y = pointToScreen.Y - 150;
Mouse.Capture(null);
wm.ShowDialog(_dialog, pointToScreen);
}
else
{
wm.ShowDialog(_dialog);
}
}
private void Grid_MouseEnter(object sender, MouseEventArgs e)
{
if (DeviceData != null)
{
string tooltipValue =
$"{DeviceData.Type}:{DeviceData.DisplayName}\r\n\r\nID:{DeviceData.DeviceSchematicId}\r\nScale:{DeviceData.Scale} {DeviceData.Unit}\r\nSetPoint:{DeviceData.SetPoint} {DeviceData.Unit} \r\nFeedback:{DeviceData.FeedBack} {DeviceData.Unit}";
ToolTip = tooltipValue;
}
}
}
}
@@ -0,0 +1,87 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.MfcSettingDialogView"
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:unitControls="clr-namespace:MECF.Framework.UI.Client.Ctrlib.UnitControls"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:micro="clr-namespace:Caliburn.Micro"
xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
mc:Ignorable="d"
KeyDown="OnEnterKeyIsHit"
d:DesignHeight="450" d:DesignWidth="600">
<UserControl.Resources>
<Style x:Key="textBoxInError" TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
</Style>
<unitControls:DoubleConverter x:Key="doubleConverter"/>
</UserControl.Resources>
<Border Height="300" Width="350" Background="{DynamicResource Color_BG_Dialog_Inner}" BorderThickness="1" BorderBrush="SteelBlue" >
<Grid Margin="2">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="70"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="1" Content="DeviceName :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="1" Grid.Column="1" Content="Unit :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="2" Grid.Column="1" Content="Max :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="3" Grid.Column="1" Content="Default :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="4" Grid.Column="1" Content="Feedback :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="5" Grid.Column="1" Content="SetPoint :" Margin="0,5,20,0" HorizontalAlignment="Right" />
<Label Grid.Row="0" Grid.Column="2" Content="{Binding Path=DeviceData.DisplayName}" Width="150" Height="28" HorizontalAlignment="Left" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" VerticalContentAlignment="Center" />
<Label Grid.Row="1" Grid.Column="2" Content="{Binding Path=DeviceData.Unit}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<Label Grid.Row="2" Grid.Column="2" Content="{Binding Path=DeviceData.Scale}" ContentStringFormat="F1" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<Label Grid.Row="3" Grid.Column="2" Content="{Binding Path=DeviceData.DefaultValue}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<Label Grid.Row="4" Grid.Column="2" Content="{Binding Path=DeviceData.FeedBack}" ContentStringFormat="F2" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
<controls:TextBoxEx Grid.Row="5" Grid.Column="2" Text="{Binding Path=InputSetPoint, UpdateSourceTrigger=PropertyChanged}"
x:Name="inputBox" BorderBrush="Green" BorderThickness="0,0,0,1"
AllowBackgroundChange="False" Width="150"
EditBoxMode="UnSignDecimal"
TextChanged="InputTextBox_TextChanged"
HorizontalAlignment="Stretch" FontSize="13" FontFamily="Arial,SimSun"
Height="30" VerticalContentAlignment="Center" />
<StackPanel Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="4" Margin="0,10,0,0"
VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Center">
<Button IsEnabled="{Binding IsEnableOk}" Content="OK" Width="90" Height="30">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="OK">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button Content="Cancel" Margin="30,0,0,0" Width="90" Height="30">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="Cancel">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<!--<CheckBox Margin="20,0,0,0" Content="Stick" IsChecked="{Binding IsSticked}" VerticalAlignment="Center" ></CheckBox>-->
</StackPanel>
</Grid>
</Border>
</UserControl>
@@ -0,0 +1,58 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Aitex.Core.Common.DeviceData;
using Aitex.Core.RT.Log;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// InputFileNameDialogView.xaml 的交互逻辑
/// </summary>
public partial class MfcSettingDialogView : UserControl
{
public MfcSettingDialogView()
{
InitializeComponent();
this.Loaded += MfcSettingDialogView_Loaded;
}
private void MfcSettingDialogView_Loaded(object sender, RoutedEventArgs e)
{
}
private void InputTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
double input;
if (!double.TryParse(inputBox.Text, out input))
(this.DataContext as MfcSettingDialogViewModel).IsEnableOk = false;
else if (input < 0 || input > (this.DataContext as MfcSettingDialogViewModel).DeviceData.Scale)
(this.DataContext as MfcSettingDialogViewModel).IsEnableOk = false;
else
(this.DataContext as MfcSettingDialogViewModel).IsEnableOk = true;
inputBox.Foreground = (this.DataContext as MfcSettingDialogViewModel).IsEnableOk ?
System.Windows.Media.Brushes.Black : System.Windows.Media.Brushes.Red;
}
private void OnEnterKeyIsHit(object sender, KeyEventArgs e)
{
try
{
if (!(this.DataContext as MfcSettingDialogViewModel).IsEnableOk) return;
if (e.Key == Key.Return)
{
(this.DataContext as MfcSettingDialogViewModel).OK();
}
}
catch (Exception ex)
{
LOG.Error(ex.Message);
}
}
}
}
@@ -0,0 +1,81 @@
using System.ComponentModel;
using System.Windows.Input;
using Aitex.Core.Common.DeviceData;
using MECF.Framework.Common.OperationCenter;
using MECF.Framework.UI.Client.CenterViews.Editors;
using OpenSEMI.ClientBase;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
public class MfcSettingDialogViewModel : DialogViewModel<string>, INotifyPropertyChanged
{
public MfcSettingDialogViewModel(string dialogName = "")
{
this.DisplayName = dialogName;
}
private AITMfcData _data;
public AITMfcData DeviceData
{
get
{
return _data;
}
set
{
_data = value;
NotifyOfPropertyChange(nameof(DeviceData));
}
}
private string _setPoint;
public string InputSetPoint
{
get { return _setPoint; }
set
{
_setPoint = value;
NotifyOfPropertyChange(nameof(InputSetPoint));
}
}
private bool _enableOk;
public bool IsEnableOk
{
get
{
return _enableOk;
}
set
{
_enableOk = value;
NotifyOfPropertyChange(nameof(IsEnableOk));
}
}
public void Cancel()
{
IsCancel = true;
TryClose(false);
}
protected override void OnViewLoaded(object view)
{
base.OnViewLoaded(view);
MfcSettingDialogView v = (MfcSettingDialogView)view;
}
public void OK()
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.UniqueName}.{AITMfcOperation.Ramp}", InputSetPoint, 0);
//this.DialogResult = string.Empty;
//IsCancel = false;
//TryClose(true);
}
}
}
@@ -0,0 +1,331 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.Controls.MultipleSelectionsCombox"
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:MECF.Framework.UI.Client.Ctrlib.Controls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<LinearGradientBrush x:Key="NormalBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FFF" Offset="0.0"/>
<GradientStop Color="#CCC" Offset="1.0"/>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#CCC" Offset="0.0"/>
<GradientStop Color="#444" Offset="1.0"/>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<SolidColorBrush x:Key="GlyphBrush" Color="#444" />
<LinearGradientBrush x:Key="DarkBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FFF" Offset="0.0"/>
<GradientStop Color="#AAA" Offset="1.0"/>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#BBB" Offset="0.0"/>
<GradientStop Color="#EEE" Offset="0.1"/>
<GradientStop Color="#EEE" Offset="0.9"/>
<GradientStop Color="#FFF" Offset="1.0"/>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888" />
<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />
<SolidColorBrush x:Key="WindowBackgroundBrush" Color="#FFF" />
<SolidColorBrush x:Key="SelectedBackgroundBrush" Color="#DDD" />
<SolidColorBrush x:Key="ComboBox.Static.Border" Color="#FFACACAC"/>
<SolidColorBrush x:Key="ComboBox.Static.Editable.Background" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ComboBox.Static.Editable.Border" Color="#FFABADB3"/>
<SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Background" Color="Transparent"/>
<SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Border" Color="Transparent"/>
<SolidColorBrush x:Key="ComboBox.MouseOver.Glyph" Color="#FF000000"/>
<LinearGradientBrush x:Key="ComboBox.MouseOver.Background" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFECF4FC" Offset="0.0"/>
<GradientStop Color="#FFDCECFC" Offset="1.0"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ComboBox.MouseOver.Border" Color="#FF7EB4EA"/>
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Background" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Border" Color="#FF7EB4EA"/>
<LinearGradientBrush x:Key="ComboBox.MouseOver.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFEBF4FC" Offset="0.0"/>
<GradientStop Color="#FFDCECFC" Offset="1.0"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Button.Border" Color="#FF7EB4EA"/>
<SolidColorBrush x:Key="ComboBox.Pressed.Glyph" Color="#FF000000"/>
<LinearGradientBrush x:Key="ComboBox.Pressed.Background" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFDAECFC" Offset="0.0"/>
<GradientStop Color="#FFC4E0FC" Offset="1.0"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ComboBox.Pressed.Border" Color="#FF569DE5"/>
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Background" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Border" Color="#FF569DE5"/>
<LinearGradientBrush x:Key="ComboBox.Pressed.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFDAEBFC" Offset="0.0"/>
<GradientStop Color="#FFC4E0FC" Offset="1.0"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ComboBox.Pressed.Editable.Button.Border" Color="#FF569DE5"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Glyph" Color="#FFBFBFBF"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Background" Color="#FFF0F0F0"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Border" Color="#FFD9D9D9"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Background" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Border" Color="#FFBFBFBF"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Background" Color="Transparent"/>
<SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Border" Color="Transparent"/>
<SolidColorBrush x:Key="ComboBox.Static.Glyph" Color="#FF3C77DD"/>
<ControlTemplate x:Key="ComboBoxTextBox" TargetType="TextBox">
<Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}" />
</ControlTemplate>
<Style x:Key="ComboBoxToggleButton" TargetType="ToggleButton">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="ClickMode" Value="Press"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border x:Name="templateRoot" CornerRadius="5" BorderBrush="{StaticResource ComboBox.Static.Border}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true" Background="White">
<Border x:Name="splitBorder" BorderBrush="Transparent" BorderThickness="1" HorizontalAlignment="Right" Margin="0,0,2,0" SnapsToDevicePixels="true" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
<Path x:Name="arrow" Data="F1 M 0,0 L 3.667,2.66665 L 7.3334,0 L 7.3334,-1.78168 L 3.6667,0.88501 L0,-1.78168 L0,0 Z" Fill="{StaticResource ComboBox.Static.Glyph}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</Border>
<ControlTemplate.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="false"/>
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="false"/>
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Border}"/>
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Background}"/>
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Border}"/>
</MultiDataTrigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.MouseOver.Glyph}"/>
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Border}"/>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Border}"/>
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Background}"/>
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Border}"/>
</MultiDataTrigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Pressed.Glyph}"/>
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Border}"/>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Border}"/>
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Background}"/>
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Border}"/>
</MultiDataTrigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Disabled.Glyph}"/>
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Border}"/>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
<Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Background}"/>
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Border}"/>
<Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Background}"/>
<Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Border}"/>
</MultiDataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="{x:Type ComboBoxItem}" TargetType="ComboBoxItem">
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border
Name="Border"
Padding="2"
SnapsToDevicePixels="true">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsHighlighted" Value="true">
<Setter TargetName="Border" Property="Background" Value="{StaticResource SelectedBackgroundBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<ComboBox x:Name="CheckableCombo">
<ComboBox.ItemTemplate>
<HierarchicalDataTemplate>
<CheckBox Content="{Binding Description}"
IsChecked="{Binding IsSelected, Mode=TwoWay}"
Tag="{RelativeSource FindAncestor, AncestorType={x:Type ComboBox}}"
Click="Checkbox_OnClick"></CheckBox>
</HierarchicalDataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.Template>
<ControlTemplate TargetType="ComboBox">
<Grid>
<ToggleButton Name="ToggleButton"
Style="{StaticResource ComboBoxToggleButton}"
Focusable="False"
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
</ToggleButton>
<ContentPresenter x:Name="Presenter"
IsHitTestVisible="False"
Margin="3, 3, 23, 3"
VerticalAlignment="Center"
HorizontalAlignment="Left">
<ContentPresenter.Content>
<TextBlock TextTrimming="CharacterEllipsis"
Text="{Binding Path=Text, Mode=TwoWay, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}">
</TextBlock>
</ContentPresenter.Content>
</ContentPresenter>
<TextBox x:Name="EditableTextBox"
Style="{x:Null}"
Template="{StaticResource ComboBoxTextBox}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="3,3,23,3"
Focusable="True"
Background="Transparent"
Visibility="Hidden"
IsReadOnly="{TemplateBinding IsReadOnly}"/>
<Popup
Name="Popup"
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide">
<Grid
Name="DropDown"
SnapsToDevicePixels="True"
MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border
x:Name="DropDownBorder"
Background="{StaticResource WindowBackgroundBrush}"
BorderThickness="1"/>
<ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True" DataContext="{Binding}">
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Grid>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasItems" Value="false">
<Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
</Trigger>
<Trigger Property="IsGrouping" Value="true">
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
</Trigger>
<Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="true">
<Setter TargetName="DropDownBorder" Property="CornerRadius" Value="4"/>
<Setter TargetName="DropDownBorder" Property="Margin" Value="0,2,0,0"/>
</Trigger>
<Trigger Property="IsEditable" Value="true">
<Setter Property="IsTabStop" Value="false"/>
<Setter TargetName="EditableTextBox" Property="Visibility" Value="Visible"/>
<Setter TargetName="Presenter" Property="Visibility" Value="Hidden"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ComboBox.Template>
</ComboBox>
</Grid>
</UserControl>
@@ -0,0 +1,172 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SciChart.Core.Extensions;
namespace MECF.Framework.UI.Client.Ctrlib.Controls
{
public class MultipleCheckboxModel : INotifyPropertyChanged
{
public int Id { get; set; }
public string Description { get; set; }
private bool _isSelected;
public bool IsSelected
{
get { return _isSelected; }
set
{
_isSelected = value;
NotifyPropertyChanged("IsSelected");
}
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged(string propertyName)
{
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
}
/// <summary>
/// MultipleSelectionsCombox.xaml 的交互逻辑
/// </summary>
public partial class MultipleSelectionsCombox : UserControl
{
public MultipleSelectionsCombox()
{
InitializeComponent();
}
#region Dependency Properties
public IEnumerable<MultipleCheckboxModel> ItemsSource
{
get { return (IEnumerable<MultipleCheckboxModel>)GetValue(ItemsSourceProperty); }
set
{
SetValue(ItemsSourceProperty, value);
SetText();
}
}
public static readonly DependencyProperty ItemsSourceProperty =
DependencyProperty.Register("ItemsSource", typeof(object), typeof(MultipleSelectionsCombox), new FrameworkPropertyMetadata(null, ItemsSourcePropertyChangedCallback));
private static void ItemsSourcePropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{
var multioleCheckbox = dependencyObject as MultipleSelectionsCombox;
if (multioleCheckbox == null) return;
multioleCheckbox.CheckableCombo.ItemsSource = multioleCheckbox.ItemsSource;
}
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register("Text", typeof(string), typeof(MultipleSelectionsCombox), new FrameworkPropertyMetadata("", TextPropertyChangedCallback));
private static void TextPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
{
var multioleCheckbox = dependencyObject as MultipleSelectionsCombox;
if (multioleCheckbox == null) return;
}
public string DefaultText
{
get { return (string)GetValue(DefaultTextProperty); }
set { SetValue(DefaultTextProperty, value); }
}
public static readonly DependencyProperty DefaultTextProperty =
DependencyProperty.Register("DefaultText", typeof(string), typeof(MultipleSelectionsCombox), new UIPropertyMetadata(string.Empty));
#endregion
#region Event
private void Checkbox_OnClick(object sender, RoutedEventArgs e)
{
var checkbox = sender as CheckBox;
if (checkbox == null) return;
if ((string)checkbox.Content == "All")
{
Text = "";
if (checkbox.IsChecked != null && checkbox.IsChecked.Value)
{
ItemsSource.ForEachDo(x =>
{
x.IsSelected = true;
Text = "All";
});
}
else
{
ItemsSource.ForEachDo(x =>
{
x.IsSelected = false;
Text = "None";
});
}
}
else
{
SetText();
}
}
#endregion
#region Private Method
private void SetText()
{
Text = "";
var all = ItemsSource.FirstOrDefault(x => x.Description == "All");
foreach (var item in ItemsSource)
{
if (item.IsSelected && item.Description != "All")
{
Text += item.Description + ",";
}
else if (all != null)
{
if (all.IsSelected)
all.IsSelected = false;
}
}
Text = string.IsNullOrEmpty(Text) ? DefaultText : Text.TrimEnd(new[] { ',' });
}
#endregion
}
}
@@ -0,0 +1,11 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.RFSimpleControl"
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"
mc:Ignorable="d" x:Name="Self" >
<Viewbox>
<Image x:Name="imagePicture" Source="pack://application:,,,/MECF.Framework.UI.Client;component/Resources/Images/units/rfOff.png" >
</Image>
</Viewbox>
</UserControl>
@@ -0,0 +1,51 @@
using Aitex.Core.Common.DeviceData;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// RFSimpleControl.xaml 的交互逻辑
/// </summary>
public partial class RFSimpleControl : UserControl
{
public static readonly DependencyProperty DeviceDataProperty = DependencyProperty.Register(
"DeviceData", typeof(AITRfData), typeof(RFSimpleControl),
new FrameworkPropertyMetadata(new AITRfData(), FrameworkPropertyMetadataOptions.AffectsRender));
public AITRfData DeviceData
{
get
{
return (AITRfData)this.GetValue(DeviceDataProperty);
}
set
{
this.SetValue(DeviceDataProperty, value);
}
}
public RFSimpleControl()
{
InitializeComponent();
}
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
if (DeviceData == null)
return;
if (DeviceData.IsRfOn)
imagePicture.Source = new BitmapImage(new Uri("pack://application:,,,/MECF.Framework.UI.Client;component/Resources/Images/units/rfOn.png"));
else
imagePicture.Source = new BitmapImage(new Uri("pack://application:,,,/MECF.Framework.UI.Client;component/Resources/Images/units/rfOff.png"));
}
}
}
@@ -0,0 +1,42 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.TVControl"
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"
mc:Ignorable="d" d:DesignHeight="70" d:DesignWidth="120" BorderThickness="1" x:Name="self">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Width="36" Height="36" HorizontalAlignment="Center" Grid.Column="0" Background=" Transparent" Cursor="Hand" MouseEnter="Grid_MouseEnter" MouseLeftButtonUp="Grid_MouseLeftButtonUp">
<Grid.RenderTransform>
<RotateTransform x:Name="rotateTransform" Angle="20" CenterX="18" CenterY="18" />
</Grid.RenderTransform>
<Ellipse Stroke="Black" Fill="White" Height="34" Width="34" />
<Line X1="3" Y1="17" X2="31" Y2="17" Stroke="Black" StrokeThickness="1.2" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
<Line X1="3" Y1="17" X2="9" Y2="15" Stroke="Black" StrokeThickness="1.2" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
<Line X1="3" Y1="17" X2="9" Y2="19" Stroke="Black" StrokeThickness="1.2" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
</Grid>
<Grid Grid.Column="1">
<Grid MouseLeftButtonUp="Grid_MouseLeftButtonUp" Cursor="Hand" Opacity="1" MouseEnter="Grid_MouseEnter">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Rectangle RadiusX="2" RadiusY="2" Name="rectPosition" Stroke="Gray" Margin="0" Opacity="1" Fill="Green" StrokeThickness="2"/>
<Label Content="0.0" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" x:Name="PositionValue" Margin="0,-1,-2,0" Foreground="White" />
</Grid>
<Grid Grid.Row="1">
<Rectangle Name="rectPressure" RadiusX="2" RadiusY="2" Stroke="Gray" Margin="0" Opacity="1" Fill="SteelBlue" StrokeThickness="2"/>
<Label Content="0.0" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" x:Name="PressureValue" Margin="0,-2,-2,0" Foreground="White" />
</Grid>
</Grid>
</Grid>
</Grid>
</UserControl>
@@ -0,0 +1,219 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Aitex.Core.Common.DeviceData;
using Aitex.Core.UI.Control;
using Caliburn.Micro;
using MECF.Framework.Common.OperationCenter;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// AITThrottleValve.xaml 的交互逻辑
/// </summary>
public partial class TVControl : UserControl
{
public TVControl()
{
InitializeComponent();
}
// define dependency properties
public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(
"Command", typeof(ICommand), typeof(TVControl),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty DeviceDataProperty = DependencyProperty.Register(
"DeviceData", typeof(AITThrottleValveData), typeof(TVControl),
new FrameworkPropertyMetadata(new AITThrottleValveData(), FrameworkPropertyMetadataOptions.AffectsRender));
public ICommand Command
{
get
{
return (ICommand)this.GetValue(CommandProperty);
}
set
{
this.SetValue(CommandProperty, value);
}
}
/// <summary>
/// set, get current progress value AnalogDeviceData
/// </summary>
public AITThrottleValveData DeviceData
{
get
{
return (AITThrottleValveData)this.GetValue(DeviceDataProperty);
}
set
{
this.SetValue(DeviceDataProperty, value);
}
}
private TVSettingDialogViewModel _dialog;
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
if (DeviceData != null)
{
if (DeviceData.Mode == (int)PressureCtrlMode.TVPressureCtrl)
{
//rotateTransform.Angle = DeviceData.PressureFeedback * 90.0 / DeviceData.MaxValuePressure;
rectPosition.Stroke = Brushes.Gray;
rectPressure.Stroke = Brushes.LightCyan;
}
else if (DeviceData.Mode == (int)PressureCtrlMode.TVPositionCtrl)
{
rectPosition.Stroke = Brushes.LightCyan;
rectPressure.Stroke = Brushes.Gray;
}
else
{
rectPosition.Stroke = Brushes.Gray;
rectPressure.Stroke = Brushes.Gray;
}
rotateTransform.Angle = DeviceData.PositionFeedback * 180.0 / DeviceData.MaxValuePosition;
PositionValue.Content = DeviceData.PositionFeedback.ToString("F1") + " %";
//PositionUnit.Content = "%";
PressureValue.Content = DeviceData.PressureSetPoint.ToString("F1") + " Torr";
//PressureUnit.Content = !string.IsNullOrEmpty(DeviceData.UnitPressure) ? DeviceData.UnitPressure : "mTorr";
if (_dialog != null)
{
_dialog.DeviceData = DeviceData;
}
//if (_dialogBox != null)
//{
// _dialogBox.IsPositionMode = DeviceData.Mode == (int)PressureCtrlMode.TVPositionCtrl;
// _dialogBox.IsPressureMode = DeviceData.Mode == (int)PressureCtrlMode.TVPressureCtrl;
// //_dialogBox.SetPointPosition = DeviceData.PositionSetPoint;
// //_dialogBox.SetPointPressure = DeviceData.PressureSetPoint;
//}
}
}
private void Grid_MouseEnter(object sender, MouseEventArgs e)
{
//if (DeviceData != null)
//{
// string tooltipValue =
// string.Format(Application.Current.Resources["GlobalLableThrottleValveToolTip"].ToString(),
// DeviceData.Type,
// DeviceData.DisplayName,
// DeviceData.DeviceSchematicId,
// DeviceData.Mode == (int)PressureCtrlMode.TVPressureCtrl ? "Pressure" : (DeviceData.Mode == (int)PressureCtrlMode.TVPositionCtrl ? "Position" : ""),
// DeviceData.PositionFeedback.ToString("F1"),
// DeviceData.PressureFeedback.ToString("F1"));
// ToolTip = tooltipValue;
//}
}
private void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (DeviceData == null)
return;
_dialog = new TVSettingDialogViewModel($"{DeviceData.DisplayName} Setting");
_dialog.DeviceData = DeviceData;
_dialog.InputSetPointPosition = DeviceData.PositionSetPoint.ToString("F1");
_dialog.InputSetPointPressure = DeviceData.PressureSetPoint.ToString("F1");
WindowManager wm = new WindowManager();
Window owner = Application.Current.MainWindow;
if (owner != null)
{
Mouse.Capture(owner);
Point pointToWindow = Mouse.GetPosition(owner);
Point pointToScreen = owner.PointToScreen(pointToWindow);
pointToScreen.X = pointToScreen.X + 50;
pointToScreen.Y = pointToScreen.Y - 150;
Mouse.Capture(null);
wm.ShowDialog(_dialog, pointToScreen);
}
else
{
wm.ShowDialog(_dialog);
}
//_dialogBox = new AITThrottleValveInputDialogBox
//{
// SetThrottleModeCommandDelegate = SetThrottleModeExecute,
// SetPressureCommandDelegate = SetPressureExecute,
// SetPositionCommandDelegate = SetPositionExecute,
// DeviceName = string.Format("{0}: {1}", DeviceData.Type, DeviceData.DisplayName),
// DeviceId = DeviceData.DeviceSchematicId,
// SetPointPosition = Math.Round(DeviceData.PositionSetPoint, 1),
// SetPointPressure = Math.Round(DeviceData.PressureSetPoint, 1),
// MaxValuePressure = DeviceData.MaxValuePressure,
// MaxValuePosition = DeviceData.MaxValuePosition,
// UnitPosition = DeviceData.UnitPosition,
// UnitPressure = DeviceData.UnitPressure,
// FeedbackPosition = DeviceData.PositionFeedback,
// FeedbackPressure = DeviceData.PressureFeedback,
// IsPositionMode = DeviceData.Mode == (int)PressureCtrlMode.TVPositionCtrl,
// IsPressureMode = DeviceData.Mode == (int)PressureCtrlMode.TVPressureCtrl,
//};
//if (AnalogOwner != null)
// _dialogBox.Owner = AnalogOwner;
//_dialogBox.Topmost = true;
//_dialogBox.WindowStartupLocation = WindowStartupLocation.CenterScreen;
//_dialogBox.FocasAll();
//_dialogBox.ShowDialog();
//_dialogBox = null;
}
private void SetThrottleModeExecute(PressureCtrlMode value)
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITThrottleValveOperation.SetMode}", value.ToString());
}
private void SetPressureExecute(double value)
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITThrottleValveOperation.SetPressure}", (float)value);
}
private void SetPositionExecute(double value)
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITThrottleValveOperation.SetPosition}", (float)value);
}
}
}
@@ -0,0 +1,130 @@
<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.TVSettingDialogView"
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:unitControls="clr-namespace:MECF.Framework.UI.Client.Ctrlib.UnitControls"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:micro="clr-namespace:Caliburn.Micro"
xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
xmlns:converters="clr-namespace:Aitex.Core.UI.Converters;assembly=MECF.Framework.UI.Core"
mc:Ignorable="d"
KeyDown="OnEnterKeyIsHit"
d:DesignHeight="450" d:DesignWidth="600">
<UserControl.Resources>
<Style x:Key="textBoxInError" TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
</Style>
<unitControls:DoubleConverter x:Key="doubleConverter"/>
<converters:BoolToValueConverter x:Key="BoolToValueConverter"/>
</UserControl.Resources>
<Border Height="300" Width="400" Background="{DynamicResource Color_BG_Dialog_Inner}" BorderThickness="1" BorderBrush="SteelBlue" >
<Grid>
<Grid.Resources>
<Style TargetType="RadioButton"/>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="70"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="1" Content="Device Name:" />
<Label Grid.Row="1" Grid.Column="1" Content="Work Mode:" />
<Label Grid.Row="2" Grid.Column="1" Content="Max:" />
<Label Grid.Row="3" Grid.Column="1" Content="Unit:" />
<Label Grid.Row="4" Grid.Column="1" Content="Feedback:" />
<Label Grid.Row="5" Grid.Column="1" Content="Set Point:" />
<Label Grid.Row="0" Grid.Column="2" Content="{Binding Path=DeviceData.DisplayName}" Width="150" Height="28" HorizontalAlignment="Left" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" VerticalContentAlignment="Center" />
<Label Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="12" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" >
<StackPanel Orientation="Horizontal">
<CheckBox x:Name="ckPosition" Content="Position" IsChecked="{Binding IsPositionMode}" VerticalContentAlignment="Center">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="SetPosition">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</CheckBox>
<CheckBox x:Name="ckPressure" Content="Pressure" IsChecked="{Binding IsPressureMode}" Margin="10,0,0,0" VerticalContentAlignment="Center">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="SetPressure">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</CheckBox>
</StackPanel>
</Label>
<Label Grid.Row="2" Grid.Column="2" Content="{Binding Path=DeviceData.MaxValuePosition}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPosition, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<Label Grid.Row="2" Grid.Column="2" Content="{Binding Path=DeviceData.MaxValuePressure}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPressure, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<Label Grid.Row="3" Grid.Column="2" Content="{Binding Path=DeviceData.UnitPosition}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPosition, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<Label Grid.Row="3" Grid.Column="2" Content="{Binding Path=DeviceData.UnitPressure}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPressure, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<Label Grid.Row="4" Grid.Column="2" Content="{Binding Path=DeviceData.PositionFeedback}" ContentStringFormat="F1" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPosition, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<Label Grid.Row="4" Grid.Column="2" Content="{Binding Path=DeviceData.PressureFeedback}" ContentStringFormat="F1" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
Visibility="{Binding ElementName=ckPressure, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<controls:TextBoxEx Grid.Row="5" Grid.Column="2" x:Name="inputBoxPosition"
AllowBackgroundChange="False" BorderBrush="Green" BorderThickness="0,0,0,1"
TextChanged="InputTextBoxPosition_TextChanged" Width="150" HorizontalAlignment="Stretch"
VerticalContentAlignment="Center"
Text="{Binding Path=InputSetPointPosition, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding ElementName=ckPosition, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<controls:TextBoxEx Grid.Row="5" Grid.Column="2" x:Name="inputBoxPressure"
AllowBackgroundChange="False" BorderBrush="Green" BorderThickness="0,0,0,1"
TextChanged="InputTextBoxPressure_TextChanged" Width="150" HorizontalAlignment="Stretch"
Height="30" VerticalContentAlignment="Center"
Text="{Binding Path=InputSetPointPressure, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding ElementName=ckPressure, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
<StackPanel Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="4" Margin="0,10,0,0"
VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Center">
<Button IsEnabled="{Binding IsEnableSet}" x:Name="buttonSet" Content="Set" Width="90" Height="30">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="Set">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button Content="Cancel" Margin="30,0,0,0" Width="90" Height="30">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="Cancel">
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<!--<CheckBox Margin="20,0,0,0" Content="Stick" IsChecked="{Binding IsSticked}" VerticalAlignment="Center" ></CheckBox>-->
</StackPanel>
</Grid>
</Border>
</UserControl>
@@ -0,0 +1,378 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Aitex.Core.Common.DeviceData;
using Aitex.Core.RT.Log;
using MECF.Framework.Common.OperationCenter;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
/// <summary>
/// InputFileNameDialogView.xaml 的交互逻辑
/// </summary>
public partial class TVSettingDialogView : UserControl
{
public TVSettingDialogView()
{
InitializeComponent();
}
public void FocasAll()
{
inputBoxPosition.Text = Math.Round(SetPointPosition, 2).ToString();
if (IsPositionMode)
{
inputBoxPosition.Focus();
inputBoxPosition.SelectAll();
}
inputBoxPressure.Text = Math.Round(SetPointPressure, 2).ToString();
if (IsPressureMode)
{
inputBoxPressure.Focus();
inputBoxPressure.SelectAll();
}
}
/// <summary>
/// Vilidate input range
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void InputTextBoxPosition_TextChanged(object sender, TextChangedEventArgs e)
{
double maxValue = MaxValuePosition;
var data = this.DataContext as TVSettingDialogViewModel;
if (data != null)
{
maxValue = data.DeviceData.MaxValuePosition;
}
double input;
if (!double.TryParse(inputBoxPosition.Text, out input)) buttonSet.IsEnabled = false;
else if (input < 0 || input > maxValue) buttonSet.IsEnabled = false;
else buttonSet.IsEnabled = true;
inputBoxPosition.Foreground = buttonSet.IsEnabled ?
System.Windows.Media.Brushes.Black : System.Windows.Media.Brushes.Red;
}
private void InputTextBoxPressure_TextChanged(object sender, TextChangedEventArgs e)
{
double maxValue = MaxValuePosition;
var data = this.DataContext as TVSettingDialogViewModel;
if (data != null)
{
maxValue = data.DeviceData.MaxValuePressure;
}
double input;
if (!double.TryParse(inputBoxPressure.Text, out input)) buttonSet.IsEnabled = false;
else if (input < 0 || input > maxValue) buttonSet.IsEnabled = false;
else buttonSet.IsEnabled = true;
inputBoxPressure.Foreground = buttonSet.IsEnabled ?
System.Windows.Media.Brushes.Black : System.Windows.Media.Brushes.Red;
}
public static readonly DependencyProperty DeviceNameProperty = DependencyProperty.Register(
"DeviceName", typeof(string), typeof(TVSettingDialogView),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty DeviceIdProperty = DependencyProperty.Register(
"DeviceId", typeof(string), typeof(TVSettingDialogView),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty MaxValuePositionProperty = DependencyProperty.Register(
"MaxValuePosition", typeof(double), typeof(TVSettingDialogView),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty MaxValuePressureProperty = DependencyProperty.Register(
"MaxValuePressure", typeof(double), typeof(TVSettingDialogView),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty UnitPositionProperty = DependencyProperty.Register(
"UnitPosition", typeof(string), typeof(TVSettingDialogView),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty UnitPressureProperty = DependencyProperty.Register(
"UnitPressure", typeof(string), typeof(TVSettingDialogView),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty SetPointPositionProperty = DependencyProperty.Register(
"SetPointPosition", typeof(double), typeof(TVSettingDialogView),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty SetPointPressureProperty = DependencyProperty.Register(
"SetPointPressure", typeof(double), typeof(TVSettingDialogView),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty FeedbackPositionProperty = DependencyProperty.Register(
"FeedbackPosition", typeof(double), typeof(TVSettingDialogView),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty FeedbackPressureProperty = DependencyProperty.Register(
"FeedbackPressure", typeof(double), typeof(TVSettingDialogView),
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty IsPositionModeProperty = DependencyProperty.Register(
"IsPositionMode", typeof(bool), typeof(TVSettingDialogView),
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty IsPressureModeProperty = DependencyProperty.Register(
"IsPressureMode", typeof(bool), typeof(TVSettingDialogView),
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
public bool IsPercent { get; set; }
public string DeviceName
{
get
{
return (string)this.GetValue(DeviceNameProperty);
}
set
{
if (!string.IsNullOrEmpty(value) && !value.StartsWith("_"))
value = "_" + value;
this.SetValue(DeviceNameProperty, value);
}
}
public string DeviceId
{
get
{
return (string)this.GetValue(DeviceIdProperty);
}
set
{
this.SetValue(DeviceIdProperty, value);
}
}
public double MaxValuePosition
{
get
{
return (double)this.GetValue(MaxValuePositionProperty);
}
set
{
this.SetValue(MaxValuePositionProperty, value);
}
}
public double MaxValuePressure
{
get
{
return (double)this.GetValue(MaxValuePressureProperty);
}
set
{
this.SetValue(MaxValuePressureProperty, value);
}
}
public string UnitPosition
{
get
{
return (string)this.GetValue(UnitPositionProperty);
}
set
{
this.SetValue(UnitPositionProperty, value);
}
}
public string UnitPressure
{
get
{
return (string)this.GetValue(UnitPressureProperty);
}
set
{
this.SetValue(UnitPressureProperty, value);
}
}
public double SetPointPosition
{
get
{
return (double)this.GetValue(SetPointPositionProperty);
}
set
{
this.SetValue(SetPointPositionProperty, value);
}
}
public double SetPointPressure
{
get
{
return (double)this.GetValue(SetPointPressureProperty);
}
set
{
this.SetValue(SetPointPressureProperty, value);
}
}
public double FeedbackPosition
{
get
{
return (double)this.GetValue(FeedbackPositionProperty);
}
set
{
this.SetValue(FeedbackPositionProperty, value);
}
}
public double FeedbackPressure
{
get
{
return (double)this.GetValue(FeedbackPressureProperty);
}
set
{
this.SetValue(FeedbackPressureProperty, value);
}
}
public bool IsPositionMode
{
get
{
return (bool)this.GetValue(IsPositionModeProperty);
}
set
{
this.SetValue(IsPositionModeProperty, value);
ckPosition.IsChecked = IsPositionMode;
}
}
public bool IsPressureMode
{
get
{
return (bool)this.GetValue(IsPressureModeProperty);
}
set
{
this.SetValue(IsPressureModeProperty, value);
ckPressure.IsChecked = IsPressureMode;
}
}
public Action<PressureCtrlMode> SetThrottleModeCommandDelegate;
public Action<double> SetPositionCommandDelegate;
public Action<double> SetPressureCommandDelegate;
private void ButtonSet_Click(object sender, RoutedEventArgs e)
{
if (IsPressureMode)
SetPressureCommandDelegate(Convert.ToDouble(inputBoxPressure.Text));
else if (IsPositionMode)
SetPositionCommandDelegate(Convert.ToDouble(inputBoxPosition.Text));
//Close();
}
private void OnEnterKeyIsHit(object sender, KeyEventArgs e)
{
try
{
if (!buttonSet.IsEnabled) return;
if (e.Key == Key.Return)
{
ButtonSet_Click(null, null);
}
}
catch (Exception ex)
{
LOG.Error(ex.Message);
}
}
private void CkPosition_OnChecked(object sender, RoutedEventArgs e)
{
if (IsPositionMode)
return;
ckPosition.IsChecked = false;
try
{
if (SetThrottleModeCommandDelegate != null)
{
SetThrottleModeCommandDelegate(PressureCtrlMode.TVPositionCtrl);
}
var data = this.DataContext as TVSettingDialogViewModel;
if (data != null)
{
InvokeClient.Instance.Service.DoOperation($"{data.DeviceData.Module}.{data.DeviceData.DeviceName}.{AITThrottleValveOperation.SetMode}", PressureCtrlMode.TVPositionCtrl.ToString());
}
}
catch (Exception ex)
{
LOG.Error(ex.Message);
}
}
private void SetThrottleModeExecute(PressureCtrlMode value)
{
}
private void SetPressureExecute(double value)
{
//InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITThrottleValveOperation.SetPressure}", (float)value);
}
private void SetPositionExecute(double value)
{
//InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITThrottleValveOperation.SetPosition}", (float)value);
}
private void CkPressure_OnChecked(object sender, RoutedEventArgs e)
{
if (IsPressureMode)
return;
ckPressure.IsChecked = false;
try
{
if (SetThrottleModeCommandDelegate != null)
{
SetThrottleModeCommandDelegate(PressureCtrlMode.TVPressureCtrl);
}
var data = this.DataContext as TVSettingDialogViewModel;
if (data != null)
{
InvokeClient.Instance.Service.DoOperation($"{data.DeviceData.Module}.{data.DeviceData.DeviceName}.{AITThrottleValveOperation.SetMode}", PressureCtrlMode.TVPressureCtrl.ToString());
}
}
catch (Exception ex)
{
LOG.Error(ex.Message);
}
}
private void CkPosition_OnClick(object sender, RoutedEventArgs e)
{
ckPosition.IsChecked = IsPositionMode;
}
private void CkPressure_OnClick(object sender, RoutedEventArgs e)
{
ckPressure.IsChecked = IsPressureMode;
}
}
}
@@ -0,0 +1,158 @@
using System;
using System.ComponentModel;
using System.Windows.Input;
using Aitex.Core.Common.DeviceData;
using MECF.Framework.Common.OperationCenter;
using OpenSEMI.ClientBase;
namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
{
public class TVSettingDialogViewModel : DialogViewModel<string>, INotifyPropertyChanged
{
private AITThrottleValveData _data;
public AITThrottleValveData DeviceData
{
get
{
return _data;
}
set
{
_data = value;
NotifyOfPropertyChange(nameof(DeviceData));
NotifyOfPropertyChange(nameof(IsPositionMode));
NotifyOfPropertyChange(nameof(IsPressureMode));
}
}
private string _setPointPosition;
public string InputSetPointPosition
{
get { return _setPointPosition; }
set
{
_setPointPosition = value;
NotifyOfPropertyChange(nameof(InputSetPointPosition));
}
}
private string _setPointPressure;
public string InputSetPointPressure
{
get { return _setPointPressure; }
set
{
_setPointPressure = value;
NotifyOfPropertyChange(nameof(InputSetPointPressure));
}
}
public bool IsPositionMode
{
get
{
return DeviceData != null && DeviceData.Mode == (int)PressureCtrlMode.TVPositionCtrl;
}
set
{
}
}
private bool _isPressureMode;
public bool IsPressureMode
{
get
{
//return _isPressureMode;
return DeviceData != null && DeviceData.Mode == (int)PressureCtrlMode.TVPressureCtrl;
}
set
{
if (value != _isPressureMode)
{
}
_isPressureMode = value;
}
}
private bool _enableOk;
public bool IsEnableOk
{
get
{
return _enableOk;
}
set
{
_enableOk = value;
NotifyOfPropertyChange(nameof(IsEnableOk));
}
}
public ICommand PositionCommand { get; set; }
public TVSettingDialogViewModel(string dialogName = "")
{
this.DisplayName = dialogName;
}
public void Cancel()
{
IsCancel = true;
TryClose(false);
}
protected override void OnViewLoaded(object view)
{
base.OnViewLoaded(view);
}
public void SetPosition()
{
if (IsPositionMode)
return;
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITThrottleValveOperation.SetMode}", PressureCtrlMode.TVPositionCtrl.ToString());
}
public void SetPressure()
{
if (IsPressureMode)
return;
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITThrottleValveOperation.SetMode}", PressureCtrlMode.TVPressureCtrl.ToString());
}
public void Set()
{
if (IsPressureMode)
SetPressureExecute(Convert.ToDouble(InputSetPointPressure));
else if (IsPositionMode)
SetPositionExecute(Convert.ToDouble(InputSetPointPosition));
}
private void SetPressureExecute(double value)
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITThrottleValveOperation.SetPressure}", (float)value);
}
private void SetPositionExecute(double value)
{
InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITThrottleValveOperation.SetPosition}", (float)value);
}
}
}