using Aitex.Core.Common;
using Aitex.Core.UI.MVVM;
using FurnaceUI.Controls.Common;
//using FurnaceUI.Views.Maintenances;
using MECF.Framework.Common.Equipment;
using Caliburn.Micro;
using Caliburn.Micro.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading;
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.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using CB = MECF.Framework.UI.Client.ClientBase;
using MECF.Framework.Common.CommonData;
using FurnaceUI.Views.Maintenances;
namespace FurnaceUI.Controls.Parts
{
///
/// ATMDualArmRobot.xaml 的交互逻辑
///
public partial class ATMArmRobotTwo : UserControl, INotifyPropertyChanged
{
protected readonly int MoveTime = 300;
private const int AnimationTimeout = 3000; // seconds
public int RotateAngle
{
get { return (int)GetValue(RotateAngleProperty); }
set { SetValue(RotateAngleProperty, value); }
}
// Using a DependencyProperty as the backing store for RotateAngel. This enables animation, styling, binding, etc...
public static readonly DependencyProperty RotateAngleProperty =
DependencyProperty.Register("RotateAngel", typeof(int), typeof(ATMArmRobotTwo), new PropertyMetadata(0));
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(ATMArmRobotTwo), new PropertyMetadata(ModuleName.Robot));
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(ATMArmRobotTwo), new PropertyMetadata(null));
public string RobotTarget
{
get { return (string)GetValue(RobotTargetProperty); }
set { SetValue(RobotTargetProperty, value); }
}
private RobotAction CurrentAction
{
get; set;
}
public string WaferRobotStatus
{
get { return (string)GetValue(WaferRobotStatusProperty); }
set { SetValue(WaferRobotStatusProperty, value); }
}
// Using a DependencyProperty as the backing store for WaferRobotStatus. This enables animation, styling, binding, etc...
public static readonly DependencyProperty WaferRobotStatusProperty =
DependencyProperty.Register("WaferRobotStatus", typeof(string), typeof(ATMArmRobotTwo), new PropertyMetadata(null, WaferRobotStatusChangedCallback));
static void WaferRobotStatusChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var self = (ATMArmRobotTwo)d;
var test = d;
switch ((string)e.NewValue)
{
case "Homing":
self.RootImagePath = "/FurnaceUI;component/Resources/Images/Controls3/hgz1y.png";
self.Canvas1ImagePath = "/FurnaceUI;component/Resources/Images/Controls3/rb1y.png";
self.Canvas2ImagePath = "/FurnaceUI;component/Resources/Images/Controls3/rb1y.png";
self.Canvas3ImagePath = "/FurnaceUI;component/Resources/Images/Controls3/rb3y.png";
break;
case "Idle":
case "InTransfer":
case "Picking":
case "Placing":
self.RootImagePath = "/FurnaceUI;component/Resources/Images/Controls3/hgz1g.png";
self.Canvas1ImagePath = "/FurnaceUI;component/Resources/Images/Controls3/rb1g.png";
self.Canvas2ImagePath = "/FurnaceUI;component/Resources/Images/Controls3/rb1g.png";
self.Canvas3ImagePath = "/FurnaceUI;component/Resources/Images/Controls3/rb3g.png";
break;
case "Error":
self.RootImagePath = "/FurnaceUI;component/Resources/Images/Controls3/hgz1r.png";
self.Canvas1ImagePath = "/FurnaceUI;component/Resources/Images/Controls3/rb1r.png";
self.Canvas2ImagePath = "/FurnaceUI;component/Resources/Images/Controls3/rb1r.png";
self.Canvas3ImagePath = "/FurnaceUI;component/Resources/Images/Controls3/rb3r.png";
break;
default:
break;
}
}
public string RootImagePath
{
get { return (string)GetValue(RootImagePathProperty); }
set { SetValue(RootImagePathProperty, value); }
}
// Using a DependencyProperty as the backing store for RootImagePath. This enables animation, styling, binding, etc...
public static readonly DependencyProperty RootImagePathProperty =
DependencyProperty.Register("RootImagePath", typeof(string), typeof(ATMArmRobotTwo), new FrameworkPropertyMetadata("/FurnaceUI;component/Resources/Images/Controls3/hgz1y.png", FrameworkPropertyMetadataOptions.AffectsRender));
public string Canvas1ImagePath
{
get { return (string)GetValue(Canvas1ImagePathProperty); }
set { SetValue(Canvas1ImagePathProperty, value); }
}
// Using a DependencyProperty as the backing store for RootImagePath. This enables animation, styling, binding, etc...
public static readonly DependencyProperty Canvas1ImagePathProperty =
DependencyProperty.Register("Canvas1ImagePath", typeof(string), typeof(ATMArmRobotTwo), new FrameworkPropertyMetadata("/FurnaceUI;component/Resources/Images/Controls3/rb1y.png", FrameworkPropertyMetadataOptions.AffectsRender));
public string Canvas2ImagePath
{
get { return (string)GetValue(Canvas2ImagePathProperty); }
set { SetValue(Canvas2ImagePathProperty, value); }
}
// Using a DependencyProperty as the backing store for RootImagePath. This enables animation, styling, binding, etc...
public static readonly DependencyProperty Canvas2ImagePathProperty =
DependencyProperty.Register("Canvas2ImagePath", typeof(string), typeof(ATMArmRobotTwo), new FrameworkPropertyMetadata("/FurnaceUI;component/Resources/Images/Controls3/rb1y.png", FrameworkPropertyMetadataOptions.AffectsRender));
public string Canvas3ImagePath
{
get { return (string)GetValue(Canvas3ImagePathProperty); }
set { SetValue(Canvas3ImagePathProperty, value); }
}
// Using a DependencyProperty as the backing store for RootImagePath. This enables animation, styling, binding, etc...
public static readonly DependencyProperty Canvas3ImagePathProperty =
DependencyProperty.Register("Canvas3ImagePath", typeof(string), typeof(ATMArmRobotTwo), new FrameworkPropertyMetadata("/FurnaceUI;component/Resources/Images/Controls3/rb3y.png", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty RobotTargetProperty =
DependencyProperty.Register("RobotTarget", typeof(string), typeof(ATMArmRobotTwo), new FrameworkPropertyMetadata(ModuleName.Robot.ToString(), FrameworkPropertyMetadataOptions.AffectsRender));
public Dictionary StationPosition
{
get { return (Dictionary)GetValue(StationPositionProperty); }
set { SetValue(StationPositionProperty, value); }
}
// Using a DependencyProperty as the backing store for StationPosition. This enables animation, styling, binding, etc...
public static readonly DependencyProperty StationPositionProperty =
DependencyProperty.Register("StationPosition", typeof(Dictionary), typeof(ATMArmRobotTwo), new PropertyMetadata(null, PropertyChangedCallback));
public string ArmAExtended
{
get { return (string)GetValue(ArmAExtendedProperty); }
set { SetValue(ArmAExtendedProperty, value); }
}
// Using a DependencyProperty as the backing store for ArmAExtended. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ArmAExtendedProperty =
DependencyProperty.Register("ArmAExtended", typeof(string), typeof(ATMArmRobotTwo), new FrameworkPropertyMetadata(RobotConstant.RobotRetract, FrameworkPropertyMetadataOptions.AffectsRender));
public string ArmBExtended
{
get { return (string)GetValue(ArmBExtendedProperty); }
set { SetValue(ArmBExtendedProperty, value); }
}
// Using a DependencyProperty as the backing store for armBExtended. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ArmBExtendedProperty =
DependencyProperty.Register("ArmBExtended", typeof(string), typeof(ATMArmRobotTwo), new FrameworkPropertyMetadata(RobotConstant.RobotRetract, FrameworkPropertyMetadataOptions.AffectsRender));
public WaferInfo[] RobotWafers
{
get { return (WaferInfo[])GetValue(RobotWafersProperty); }
set { SetValue(RobotWafersProperty, value); }
}
// Using a DependencyProperty as the backing store for RobotWafers. This enables animation, styling, binding, etc...
public static readonly DependencyProperty RobotWafersProperty =
DependencyProperty.Register("RobotWafers", typeof(WaferInfo[]), typeof(ATMArmRobotTwo), new PropertyMetadata(null, PropertyChangedCallback));
public CB.WaferInfo Wafer1
{
get { return (CB.WaferInfo)GetValue(Wafer1Property); }
set { SetValue(Wafer1Property, value);
}
}
// Using a DependencyProperty as the backing store for Wafer1. This enables animation, styling, binding, etc...
public static readonly DependencyProperty Wafer1Property =
DependencyProperty.Register("Wafer1", typeof(CB.WaferInfo), typeof(ATMArmRobotTwo), new PropertyMetadata(null));
public CB.WaferInfo Wafer2
{
get { return (CB.WaferInfo)GetValue(Wafer2Property); }
set { SetValue(Wafer2Property, value); }
}
// Using a DependencyProperty as the backing store for Wafer2. This enables animation, styling, binding, etc...
public static readonly DependencyProperty Wafer2Property =
DependencyProperty.Register("Wafer2", typeof(CB.WaferInfo), typeof(ATMArmRobotTwo), new PropertyMetadata(null));
public CB.WaferInfo Wafer3
{
get { return (CB.WaferInfo)GetValue(Wafer3Property); }
set { SetValue(Wafer3Property, value); }
}
// Using a DependencyProperty as the backing store for Wafer3. This enables animation, styling, binding, etc...
public static readonly DependencyProperty Wafer3Property =
DependencyProperty.Register("Wafer3", typeof(CB.WaferInfo), typeof(ATMArmRobotTwo), new PropertyMetadata(null));
public CB.WaferInfo Wafer4
{
get { return (CB.WaferInfo)GetValue(Wafer4Property); }
set { SetValue(Wafer4Property, value); }
}
// Using a DependencyProperty as the backing store for Wafer2. This enables animation, styling, binding, etc...
public static readonly DependencyProperty Wafer4Property =
DependencyProperty.Register("Wafer4", typeof(CB.WaferInfo), typeof(ATMArmRobotTwo), new PropertyMetadata(null));
public CB.WaferInfo Wafer5
{
get { return (CB.WaferInfo)GetValue(Wafer5Property); }
set { SetValue(Wafer5Property, value); }
}
// Using a DependencyProperty as the backing store for Wafer2. This enables animation, styling, binding, etc...
public static readonly DependencyProperty Wafer5Property =
DependencyProperty.Register("Wafer5", typeof(CB.WaferInfo), typeof(ATMArmRobotTwo), new PropertyMetadata(null));
public RobotMoveInfo RobotMoveInfo
{
get { return (RobotMoveInfo)GetValue(RobotMoveInfoProperty); }
set { SetValue(RobotMoveInfoProperty, value); }
}
public static readonly DependencyProperty RobotMoveInfoProperty =
DependencyProperty.Register("RobotMoveInfo", typeof(RobotMoveInfo), typeof(ATMArmRobotTwo), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
private string CurrentPosition;
private string CurrentArmA;
private string CurrentArmB;
private List