123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
-
- using Aitex.Core.Common;
- using Aitex.Core.UI.MVVM;
- using MECF.Framework.Common.Equipment;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- 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.Navigation;
- using System.Windows.Shapes;
- namespace Aitex.Core.UI.Control
- {
- /// <summary>
- /// ATMDualArmRobot.xaml 的交互逻辑
- /// </summary>
- public partial class BoatElevatorMap : UserControl, INotifyPropertyChanged
- {
- protected readonly int MoveTime = 300;
- private const int AnimationTimeout = 3000; // seconds
- private SolidColorBrush SDBrush = new SolidColorBrush(Color.FromArgb(255, 251, 147, 85));
- private SolidColorBrush FDBrush = new SolidColorBrush(Color.FromArgb(255, 170, 147, 255));
- private SolidColorBrush PDBrush = new SolidColorBrush(Color.FromArgb(255, 2, 255, 255));
- private SolidColorBrush M1Brush = new SolidColorBrush(Color.FromArgb(255, 3, 149, 255));
- private SolidColorBrush M2Brush = new SolidColorBrush(Color.FromArgb(255, 255, 111, 171));
- private SolidColorBrush NoneBrush = new SolidColorBrush(Color.FromArgb(255, 213, 210, 200));
- 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(BoatElevatorMap), new PropertyMetadata(null, PropertyChangedCallback));
- public List<string> BoatWafers
- {
- get { return (List<string>)GetValue(BoatWafersProperty); }
- set { SetValue(BoatWafersProperty, value); }
- }
- // Using a DependencyProperty as the backing store for RobotWafers. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty BoatWafersProperty =
- DependencyProperty.Register("BoatWafers", typeof(List<string>), typeof(BoatElevatorMap), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender, BoatWafersPropertyChangedCallback));
- public event PropertyChangedEventHandler PropertyChanged;
- static void PropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- var self = (BoatElevatorMap)d;
- }
- static void BoatWafersPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- var self = (BoatElevatorMap)d;
- }
- public BoatElevatorMap()
- {
- #if DEBUG
- System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = System.Diagnostics.SourceLevels.Critical;
- #endif
- InitializeComponent();
- rootCanvas.DataContext = this;
- bgImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"pack://application:,,,/FurnaceUI;component/Resources/Images/Controls3/Boat.png"));
- }
- private System.Windows.Media.Imaging.BitmapImage bgImage;
- protected override void OnRender(DrawingContext drawingContext)
- {
- if (DesignerProperties.GetIsInDesignMode(this) || BoatWafers == null)
- {
- return;
- }
- int indexWafer = 0;
- if (bgImage != null)
- {
- drawingContext.DrawImage(bgImage, new Rect(13, 50, 150, 600));
- }
- int fristY = 610;
- foreach (var item in BoatWafers)
- {
- if (item == "----" || string.IsNullOrEmpty(item))
- {
- // drawingContext.DrawEllipse(NoneBrush, new Pen(NoneBrush, 1), new Point(85, fristY - indexWafer * 3), 60, 30);
- }
- else
- {
- if (item.StartsWith("P"))
- {
- drawingContext.DrawEllipse(PDBrush, new Pen(NoneBrush, 1), new Point(85, fristY - indexWafer * 3), 60, 30);
- }
- else if (item == "SD")
- {
- drawingContext.DrawEllipse(SDBrush, new Pen(NoneBrush, 1), new Point(85, fristY - indexWafer * 3), 60, 30);
- }
- else if (item == "FD" || item == "ED")
- {
- drawingContext.DrawEllipse(FDBrush, new Pen(NoneBrush, 1), new Point(85, fristY - indexWafer * 3), 60, 30);
- }
- else if (item == "M1")
- {
- drawingContext.DrawEllipse(M1Brush, new Pen(NoneBrush, 1), new Point(85, fristY - indexWafer * 3), 60, 30);
- }
- else if (item == "M2")
- {
- drawingContext.DrawEllipse(M2Brush, new Pen(NoneBrush, 1), new Point(85, fristY - indexWafer * 3), 60, 30);
- }
- }
- indexWafer += 1;
- }
- base.OnRender(drawingContext);
- }
- private int oldCurrentValue = 0;
- int oldX = 0;
- private void Invoke(Action action)
- {
- Dispatcher.Invoke(action);
- }
- private void LogMsg(string msg)
- {
- var source = "ATMRobot";
- Console.WriteLine("{0} {1}", source, msg);
- }
- }
- }
|