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,125 @@
using System;
using System.IO;
using System.Reflection;
using Aitex.Core.Account;
using Aitex.Core.RT.Log;
using Caliburn.Micro;
using MECF.Framework.Common.Account.Extends;
using MECF.Framework.Common.Utilities;
using MECF.Framework.UI.Client.CenterViews.Configs.Accounts;
using MECF.Framework.UI.Client.CenterViews.Configs.Roles;
using MECF.Framework.UI.Core.Accounts;
namespace MECF.Framework.UI.Client.ClientBase
{
public class BaseApp
{
#region Variables
public ModuleDataMonitor _dataMonitor;
#endregion
#region Constructors
public BaseApp()
{
UserMode = UserMode.None;
Initialized = false;
Configure();
}
#endregion
#region Properites
public LoginClientInfo ClientInfo { get; private set; }
public UserContext UserContext { get; private set; }
public MenuManager MenuManager { get; private set; }
public UserMode UserMode { get; set; }
public bool Initialized { get; private set; }
public static BaseApp Instance { get; set; }
#endregion
#region Methods
public void LoadSystemInfo()
{
var myInfo = new LoginClientInfo();
myInfo.HostName = Environment.MachineName;
myInfo.UserName = Environment.UserName;
myInfo.OSVersion = Environment.OSVersion.ToString();
try
{
myInfo.ComputerSystem = SystemInfoHelper.GetComputerSystem();
myInfo.CpuInfo = SystemInfoHelper.GetCpuInfo();
myInfo.LogicalDisk = SystemInfoHelper.GetLogicalDiskInfo();
}
catch (Exception ex)
{
LOG.Error("Unable to get system information.", ex);
}
finally
{
ClientInfo = myInfo;
}
}
public void Initialize(bool force = false)
{
if (Initialized && !force)
return;
MenuManager = new MenuManager();
UserContext = new UserContext();
var file = $"{System.AppDomain.CurrentDomain.BaseDirectory}MECF.Framework.UI.Client.dll";
if (File.Exists(file))
{
var assembly = Assembly.LoadFile(file);
AssemblySource.Instance.Add(assembly);
}
OnInitialize();
//must be called after specific project initialized
_dataMonitor = new ModuleDataMonitor();
Initialized = true;
}
public virtual void Dispose()
{
}
protected void Configure()
{
//config skin/language...
OnConfiguration();
}
protected virtual void OnInitialize()
{
}
protected virtual void OnConfiguration()
{
}
public virtual void SwitchPage(string mainMenu, string subMenu, object parameter)
{
}
#endregion
}
}
@@ -0,0 +1,46 @@
using Caliburn.Micro.Core;
using MECF.Framework.Common.Account.Permissions;
namespace MECF.Framework.UI.Client.ClientBase
{
public class BaseModel : Screen
{
#region Variables
protected readonly IEventAggregator EventAggregator;
private MenuPermissionEnum _permission = MenuPermissionEnum.MP_NONE;
#endregion
#region Constructors
protected BaseModel()
{
EventAggregator = IoC.Get<IEventAggregator>();
EventAggregator?.Subscribe(this);
}
#endregion
#region Properties
public bool IsPermission => Permission == MenuPermissionEnum.MP_READ_WRITE;
public MenuPermissionEnum Permission
{
get => _permission;
set
{
if (_permission == value)
return;
_permission = value;
NotifyOfPropertyChange();
}
}
#endregion
}
}
@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Caliburn.Micro.Core;
//namespace MECF.Framework.UI.Client.ClientBase
//{
// public class CarrierInfoData : PropertyChangedBase
// {
// private int _WaferStatus = 0; // WaferStatus.Empty;
// public int WaferStatus
// {
// get { return _WaferStatus; }
// set { _WaferStatus = value; NotifyOfPropertyChange("WaferStatus"); }
// }
// /// <summary>
// /// SlotID start from 0
// /// </summary>
// private int _slotID;
// public int SlotID
// {
// get { return _slotID; }
// set { _slotID = value; NotifyOfPropertyChange("SlotID"); }
// }
// /// <summary>
// /// SlotIndex start from 1
// /// </summary>
// private int _slotIndex;
// public int SlotIndex
// {
// get { return _slotIndex; }
// set { _slotIndex = value; NotifyOfPropertyChange("SlotIndex"); }
// }
// private string _moduleID;
// public string ModuleID
// {
// get { return _moduleID; }
// set { _moduleID = value; NotifyOfPropertyChange("ModuleID"); }
// }
// private string _waferid;
// public string WaferID
// {
// get { return _waferid; }
// set { _waferid = value; NotifyOfPropertyChange("WaferID"); }
// }
// private string _sourceName;
// public string SourceName
// {
// get { return _sourceName; }
// set { _sourceName = value; NotifyOfPropertyChange("SourceName"); }
// }
// private string _sequenceName = string.Empty;
// public string SequenceName
// {
// get { return _sequenceName; }
// set { _sequenceName = value; NotifyOfPropertyChange("SequenceName"); }
// }
// private string _originName = string.Empty;
// public string OriginName
// {
// get { return _originName; }
// set { _originName = value; NotifyOfPropertyChange("OriginName"); }
// }
// }
//}
@@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace OpenSEMI.ClientBase.Command
{
public class BaseCommand<T> : ICommand
{
#region Fields
readonly Action<T> _execute = null;
readonly Predicate<T> _canExecute = null;
#endregion // Fields
#region Constructors
public BaseCommand(Action<T> execute)
: this(execute, null)
{
}
/// <summary>
/// Creates a new command.
/// </summary>
/// <param name="execute">The execution logic.</param>
/// <param name="canExecute">The execution status logic.</param>
public BaseCommand(Action<T> execute, Predicate<T> canExecute)
{
if (execute == null)
throw new ArgumentNullException("execute");
_execute = execute;
_canExecute = canExecute;
}
#endregion // Constructors
#region ICommand Members
public bool CanExecute(object parameter)
{
return _canExecute == null ? true : _canExecute((T)parameter);
}
public event EventHandler CanExecuteChanged
{
add
{
if (_canExecute != null)
CommandManager.RequerySuggested += value;
}
remove
{
if (_canExecute != null)
CommandManager.RequerySuggested -= value;
}
}
public void Execute(object parameter)
{
_execute((T)parameter);
}
#endregion // ICommand Members
}
public class BaseCommand : ICommand
{
#region Fields
readonly Action _execute;
readonly Func<bool> _canExecute;
#endregion // Fields
#region Constructors
/// <summary>
/// Creates a new command that can always execute.
/// </summary>
/// <param name="execute">The execution logic.</param>
public BaseCommand(Action execute)
: this(execute, null)
{
}
/// <summary>
/// Creates a new command.
/// </summary>
/// <param name="execute">The execution logic.</param>
/// <param name="canExecute">The execution status logic.</param>
public BaseCommand(Action execute, Func<bool> canExecute)
{
if (execute == null)
throw new ArgumentNullException("execute");
_execute = execute;
_canExecute = canExecute;
}
#endregion // Constructors
#region ICommand Members
public bool CanExecute(object parameter)
{
return _canExecute == null ? true : _canExecute();
}
public event EventHandler CanExecuteChanged
{
add
{
if (_canExecute != null)
CommandManager.RequerySuggested += value;
}
remove
{
if (_canExecute != null)
CommandManager.RequerySuggested -= value;
}
}
public void Execute(object parameter)
{
_execute();
}
#endregion
}
}
@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace OpenSEMI.ClientBase.Command
{
public class CommandParameter<TCustomParameter>
{
public TCustomParameter CustomParameter { get; private set; }
protected CommandParameter(TCustomParameter customParameter)
{
this.CustomParameter = customParameter;
}
public static CommandParameter<TCustomParameter> Cast(object parameter)
{
var parameterToCast = parameter as CommandParameter<object>;
if (parameterToCast == null)
{
throw new InvalidCastException(string.Format("Failed to case {0} to {1}",
parameter.GetType(), typeof(CommandParameter<object>)));
}
var castedParameter = new CommandParameter<TCustomParameter>(
(TCustomParameter)parameterToCast.CustomParameter);
return castedParameter;
}
}
public class EventCommandParameter<TCustomParameter, TEventArgs> : CommandParameter<TCustomParameter>
where TEventArgs : RoutedEventArgs
{
public RoutedEvent RoutedEvent { get; private set; }
public TEventArgs EventArgs { get; private set; }
public EventCommandParameter(
TCustomParameter customParameter,
RoutedEvent routedEvent,
TEventArgs eventArgs)
: base(customParameter)
{
this.RoutedEvent = routedEvent;
this.EventArgs = eventArgs;
}
public static new EventCommandParameter<TCustomParameter, TEventArgs> Cast(object parameter)
{
var parameterToCast = parameter as EventCommandParameter<object, RoutedEventArgs>;
if (parameterToCast == null)
{
throw new InvalidCastException(string.Format("Failed to case {0} to {1}",
parameter.GetType(), typeof(EventCommandParameter<object, RoutedEventArgs>)));
}
var castedParameter = new EventCommandParameter<TCustomParameter, TEventArgs>(
(TCustomParameter)parameterToCast.CustomParameter,
parameterToCast.RoutedEvent,
(TEventArgs)parameterToCast.EventArgs);
return castedParameter;
}
}
public class PropertyCommandParameter<TCustomParameter, TValue> : CommandParameter<TCustomParameter>
{
public DependencyProperty Property { get; private set; }
public TValue Value { get; private set; }
public PropertyCommandParameter(
TCustomParameter customParameter,
DependencyProperty property,
TValue value)
: base(customParameter)
{
this.Property = property;
this.Value = value;
}
public static new PropertyCommandParameter<TCustomParameter, TValue> Cast(object parameter)
{
var parameterToCast = parameter as PropertyCommandParameter<object, object>;
if (parameterToCast == null)
{
throw new InvalidCastException(string.Format("Failed to case {0} to {1}",
parameter.GetType(), typeof(PropertyCommandParameter<object, object>)));
}
var castedParameter = new PropertyCommandParameter<TCustomParameter, TValue>(
(TCustomParameter)parameterToCast.CustomParameter,
parameterToCast.Property,
(TValue)parameterToCast.Value);
return castedParameter;
}
}
}
@@ -0,0 +1,44 @@
using System.Windows;
namespace OpenSEMI.ClientBase.Command
{
public interface ICommandTrigger
{
void Initialize(FrameworkElement source);
}
public static class CommandSource
{
public static ICommandTrigger GetTrigger(FrameworkElement source)
{
return (ICommandTrigger)source.GetValue(TriggerProperty);
}
public static void SetTrigger(FrameworkElement source, ICommandTrigger value)
{
source.SetValue(TriggerProperty, value);
}
// Using a DependencyProperty as the backing store for Trigger. This enables animation, styling, binding, etc...
public static readonly DependencyProperty TriggerProperty =
DependencyProperty.RegisterAttached(
"Trigger1",
typeof(ICommandTrigger),
typeof(CommandSource),
new UIPropertyMetadata(
null,
TriggerPropertyChanged));
private static void TriggerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
FrameworkElement element = d as FrameworkElement;
ICommandTrigger commandTrigger = e.NewValue as ICommandTrigger;
if (commandTrigger != null)
{
commandTrigger.Initialize(element);
}
}
}
}
@@ -0,0 +1,94 @@
using System.Windows;
using System.Windows.Input;
namespace OpenSEMI.ClientBase.Command
{
public abstract class CommandTrigger : Freezable, ICommandTrigger
{
public bool IsInitialized { get; set; }
#region Dependency Properties
#region Command Property
/// <value>Identifies the Command dependency property</value>
public static readonly DependencyProperty CommandProperty =
DependencyProperty.Register("Command", typeof(ICommand), typeof(CommandTrigger),
new FrameworkPropertyMetadata(null));
/// <value>description for Command property</value>
public ICommand Command
{
get { return (ICommand)GetValue(CommandProperty); }
set { SetValue(CommandProperty, value); }
}
#endregion
#region CustomParameter Property
/// <value>Identifies the CustomParameterProperty dependency property</value>
public static readonly DependencyProperty CustomParameterProperty =
DependencyProperty.Register("CustomParameter", typeof(object), typeof(CommandTrigger),
new FrameworkPropertyMetadata(null));
/// <value>description for CustomParameter property</value>
public object CustomParameter
{
get { return (object)GetValue(CustomParameterProperty); }
set { SetValue(CustomParameterProperty, value); }
}
#endregion
#region CommandTarget Property
/// <value>Identifies the CommandTarget dependency property</value>
public static readonly DependencyProperty CommandTargetProperty =
DependencyProperty.Register("CommandTarget", typeof(IInputElement), typeof(CommandTrigger),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits));
/// <value>description for CommandTarget property</value>
public IInputElement CommandTarget
{
get { return (IInputElement)GetValue(CommandTargetProperty); }
set { SetValue(CommandTargetProperty, value); }
}
#endregion
#endregion
#region Internals
void ICommandTrigger.Initialize(FrameworkElement source)
{
if (IsInitialized)
return;
InitializeCore(source);
IsInitialized = true;
}
protected abstract void InitializeCore(FrameworkElement source);
protected void ExecuteCommand(CommandParameter<object> parameter)
{
if (Command == null)
return;
RoutedCommand routedCommand = Command as RoutedCommand;
if (routedCommand != null)
{
routedCommand.Execute(parameter, CommandTarget);
}
else
{
Command.Execute(parameter);
}
}
#endregion
}
}
@@ -0,0 +1,27 @@
using System.Collections.Generic;
using System.Windows;
namespace OpenSEMI.ClientBase.Command
{
public sealed class CommandTriggerGroup : FreezableCollection<CommandTrigger>, ICommandTrigger
{
private readonly HashSet<ICommandTrigger> _initList = new HashSet<ICommandTrigger>();
void ICommandTrigger.Initialize(FrameworkElement source)
{
foreach (ICommandTrigger child in this)
{
if (!_initList.Contains(child))
{
InitializeCommandSource(source, child);
}
}
}
private void InitializeCommandSource(FrameworkElement source, ICommandTrigger child)
{
child.Initialize(source);
_initList.Add(child);
}
}
}
@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace OpenSEMI.ClientBase.Command
{
public sealed class EventCommandTrigger : CommandTrigger
{
#region Dependency Properties
#region RoutedEvent Property
/// <value>Identifies the RoutedEvent dependency property</value>
public static readonly DependencyProperty RoutedEventProperty =
DependencyProperty.Register("RoutedEvent", typeof(RoutedEvent), typeof(EventCommandTrigger),
new FrameworkPropertyMetadata(null));
/// <value>description for RoutedEvent property</value>
public RoutedEvent RoutedEvent
{
get { return (RoutedEvent)GetValue(RoutedEventProperty); }
set { SetValue(RoutedEventProperty, value); }
}
#endregion
#endregion
protected override Freezable CreateInstanceCore()
{
return new EventCommandTrigger();
}
protected override void InitializeCore(FrameworkElement source)
{
source.AddHandler(RoutedEvent, (RoutedEventHandler)ExecuteCommand);
}
private void ExecuteCommand(object sender, RoutedEventArgs args)
{
CommandParameter<object> parameter = new EventCommandParameter<object, RoutedEventArgs>(
CustomParameter, RoutedEvent, args);
base.ExecuteCommand(parameter);
}
}
}
@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace OpenSEMI.ClientBase.Command
{
public class PropertyCommandTrigger : CommandTrigger
{
#region Dependency Properties
#region Property Property
/// <value>Identifies the Property dependency property</value>
public static readonly DependencyProperty PropertyProperty =
DependencyProperty.Register("Property", typeof(DependencyProperty), typeof(PropertyCommandTrigger),
new FrameworkPropertyMetadata(null));
/// <value>description for Property property</value>
public DependencyProperty Property
{
get { return (DependencyProperty)GetValue(PropertyProperty); }
set { SetValue(PropertyProperty, value); }
}
#endregion
#region Value Property
/// <value>Identifies the Value dependency property</value>
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(string), typeof(PropertyCommandTrigger),
new FrameworkPropertyMetadata(null));
/// <value>description for Value property</value>
public string Value
{
get { return (string)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
#endregion
#endregion
protected override Freezable CreateInstanceCore()
{
return new PropertyCommandTrigger();
}
#region T Property
/// <value>Identifies the T dependency property</value>
public static readonly DependencyProperty TProperty =
DependencyProperty.Register("T", typeof(object), typeof(PropertyCommandTrigger),
new FrameworkPropertyMetadata(null, OnTChanged));
/// <value>description for T property</value>
public object T
{
get { return (object)GetValue(TProperty); }
set { SetValue(TProperty, value); }
}
/// <summary>
/// Invoked on T change.
/// </summary>
/// <param name="d">The object that was changed</param>
/// <param name="e">Dependency property changed event arguments</param>
static void OnTChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
#endregion
protected override void InitializeCore(FrameworkElement source)
{
DependencyPropertyDescriptor descriptor = DependencyPropertyDescriptor.FromProperty(Property, source.GetType());
descriptor.AddValueChanged(source, (s, e) =>
{
CommandParameter<object> parameter = new PropertyCommandParameter<object, object>(
CustomParameter, Property, source.GetValue(Property));
object value = Value;
if (descriptor.Converter.CanConvertFrom(typeof(string)))
{
value = descriptor.Converter.ConvertFromString(Value);
}
if (object.Equals(source.GetValue(Property), value))
ExecuteCommand(parameter);
});
}
}
}
@@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.ClientBase
{
public enum WaferStatus
{
Empty = 0,
Normal = 1,
Crossed = 2,
Double = 3,
Unknown = 4,
Dummy = 5
}
[Flags]
public enum DialogButton
{
Yes = 1,
OK = 2,
Continue = 4,
Transfer = 8,
Restart = 16,
No = 32,
Cancel = 64,
[Description("Yes To All")]
YesToAll = 128
}
public enum DialogType
{
INFO,
WARNING,
ERROR,
CONFIRM
}
public enum ServiceState
{
Normal,
Shutdown,
Fault,
Disconnect
}
public enum UserMode
{
None,
Normal,
Lock,
Logoff,
Exit,
Shutdown,
Breakdown,
ReadOnly
}
public enum PageID
{
PAGE1,
PAGE2,
PAGE3,
MAX_PAGE
}
public enum AuthorizeResult
{
None = -1,
WrongPwd = 1,
HasLogin = 2,
NoMatchRole = 3,
NoSession = 4,
NoMatchUser = 5
}
/// <summary>
/// Process control mode
/// </summary>
public enum CtrlMode
{
VIEW,
EDIT
}
public enum ResultYesNo
{
YES, NO
}
}
@@ -0,0 +1,442 @@
using Aitex.Core.Common;
using Aitex.Core.RT.Log;
using Aitex.Core.UI.Control;
using Caliburn.Micro;
using DocumentFormat.OpenXml.VariantTypes;
using MECF.Framework.Common.DataCenter;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.OperationCenter;
using MECF.Framework.Common.SubstrateTrackings;
using MECF.Framework.UI.Client.CenterViews.Editors;
using MECF.Framework.UI.Client.TrayThickness;
using OpenSEMI.Ctrlib.Controls;
using SciChart.Core.Extensions;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using OpenSEMI.ClientBase;
using RTDefine = Aitex.Core.Common;
namespace MECF.Framework.UI.Client.ClientBase
{
public class MenuElement
{
public string Name { get; set; }
public string Invoke { get; set; }
public bool IsSeparator { get; set; }
}
public class ContextMenuManager
{
public bool ShowAligner { get; set; }
public bool ShowCooling { get; set; }
public ContextMenuManager()
{
_slotMenus = InitMenus(_SlotMenuElements);
_carrierMenus = InitMenus(_carrierMenuElements);
ShowAligner = true;
ShowCooling = true;
}
#region single Instance
private static ContextMenuManager m_Instance = null;
public static ContextMenuManager Instance
{
get
{
if (m_Instance == null)
{
m_Instance = new ContextMenuManager();
}
return m_Instance;
}
}
#endregion
public ContextMenu GetSlotMenus(Slot slot)
{
if (slot != null)
{
if(slot.ModuleID == ModuleName.CassAL.ToString() || slot.ModuleID == ModuleName.CassAR.ToString())
{
return GetWaferMenus(slot);
}
else if (slot.ModuleID == ModuleName.CassBL.ToString())
{
return GetTrayMenus(slot);
}
else if (slot.ModuleID == ModuleName.PM1.ToString() || slot.ModuleID == ModuleName.PM2.ToString())
{
return GetPMMenus(slot);
}
else
{
return GetDeleteMenus(slot);
}
}
return null;
}
public void OnContextMenuClick(object sender, RoutedEventArgs args)
{
try
{
MenuItem m_menu = sender as MenuItem;
Slot CurrentSlot = ContextMenuService.GetPlacementTarget(LogicalTreeHelper.GetParent(m_menu)) as Slot;
if (CurrentSlot == null)
return;
MenuElement ele = m_menu.Tag as MenuElement;
//if (ele.Invoke == "ReturnWafer")
//{
// ReturnWafer(ele.Invoke, CurrentSlot);
//}
//else
//{
// InvokeClient.Instance.Service.DoOperation(ele.Invoke, CurrentSlot.ModuleID, CurrentSlot.SlotID);
//}
//var param = new object[] { ModuleName.LP1, 5, WaferStatus.Normal };
if (ele.Invoke == "AlterInfo")
{
SlotEditorDialogBox slotDialog = new SlotEditorDialogBox();
slotDialog.Title = "Wafer Editor";
slotDialog.RecipeName = CurrentSlot.RecipeName;
slotDialog.TrayProcessCount = CurrentSlot.TrayProcessCount;
slotDialog.ModuleID = CurrentSlot.ModuleID;
slotDialog.SlotID = CurrentSlot.SlotID;
slotDialog.TrayBelongTo = CurrentSlot.TrayBelongTo;
slotDialog.ShowDialog();
}
else if (ele.Invoke == "TrayInfo" || ele.Invoke == "PMInfo")
{
ShowCoatingWin(CurrentSlot, ele.Invoke);
}
else
{
InvokeClient.Instance.Service.DoOperation(ele.Invoke, CurrentSlot.ModuleID, CurrentSlot.SlotID);
}
}
catch (Exception ex)
{
LOG.Write(ex);
}
}
private static void ShowCoatingWin(Slot CurrentSlot,string module)
{
//复杂获取TrayID,不是最优用法
ModuleName chamber = ModuleHelper.Converter(CurrentSlot.ModuleID);
Dictionary<string, object> data = QueryDataClient.Instance.Service.PollData(new List<string> { chamber.ToString() + ".ModuleWaferList" });
WaferInfoRt[] _waferInfo = data[chamber.ToString() + ".ModuleWaferList"] as WaferInfoRt[];
int slot = _waferInfo[CurrentSlot.SlotID].Slot; //(位置获取Tray的ID)
string guid = _waferInfo[CurrentSlot.SlotID].TrayInnerID.ToString(); //(位置获取Tray的ID)
//var wins = Application.Current.Windows.OfType<WinTrayThicknessDataView>().ToArray();
//if (wins.Any())
//{
// foreach (WinTrayThicknessDataView w in wins)
// {
// if (w.WindowState == WindowState.Minimized)
// w.WindowState = WindowState.Normal;
// w.Show();
// w.Activate();
// }
//}
//else
//{
var wm = new WindowManager();
UiViewModelBase model;
if (module.Contains("PM"))
model = new WinPMThicknessDataViewModel(chamber.ToString());
else if (!_waferInfo[CurrentSlot.SlotID].IsTrayEmpty)
model = new WinTrayThicknessDataViewModel(guid, chamber, slot);
else
return;
dynamic settings = new ExpandoObject();
settings.WindowStartupLocation = WindowStartupLocation.CenterOwner;
settings.Title = "Edit Tray Info.";
settings.ResizeMode = ResizeMode.NoResize;
settings.ShowInTaskbar = false;
wm.ShowDialog(model, null, settings);
//}
//正确方法获取TrayID
//ModuleInfo moduleInfo = ModuleManager.ModuleInfos[CurrentSlot.ModuleID];
//var wi = ModuleManager.ModuleInfos[CurrentSlot.ModuleID].WaferManager.Wafers[CurrentSlot.SlotID];
//int _trayOriginSlot = wi.TrayOriginSlot;
}
private ContextMenu InitMenus(List<MenuElement> menus)
{
ContextMenu cm = new ContextMenu();
foreach (MenuElement element in menus)
{
if (element.IsSeparator)
{
cm.Items.Add(new Separator());
}
else
{
MenuItem m_item = new MenuItem();
m_item.Header = element.Name;
m_item.Tag = element;
m_item.Click += new RoutedEventHandler(OnContextMenuClick);
m_item.IsEnabled = true;
cm.Items.Add(m_item);
}
}
return cm;
}
#region Wafer Menus
private ContextMenu _slotMenus;
public ContextMenu SlotMenus
{
get { return _slotMenus; }
}
private readonly List<MenuElement> _SlotMenuElements = new List<MenuElement>()
{
new MenuElement(){ Name="Create Wafer", Invoke="CreateWafer"},
new MenuElement(){ Name="Create Tray", Invoke="CreateTray"},
new MenuElement(){ Name="Delete Wafer", Invoke="DeleteWafer"},
new MenuElement(){ Name="Delete Tray", Invoke="DeleteTray"},
new MenuElement(){ Name="-", IsSeparator = true},
new MenuElement(){ Name="Return Wafer", Invoke="ReturnWafer"},
new MenuElement(){ Name="Alter Info", Invoke="AlterInfo"},
new MenuElement(){ Name="Tray Info", Invoke="TrayInfo"},
new MenuElement(){ Name="PM Info", Invoke="PMInfo"}
};
public ContextMenu GetWaferMenus(Slot slot)
{
MenuItem createWafer = _slotMenus.Items.GetItemAt(0) as MenuItem;
MenuItem createTray = _slotMenus.Items.GetItemAt(1) as MenuItem;
MenuItem deleteWafer = _slotMenus.Items.GetItemAt(2) as MenuItem;
MenuItem deleteTray = _slotMenus.Items.GetItemAt(3) as MenuItem;
MenuItem returnWafer = _slotMenus.Items.GetItemAt(5) as MenuItem;
Separator separator = _slotMenus.Items.GetItemAt(4) as Separator;
MenuItem pmInfer = _slotMenus.Items.GetItemAt(8) as MenuItem;
createWafer.IsEnabled = (WaferStatus)slot.WaferStatus == WaferStatus.Empty ;
deleteWafer.IsEnabled = (WaferStatus)slot.WaferStatus != WaferStatus.Empty ;
returnWafer.IsEnabled = (WaferStatus)slot.WaferStatus != WaferStatus.Empty && !slot.ModuleID.StartsWith("Cass");
createWafer.Visibility = Visibility.Visible;
deleteWafer.Visibility = Visibility.Visible;
createTray.Visibility = Visibility.Collapsed;
deleteTray.Visibility = Visibility.Collapsed;
separator.Visibility = Visibility.Visible;
returnWafer.Visibility = Visibility.Collapsed;
pmInfer.Visibility = Visibility.Collapsed;
return _slotMenus;
}
public ContextMenu GetTrayMenus(Slot slot)
{
MenuItem createWafer = _slotMenus.Items.GetItemAt(0) as MenuItem;
MenuItem createTray = _slotMenus.Items.GetItemAt(1) as MenuItem;
MenuItem deleteWafer = _slotMenus.Items.GetItemAt(2) as MenuItem;
MenuItem deleteTray = _slotMenus.Items.GetItemAt(3) as MenuItem;
MenuItem returnWafer = _slotMenus.Items.GetItemAt(5) as MenuItem;
Separator separator = _slotMenus.Items.GetItemAt(4) as Separator;
MenuItem pmInfer = _slotMenus.Items.GetItemAt(8) as MenuItem;
createTray.IsEnabled = true; //slot.TrayStatus == 0;
deleteTray.IsEnabled = true; //slot.TrayStatus != 0;
createTray.Visibility = Visibility.Visible;
deleteTray.Visibility = Visibility.Visible;
separator.Visibility = Visibility.Collapsed;
deleteWafer.Visibility = Visibility.Collapsed;
createWafer.Visibility = Visibility.Collapsed;
returnWafer.Visibility = Visibility.Collapsed;
pmInfer.Visibility = Visibility.Collapsed;
return _slotMenus;
}
public ContextMenu GetPMMenus(Slot slot)
{
GetDeleteMenus(slot);
MenuItem pmInfer = _slotMenus.Items.GetItemAt(8) as MenuItem;
pmInfer.Visibility = Visibility.Visible;
return _slotMenus;
}
public ContextMenu GetAllMenus(Slot slot)
{
MenuItem createWafer = _slotMenus.Items.GetItemAt(0) as MenuItem;
MenuItem createTray = _slotMenus.Items.GetItemAt(1) as MenuItem;
MenuItem deleteWafer = _slotMenus.Items.GetItemAt(2) as MenuItem;
MenuItem deleteTray = _slotMenus.Items.GetItemAt(3) as MenuItem;
MenuItem returnWafer = _slotMenus.Items.GetItemAt(5) as MenuItem;
Separator separator = _slotMenus.Items.GetItemAt(4) as Separator;
createWafer.IsEnabled = (WaferStatus)slot.WaferStatus == WaferStatus.Empty ;
createTray.IsEnabled = true;
deleteWafer.IsEnabled = (WaferStatus)slot.WaferStatus != WaferStatus.Empty ;
deleteTray.IsEnabled = true; // slot.TrayStatus != 0;
returnWafer.IsEnabled = (WaferStatus)slot.WaferStatus != WaferStatus.Empty && !slot.ModuleID.StartsWith("Cass");
separator.Visibility = Visibility.Visible;
createWafer.Visibility = Visibility.Visible;
deleteWafer.Visibility = Visibility.Visible;
createTray.Visibility = Visibility.Visible;
deleteTray.Visibility = Visibility.Visible;
returnWafer.Visibility = Visibility.Collapsed;
return _slotMenus;
}
public ContextMenu GetDeleteMenus(Slot slot)
{
MenuItem createWafer = _slotMenus.Items.GetItemAt(0) as MenuItem;
MenuItem createTray = _slotMenus.Items.GetItemAt(1) as MenuItem;
MenuItem deleteWafer = _slotMenus.Items.GetItemAt(2) as MenuItem;
MenuItem deleteTray = _slotMenus.Items.GetItemAt(3) as MenuItem;
MenuItem returnWafer = _slotMenus.Items.GetItemAt(5) as MenuItem;
Separator separator = _slotMenus.Items.GetItemAt(4) as Separator;
MenuItem pmInfer = _slotMenus.Items.GetItemAt(8) as MenuItem;
createWafer.IsEnabled = (WaferStatus)slot.WaferStatus == WaferStatus.Empty;
createTray.IsEnabled = true;
deleteWafer.IsEnabled = (WaferStatus)slot.WaferStatus != WaferStatus.Empty;
deleteTray.IsEnabled = true; // slot.TrayStatus != 0;
returnWafer.IsEnabled = (WaferStatus)slot.WaferStatus != WaferStatus.Empty && !slot.ModuleID.StartsWith("Cass");
if ((bool)QueryDataClient.Instance.Service.GetConfig($"System.SetUp.IsEFEMInstalled"))
{
createTray.Visibility = Visibility.Collapsed;
createWafer.Visibility = Visibility.Collapsed;
}
else
{
createTray.Visibility = Visibility.Visible;
createWafer.Visibility = Visibility.Visible;
}
separator.Visibility = Visibility.Visible;
deleteWafer.Visibility = Visibility.Visible;
deleteTray.Visibility = Visibility.Visible;
returnWafer.Visibility = Visibility.Collapsed;
pmInfer.Visibility = Visibility.Collapsed;
return _slotMenus;
}
public void ReturnWafer(string menu, Slot p_from)
{
try
{
if (p_from == null || !p_from.IsValidSlot())
return;
//DialogButton btns = DialogButton.Transfer | DialogButton.Cancel;
string info = " from " + p_from.ModuleID + " slot " + (p_from.SlotID + 1).ToString();
string message = "Are you sure to return the wafer: \n" + info;
//DialogButton m_dResult = DialogBox.ShowDialog(btns, DialogType.CONFIRM, message);
bool displayAlignerCondition = p_from.ModuleID == "LP1" || p_from.ModuleID == "LP2" || p_from.ModuleID == "LP3" || p_from.ModuleID == "EfemRobot"
|| p_from.ModuleID == "LLA" || p_from.ModuleID == "LLB" || p_from.ModuleID == "LLC" || p_from.ModuleID == "LLD" || p_from.ModuleID == "Buffer";
displayAlignerCondition = displayAlignerCondition && (p_from.ModuleID != "Aligner");
bool displayPassCoolingCondition = (p_from.ModuleID.Contains("PM") || p_from.ModuleID == "TMRobot");
WindowManager wm = new WindowManager();
WaferTransferDialogViewModel _transferVM = new WaferTransferDialogViewModel(message, displayAlignerCondition, displayPassCoolingCondition);
_transferVM.AlignerVisibility = ShowAligner ? Visibility.Visible : Visibility.Hidden;
_transferVM.CoolingVisibility = ShowCooling ? Visibility.Visible : Visibility.Hidden;
bool? bret = wm.ShowDialogWithNoStyle(_transferVM);
if ((bool)bret)
{
//get and use transfer conditions
WaferTransferCondition conditions = _transferVM.DialogResult;
InvokeClient.Instance.Service.DoOperation(menu, p_from.ModuleID, p_from.SlotID,
conditions.IsPassCooling, conditions.CoolingTime);
}
p_from.ClearDragDropStatus();
}
catch (Exception ex)
{
LOG.Write(ex);
}
}
#endregion
#region Carrier menus
private ContextMenu _carrierMenus;
public ContextMenu CarrierMenus
{
get { return _carrierMenus; }
}
private readonly List<MenuElement> _carrierMenuElements = new List<MenuElement>() {
new MenuElement(){ Name="Create Carrier", Invoke="System.CreateCarrier"},
new MenuElement(){ Name="Delete Carrier", Invoke="System.DeleteCarrier"},
};
public void OnCarrierContextMenuClick(object sender, RoutedEventArgs args)
{
try
{
MenuItem menuItem = sender as MenuItem;
CarrierContentControl locateCarrier = ContextMenuService.GetPlacementTarget(LogicalTreeHelper.GetParent(menuItem)) as CarrierContentControl;
if (locateCarrier == null)
return;
MenuElement ele = menuItem.Tag as MenuElement;
InvokeClient.Instance.Service.DoOperation(ele.Invoke, locateCarrier.ModuleID, locateCarrier.CarrierID);
}
catch (Exception ex)
{
LOG.Write(ex);
}
}
public ContextMenu GetCarrierMenus(CarrierContentControl carrier)
{
if (carrier != null)
{
MenuItem createCarrier = _carrierMenus.Items.GetItemAt(0) as MenuItem;
MenuItem deleteWafer = _carrierMenus.Items.GetItemAt(1) as MenuItem;
createCarrier.IsEnabled = (WaferStatus)carrier.WaferStatus == WaferStatus.Empty ? true : false;
deleteWafer.IsEnabled = (WaferStatus)carrier.WaferStatus == WaferStatus.Empty ? false : true;
}
return _carrierMenus;
}
#endregion
}
}
@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
namespace MECF.Framework.UI.Client.ClientBase
{
public class DataErrorInfo<T>
: IDataErrorInfo where T : class
{
private readonly T ImplementorInstance;
private Dictionary<string, Func<T, object>> PropertyGetterMap;
private Dictionary<string, ValidationAttribute[]> ValidatorMap;
private bool HasInitialisedValidator;
public DataErrorInfo(T implementator)
{
ImplementorInstance = implementator;
}
#region Implementation of IDataErrorInfo
public string this[string propertyName]
{
get
{
if (!HasInitialisedValidator) InitialiseValidators();
if (PropertyGetterMap.ContainsKey(propertyName))
{
var propertyValue = PropertyGetterMap[propertyName](ImplementorInstance);
var errorMessages = ValidatorMap[propertyName]
.Where(v => !v.IsValid(propertyValue))
.Select(v => v.ErrorMessage).ToArray();
return string.Join(Environment.NewLine, errorMessages);
}
return string.Empty;
}
}
public string Error
{
get
{
if (!HasInitialisedValidator) InitialiseValidators();
var errors = from validator in ValidatorMap
from attribute in validator.Value
where !attribute.IsValid(PropertyGetterMap[validator.Key](ImplementorInstance))
select attribute.ErrorMessage;
return string.Join(Environment.NewLine, errors.ToArray());
}
}
private void InitialiseValidators()
{
HasInitialisedValidator = true;
ValidatorMap = ImplementorInstance.GetType()
.GetProperties()
.Where(p => GetValidations(p).Length != 0)
.ToDictionary(p => p.Name, GetValidations);
PropertyGetterMap = ImplementorInstance.GetType()
.GetProperties()
.Where(p => GetValidations(p).Length != 0)
.ToDictionary(p => p.Name, GetValueGetter);
}
private static ValidationAttribute[] GetValidations(PropertyInfo property)
{
return (ValidationAttribute[])property.GetCustomAttributes(typeof(ValidationAttribute), true);
}
private static Func<T, object> GetValueGetter(PropertyInfo property)
{
return viewmodel => property.GetValue(viewmodel, null);
}
#endregion Implementation of IDataErrorInfo
}
}
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MECF.Framework.UI.Client.ClientBase;
namespace OpenSEMI.ClientBase
{
public class DialogViewModel<T> : BaseModel
{
public T DialogResult { get; set; }
public bool IsCancel { get; set; }
}
}
@@ -0,0 +1,158 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
//using form = System.Windows.Forms;
using Caliburn.Micro;
using MECF.Framework.UI.Client.ClientBase;
namespace OpenSEMI.ClientBase
{
public class DialogBox
{
#region Folder Browser Dialog
/// <summary>
/// Folder Browser Dialog
/// </summary>
/// <returns>User Seleted Path</returns>
//public static String ShowFolderBrowserDialog()
//{
// form.FolderBrowserDialog dialog = new form.FolderBrowserDialog();
// dialog.ShowNewFolderButton = false;
// dialog.RootFolder = Environment.SpecialFolder.MyComputer;
// form.DialogResult result = dialog.ShowDialog();
// return result == form.DialogResult.OK ? dialog.SelectedPath : String.Empty;
//}
///// <summary>
///// Folder Browser Dialog
///// </summary>
///// <param name="oldPath">old path</param>
///// <param name="rootDialog">default path</param>
///// <param name="isShowNewFolderButton">show new folder button</param>
///// <returns>User Seleted Path</returns>
//public static String ShowFolderBrowserDialog(String oldPath, Environment.SpecialFolder rootDialog = Environment.SpecialFolder.MyComputer, Boolean isShowNewFolderButton = false)
//{
// form.FolderBrowserDialog dialog = new form.FolderBrowserDialog();
// dialog.ShowNewFolderButton = isShowNewFolderButton;
// if (String.IsNullOrWhiteSpace(oldPath))
// {
// dialog.RootFolder = rootDialog;
// }
// else
// {
// dialog.SelectedPath = oldPath;
// }
// form.DialogResult result = dialog.ShowDialog();
// return result == form.DialogResult.OK ? dialog.SelectedPath : String.Empty;
//}
#endregion
#region Simple dialog
public static DialogButton ShowError(MESSAGE msgEnum, params object[] param)
{
string msg = GetMsg(msgEnum);
return ShowError(msg, param);
}
public static DialogButton ShowError(string msg, params object[] param)
{
return ShowDialog(DialogButton.OK, DialogType.ERROR, msg, param);
}
public static DialogButton ShowWarning(MESSAGE msgEnum, params object[] param)
{
string msg = GetMsg(msgEnum);
return ShowWarning(msg, param);
}
public static DialogButton ShowWarning(string msg, params object[] param)
{
return ShowDialog(DialogButton.OK, DialogType.WARNING, msg, param);
}
public static DialogButton ShowInfo(MESSAGE msgEnum, params object[] param)
{
string msg = GetMsg(msgEnum);
return ShowInfo(msg, param);
}
public static DialogButton ShowInfo(string msg, params object[] param)
{
return ShowDialog(DialogButton.OK, DialogType.INFO, msg, param);
}
public static bool Confirm(MESSAGE msgEnum, params object[] param)
{
string msg = GetMsg(msgEnum);
return Confirm(msg, param);
}
public static bool Confirm(string msg, params object[] param)
{
DialogButton btn = ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, msg, param);
if (btn == DialogButton.Yes)
return true;
else
return false;
}
#endregion
/// <summary>
/// get message by enmu from resource
/// </summary>
/// <param name="msgEnum"></param>
/// <returns></returns>
public static string GetMsg(MESSAGE msgEnum)
{
//check contain key
var msg = Application.Current.Resources[msgEnum.ToString()] as string;
var msgs = msg.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries);
string msgStr = string.Empty;
int i = 0;
foreach (var str in msgs)
{
if (i == msgs.Count() - 1)
msgStr += str;
else
msgStr += str + Environment.NewLine;
i++;
}
return msgStr;
}
public static DialogButton ShowDialog(DialogButton buttons, DialogType type, MESSAGE msgEnum, params object[] param)
{
string msg = GetMsg(msgEnum);
return ShowDialog(buttons, type, msg, param);
}
public static DialogButton ShowDialog(DialogButton buttons, DialogType type, string msg, params object[] args)
{
var wm = new WindowManager();
var dlg = new MessageDialogViewModel
{
DialogButton = buttons
};
if (args is { Length: > 0 })
msg = string.Format(msg, args);
dlg.Text = msg;
dlg.DialogType = type;
wm.ShowDialogWithNoStyle(dlg);
return dlg.DialogResult;
}
}
}
@@ -0,0 +1,46 @@
<Window x:Class="MECF.Framework.UI.Client.ClientBase.Dialog.LoginRequestConfirmationDialog"
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"
Height="220" Width="400"
d:Background="White"
Title="Login Request Confirmation"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Closing="Window_Closing">
<!--<WindowChrome.WindowChrome>
<WindowChrome ResizeBorderThickness="0" CaptionHeight="0"/>
</WindowChrome.WindowChrome>
<Window.Effect>
<DropShadowEffect Color="Gray" BlurRadius="10" Direction="-90" RenderingBias="Quality" ShadowDepth="4"/>
</Window.Effect>-->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="5"/>
<RowDefinition />
</Grid.RowDefinitions>
<Border Background="{StaticResource Color_BG_TopStrip}"/>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition />
<RowDefinition Height="70"/>
</Grid.RowDefinitions>
<TextBlock Text="Login Request" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<StackPanel Grid.Row="1" Margin="20 0" HorizontalAlignment="Center" >
<TextBlock
Text="{Binding Description, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
TextWrapping="Wrap"
HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/>
</StackPanel>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center">
<Button x:Name="BtnAccept" Content="Accept" VerticalAlignment="Center" Height="30" Width="120" Margin="0,0,5,0" Click="BtnAccept_Click" />
<Button x:Name="BtnRejected" Content="Reject" VerticalAlignment="Center" Height="30" Width="120" Margin="5,0,0,0" Click="BtnRejected_Click" IsCancel="True" IsDefault="True" />
</StackPanel>
</Grid>
</Grid>
</Window>
@@ -0,0 +1,100 @@
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using Aitex.Core.Account;
namespace MECF.Framework.UI.Client.ClientBase.Dialog
{
/// <summary>
/// Interaction logic for LoginRequestConfirmationDialog.xaml
/// </summary>
public partial class LoginRequestConfirmationDialog : Window
{
#region Variables
private readonly Credential _requestingCredential;
private readonly CancellationTokenSource _ctsCountDownTask;
private readonly CancellationTokenSource _ctsRemoteRequstCanceled;
private readonly IProgress<double> _progCountDown;
#endregion
public LoginRequestConfirmationDialog(Credential requestingCredential, CancellationTokenSource cts)
{
Debug.Assert(cts != null);
_requestingCredential = requestingCredential;
_ctsRemoteRequstCanceled = cts;
_ctsCountDownTask = new CancellationTokenSource();
_progCountDown = new Progress<double>(countDown =>
{
if (countDown > 0)
{
if (BtnRejected != null)
BtnRejected.Content = $"Reject ({countDown:F0}s)";
}
else
Close();
});
InitializeComponent();
}
#region Properties
public string Description =>
$"User [{_requestingCredential}] is requesting to login from somewhere, do you agree to it's request and logout from the system?";
#endregion
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
var closeTime = DateTime.Now.Add(TimeSpan.FromSeconds(CredentialManager.REQ_LOGIN_DIALOG_LIFT_TIME_SEC));
Task.Run(() =>
{
while (true)
{
var timeRemained = (closeTime - DateTime.Now).TotalSeconds;
if (timeRemained <= 0)
{
// force to reject
_progCountDown.Report(0);
break;
}
_progCountDown.Report(timeRemained);
Thread.Sleep(500);
// 结束倒计时
if (_ctsCountDownTask.Token.IsCancellationRequested)
break;
// 登录请求已取消
if (_ctsRemoteRequstCanceled.Token.IsCancellationRequested)
{
_progCountDown.Report(0);
break;
}
}
});
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
_ctsCountDownTask?.Cancel();
}
private void BtnRejected_Click(object sender, RoutedEventArgs e)
{
DialogResult = false;
}
private void BtnAccept_Click(object sender, RoutedEventArgs e)
{
DialogResult = true;
}
}
}
@@ -0,0 +1,44 @@
<Window x:Class="MECF.Framework.UI.Client.ClientBase.Dialog.LoginRequestWaitDialog"
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.ClientBase.Dialog"
mc:Ignorable="d"
Height="220" Width="400"
d:Background="White"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen">
<!--<WindowChrome.WindowChrome>
<WindowChrome ResizeBorderThickness="0" CaptionHeight="0"/>
</WindowChrome.WindowChrome>
<Window.Effect>
<DropShadowEffect Color="Gray" BlurRadius="10" Direction="-90" RenderingBias="Quality" ShadowDepth="4"/>
</Window.Effect>-->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="5"/>
<RowDefinition />
</Grid.RowDefinitions>
<Border Background="{StaticResource Color_BG_TopStrip}"/>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition />
<RowDefinition Height="70"/>
</Grid.RowDefinitions>
<TextBlock Text="Wait Confirmation" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<StackPanel Grid.Row="1" Margin="20 0" HorizontalAlignment="Center" >
<TextBlock
Text="The account had already logged in somewhere, please wait for confirmation ..."
TextWrapping="Wrap"
HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/>
</StackPanel>
<Button Grid.Row="2" x:Name="BtnCancel" Content="Cancel" IsCancel="True" VerticalAlignment="Center" Height="30" Width="120" Margin="0,0,5,0" Click="BtnCancel_OnClick" />
</Grid>
</Grid>
</Window>
@@ -0,0 +1,78 @@
using Aitex.Core.Account;
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
namespace MECF.Framework.UI.Client.ClientBase.Dialog
{
/// <summary>
/// Interaction logic for LoginRequestWaitDialog.xaml
/// </summary>
public partial class LoginRequestWaitDialog : Window
{
#region Variables
private readonly CancellationTokenSource _ctsCountDownTask;
private readonly IProgress<double> _progCountDown;
#endregion
public LoginRequestWaitDialog()
{
InitializeComponent();
_ctsCountDownTask = new CancellationTokenSource();
_progCountDown = new Progress<double>(countDown =>
{
// 更新Cancel按钮倒计时数值
// 如果倒计时为0,则关闭当前窗口
if (countDown > 0)
BtnCancel.Content = $"Cancel ({countDown:F0}s)";
else
Close();
});
}
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
var closeTime = DateTime.Now.Add(TimeSpan.FromSeconds(CredentialManager.REQ_LOGIN_DIALOG_LIFT_TIME_SEC));
var ct = _ctsCountDownTask?.Token;
Task.Run(() =>
{
while (true)
{
var timeRemained = (closeTime - DateTime.Now).TotalSeconds;
if (timeRemained <= 0)
{
// 关闭对话框
_progCountDown.Report(0);
break;
}
_progCountDown.Report(timeRemained);
Thread.Sleep(500);
// 操作被取消
if (ct is { IsCancellationRequested: true })
{
// 关闭对话框
_progCountDown.Report(0);
break;
}
}
});
}
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
{
Close();
}
}
}
@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using MECF.Framework.UI.Client.ClientBase;
using Sicentury.Core.Extensions;
namespace OpenSEMI.ClientBase
{
public class MessageDialog : DialogViewModel<DialogButton>
{
private string m_text;
public string Text
{
get { return m_text; }
set
{
m_text = value;
NotifyOfPropertyChange();
}
}
public DialogButton DialogButton
{
set
{
this.m_buttons.Clear();
foreach (int v in Enum.GetValues(typeof(DialogButton)))
{
var m_btn = (DialogButton)v;
if (value.HasFlag(m_btn))
{
var bc = new ButtonControl();
// 使用Description属性指定按钮名称。
var btnContent = m_btn.GetDescription();
bc.Name = string.IsNullOrEmpty(btnContent) ? m_btn.ToString() : btnContent;
bc.Tag = m_btn;
if (m_btn == DialogButton.OK || m_btn == DialogButton.Yes)
bc.IsDefault = true;
else
bc.IsDefault = false;
if (m_btn == DialogButton.Cancel || m_btn == DialogButton.No)
bc.IsCancel = true;
else
bc.IsCancel = false;
m_buttons.Add(bc);
}
}
}
}
private List<ButtonControl> m_buttons = new List<ButtonControl>();
public List<ButtonControl> Buttons
{
get { return m_buttons; }
}
private DialogType m_DialogType = DialogType.INFO;
public DialogType DialogType
{
get { return m_DialogType; }
set { m_DialogType = value; NotifyOfPropertyChange("DialogType"); }
}
}
public class ButtonControl
{
public string Name { get; set; }
public bool IsDefault { get; set; }
public bool IsCancel { get; set; }
public object Tag { get; set; }
}
}
@@ -0,0 +1,248 @@
<UserControl x:Class="OpenSEMI.ClientBase.MessageDialogView"
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:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:cal="http://www.caliburn.org"
xmlns:micro="clr-namespace:Caliburn.Micro"
Background="Transparent">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
<RowDefinition Height="10"/>
</Grid.RowDefinitions>
<Grid.Effect>
<DropShadowEffect BlurRadius="6" ShadowDepth="6" Opacity="0.6"/>
</Grid.Effect>
<Grid MinWidth="300" MaxWidth="650" MinHeight="200" MaxHeight="400" Margin="0,0,10,10">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition />
<RowDefinition Height="10"/>
</Grid.RowDefinitions>
<Border x:Name="DialogWindow" BorderThickness="1,1,0,0" BorderBrush="{DynamicResource Color_BD_Dialog}" MinWidth="300" MinHeight="200" MaxWidth="600" MaxHeight="400" Grid.Row="1" Background="{DynamicResource Color_BG_Dialog}" >
<Border BorderBrush="{DynamicResource Color_BG_Dialog_Shadow}" BorderThickness="0,0,1,1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Rectangle Margin="5" Grid.RowSpan="2" Fill="{DynamicResource Color_BG_Dialog_Inner}"/>
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" CanContentScroll="True" Margin="20,20,20,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid VerticalAlignment="Top">
<Grid x:Name="Warning" Width="40" Height="40">
<Grid Width="30" Height="30">
<Ellipse Fill="#FF8B5D00">
<Ellipse.Effect>
<DropShadowEffect Color="White" ShadowDepth="0" BlurRadius="10"/>
</Ellipse.Effect>
</Ellipse>
<Ellipse Margin="3,3,3,1.5">
<Ellipse.Effect>
<BlurEffect Radius="10"/>
</Ellipse.Effect>
<Ellipse.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFEB9E00" Offset="0"/>
<GradientStop Color="#FFFDFA00" Offset="1"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse Margin="5,2.5,5,12">
<Ellipse.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0.2"/>
<GradientStop Offset="1"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<TextBlock TextWrapping="Wrap" Text="!" FontWeight="Bold" FontFamily="Belwe Bd BT" FontSize="26.667" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF682600">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="0" Color="White"/>
</TextBlock.Effect>
</TextBlock>
</Grid>
<Grid.Style>
<Style>
<Setter Property="Grid.Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding DialogType}" Value="WARNING">
<Setter Property="Grid.Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
</Grid>
<Grid x:Name="Information" Width="40" Height="40">
<Grid Width="30" Height="30">
<Ellipse Fill="#FF00628B">
<Ellipse.Effect>
<DropShadowEffect Color="White" ShadowDepth="0" BlurRadius="10"/>
</Ellipse.Effect>
</Ellipse>
<Ellipse Margin="3,3,3,1.5">
<Ellipse.Effect>
<BlurEffect Radius="10"/>
</Ellipse.Effect>
<Ellipse.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF007BDA" Offset="0"/>
<GradientStop Color="#FF68C6D8" Offset="1"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse Margin="5,2.5,5,12">
<Ellipse.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0.2"/>
<GradientStop Offset="1"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<TextBlock TextWrapping="Wrap" Text="i" FontSize="26.667" Foreground="#FF002368" FontFamily="Monotype Corsiva" Margin="9.5,2.5,6.5,-2.5" FontWeight="Bold">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="0" Color="White"/>
</TextBlock.Effect>
</TextBlock>
</Grid>
<Grid.Style>
<Style>
<Setter Property="Grid.Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding DialogType}" Value="INFO">
<Setter Property="Grid.Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
</Grid>
<Grid x:Name="Error" Width="40" Height="40">
<Grid Width="30" Height="30">
<Ellipse Fill="#FFB60000">
<Ellipse.Effect>
<DropShadowEffect Color="White" ShadowDepth="0" BlurRadius="10"/>
</Ellipse.Effect>
</Ellipse>
<Ellipse Margin="3,3,3,1.5">
<Ellipse.Effect>
<BlurEffect Radius="10"/>
</Ellipse.Effect>
<Ellipse.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFF2F00" Offset="0"/>
<GradientStop Color="#FFFF9D6F" Offset="1"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse Margin="5,2.5,5,12">
<Ellipse.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0.2"/>
<GradientStop Offset="1"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<TextBlock TextWrapping="Wrap" Text="×" FontWeight="Bold" FontFamily="Arial Black" FontSize="24" HorizontalAlignment="Center" Foreground="#FF740000" Margin="0,2,0,0">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="0" Color="White"/>
</TextBlock.Effect>
</TextBlock>
</Grid>
<Grid.Style>
<Style>
<Setter Property="Grid.Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding DialogType}" Value="ERROR">
<Setter Property="Grid.Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
</Grid>
<Grid x:Name="Confirm" Width="40" Height="40">
<Grid Width="30" Height="30">
<Ellipse Fill="#FF006A28">
<Ellipse.Effect>
<DropShadowEffect Color="White" ShadowDepth="0" BlurRadius="10"/>
</Ellipse.Effect>
</Ellipse>
<Ellipse Margin="3,3,3,1.5">
<Ellipse.Effect>
<BlurEffect Radius="10"/>
</Ellipse.Effect>
<Ellipse.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF68EB00" Offset="0"/>
<GradientStop Color="#FFE1FF82" Offset="1"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse Margin="5,2.5,5,12">
<Ellipse.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0.2"/>
<GradientStop Offset="1"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Path Data="M0,0 L4,0 4,3.8890872 16.010408,3.8890872 16.010408,7.8890872 0.010407538,7.8890872 0.010407538,3.9999998 0,3.9999998 z" Fill="#FF005601" Margin="8,9.5,6,12.5" RenderTransformOrigin="0.500325027316656,0.746485246105757" Stretch="Fill">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-50"/>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
</Path>
</Grid>
<Grid.Style>
<Style>
<Setter Property="Grid.Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding DialogType}" Value="CONFIRM">
<Setter Property="Grid.Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
</Grid>
</Grid>
<TextBlock Grid.Column="1" TextAlignment="Left" Text="{Binding Text}" VerticalAlignment="Top" Margin="0,10,0,0" TextWrapping="Wrap" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource Color_FG_Black}"></TextBlock>
</Grid>
</ScrollViewer>
<ListBox ItemsSource="{Binding Buttons}" BorderThickness="0" Grid.Row="1" Background="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,10">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal"></VirtualizingStackPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Button Content="{Binding Name}" Width="75" Height="30" IsCancel="{Binding IsCancel}" IsDefault="{Binding IsDefault}" Margin="5,0">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<micro:ActionMessage MethodName="OnButtonClick">
<micro:Parameter Value="$source" />
</micro:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Border>
</Border>
<Path Data="M8,0 L8,4 4,0" Fill="{DynamicResource Color_BG_Dialog}" HorizontalAlignment="Right" Margin="0,-2,40,0" Stretch="Fill" Width="8" Grid.Row="2" Stroke="{DynamicResource Color_BG_Dialog_Shadow}"/>
</Grid>
</Grid>
</UserControl>
@@ -0,0 +1,28 @@
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 OpenSEMI.ClientBase
{
/// <summary>
/// Interaction logic for MessageDialogView.xaml
/// </summary>
public partial class MessageDialogView : UserControl
{
public MessageDialogView()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,35 @@
using System;
using System.Windows.Controls;
using MECF.Framework.UI.Client.ClientBase;
namespace OpenSEMI.ClientBase
{
public class MessageDialogViewModel : MessageDialog
{
protected override void OnInitialize()
{
base.OnInitialize();
DisplayName = "Dialog Box";
}
public void OnButtonClick(object sender)
{
if (sender is Button btn)
{
// 某些按钮的标题可能来自于Description属性,无法直接从Content还原为DialogButton枚举。
// 先尝试从Button.Tag获取其DialogButton枚举值,如果失败再尝试从Button.Content获取(兼容老代码)
if (Enum.TryParse(btn.Content.ToString(), out DialogButton dlgRet))
{
DialogResult = dlgRet;
TryClose();
}
else if (btn.Tag is DialogButton dlgRet1)
{
DialogResult = dlgRet1;
TryClose();
}
}
}
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.ClientBase
{
public interface IHandler
{
void Handle();
}
}
@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace OpenSEMI.ClientBase.IO
{
public class IOItem : DependencyObject
{
public int Index { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public string Key { get; set; }
public string DisplayName { get; set; }
public string ToolTip { get; set; }
}
public class IOItem<T> : IOItem
{
public static DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(T), typeof(IOItem<T>));
public T Value
{
get
{
return (T)GetValue(ValueProperty);
}
set
{
SetValue(ValueProperty, value);
}
}
}
public class AOItem : IOItem<short>
{
public static readonly DependencyProperty NewValueProperty = DependencyProperty.Register("NewValue", typeof(short), typeof(AOItem), new PropertyMetadata((short)0));
public short NewValue
{
get { return (short)GetValue(NewValueProperty); }
set { SetValue(NewValueProperty, value); }
}
public static readonly DependencyProperty TextSavedProperty = DependencyProperty.Register("TextSaved", typeof(bool), typeof(AOItem), new PropertyMetadata(true));
public bool TextSaved
{
get { return (bool)GetValue(TextSavedProperty); }
set { SetValue(TextSavedProperty, value); }
}
}
public class AOItemFloat : IOItem<float>
{
public static readonly DependencyProperty NewValueProperty = DependencyProperty.Register("NewValue", typeof(float), typeof(AOItem), new PropertyMetadata((float)0));
public float NewValue
{
get { return (float)GetValue(NewValueProperty); }
set { SetValue(NewValueProperty, value); }
}
public static readonly DependencyProperty TextSavedProperty = DependencyProperty.Register("TextSaved", typeof(bool), typeof(AOItem), new PropertyMetadata(true));
public bool TextSaved
{
get { return (bool)GetValue(TextSavedProperty); }
set { SetValue(TextSavedProperty, value); }
}
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.ClientBase
{
public interface ISupportMultipleSystem
{
string SystemName { get; set; }
}
}
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MECF.Framework.Common.Account.Extends;
using MECF.Framework.Common.Account.Permissions;
namespace MECF.Framework.UI.Client.ClientBase
{
public class MenuManager
{
public List<AppMenu> MenuItems { get; private set; }
#region Operation
public void LoadMenu(List<AppMenu> menuitems)
{
List < AppMenu > removeList = new List<AppMenu>();
foreach (AppMenu menuitem in menuitems)
{
if (!string.IsNullOrEmpty(menuitem.System) && menuitem.System != "System")
{
if (ModuleManager.ModuleInfos.ContainsKey(menuitem.System) &&
!ModuleManager.ModuleInfos[menuitem.System].IsInstalled)
{
removeList.Add(menuitem);
}
}
if (menuitem.MenuItems != null)
{
for (int i = menuitem.MenuItems.Count - 1; i >= 0; i--)
{
var submenuitem = menuitem.MenuItems[i];
submenuitem.Parent = menuitem;
if (submenuitem.Permission == MenuPermissionEnum.MP_NONE) //remove menu if permission is "None"
menuitem.MenuItems.Remove(submenuitem);
if (!string.IsNullOrEmpty(submenuitem.System) && submenuitem.System != "System")
{
if (ModuleManager.ModuleInfos.ContainsKey(submenuitem.System) &&
!ModuleManager.ModuleInfos[submenuitem.System].IsInstalled)
{
menuitem.MenuItems.Remove(submenuitem);
}
}
}
}
}
foreach (var appMenu in removeList)
{
menuitems.Remove(appMenu);
}
this.MenuItems = menuitems;
}
public void FilterMenus(List<string> pSystems)
{
if (pSystems == null || this.MenuItems == null)
return;
foreach (AppMenu menuitem in this.MenuItems)
{
if (menuitem.MenuItems != null)
{
for (int i = menuitem.MenuItems.Count - 1; i >= 0; i--)
{
var submenuitem = menuitem.MenuItems[i];
//filter
}
}
}
}
private bool IsExist(List<string> pSource, string pMatch)
{
foreach (var item in pSource)
{
if (pMatch.IndexOf(item) >= 0)
return true;
}
return false;
}
public List<AppMenu> GetAllClone()
{
if (this.MenuItems == null)
return null;
List<AppMenu> cloneList = new List<AppMenu>();
foreach (var item in this.MenuItems)
{
cloneList.Add((AppMenu)item.Clone(item.Parent));
}
return cloneList;
}
#endregion
}
}
@@ -0,0 +1,209 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using Aitex.Core.RT.Log;
using Aitex.Core.RT.SCCore;
using Aitex.Core.Util;
using MECF.Framework.Common.DataCenter;
using MECF.Framework.Common.Equipment;
using RTDefine = Aitex.Core.Common;
namespace MECF.Framework.UI.Client.ClientBase
{
public class ModuleDataMonitor
{
public Dictionary<string, ModuleInfo> _mapWaferDataModule = new Dictionary<string, ModuleInfo>();
public List<string> _lstWaferDataName = new List<string>();
private PeriodicJob _monitorThread;
private bool isEFEMInstalled;
public ModuleDataMonitor()
{
foreach (var moduleInfo in ModuleManager.ModuleInfos)
{
if (!string.IsNullOrEmpty(moduleInfo.Value.WaferDataName))
{
_lstWaferDataName.Add(moduleInfo.Value.WaferDataName);
_mapWaferDataModule[moduleInfo.Value.WaferDataName] = moduleInfo.Value;
}
}
isEFEMInstalled = (bool)QueryDataClient.Instance.Service.GetConfig($"System.SetUp.IsEFEMInstalled");
_monitorThread = new PeriodicJob(500, OnTimer, "Monitor Module Data Thread", true);
}
private bool OnTimer()
{
try
{
Dictionary<string, object> data = QueryDataClient.Instance.Service.PollData(_lstWaferDataName);
if (data != null && Application.Current != null)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
foreach (var waferData in data)
{
if (!_mapWaferDataModule.ContainsKey(waferData.Key))
continue;
RTDefine.WaferInfoRt[] wafers = waferData.Value as RTDefine.WaferInfoRt[];
if (wafers == null)
continue;
ModuleInfo info = _mapWaferDataModule[waferData.Key];
if (info.WaferManager.Wafers.Count == 0)
{
for (int i = 0; i < wafers.Length; i++)
{
info.WaferManager.Wafers.Add(WaferInfoConverter(wafers[i], info.WaferModuleID, i));
}
if (info.IsWaferReverseDisplay)
{
info.WaferManager.Wafers = new ObservableCollection<WaferInfo>(info.WaferManager.Wafers.Reverse());
}
continue;
}
if (wafers.Length == info.WaferManager.Wafers.Count)
{
int index;
for (int i = 0; i < wafers.Length; i++)
{
if (info.IsWaferReverseDisplay)
index = wafers.Length - i - 1;
else
index = i;
var convertedWafer = WaferInfoConverter(wafers[index], info.WaferModuleID, index);
info.WaferManager.Wafers[i].WaferStatus = convertedWafer.WaferStatus;
info.WaferManager.Wafers[i].WaferID = convertedWafer.WaferID;
if (wafers[index].IsWaferEmpty)
{
info.WaferManager.Wafers[i].SourceName =wafers[index].TrayOriginStation+"."+ (wafers[index].TrayOriginSlot + 1).ToString().PadLeft(2,'0');
}
else
{
info.WaferManager.Wafers[i].SourceName = convertedWafer.SourceName;
}
info.WaferManager.Wafers[i].TrayStatus = convertedWafer.TrayStatus;
info.WaferManager.Wafers[i].LotID = convertedWafer.LotID;
info.WaferManager.Wafers[i].IsTrayExhausted = wafers[index].TrayProcessCount <= 0;
info.WaferManager.Wafers[i].TrayProcessCount = wafers[index].TrayProcessCount;
info.WaferManager.Wafers[i].RecipeName = convertedWafer.RecipeName;
if (wafers[index].TrayOriginSlot % 2 == 0)
{
info.WaferManager.Wafers[i].TrayBelongTo = ModuleName.PM1.ToString();
}
else
{
info.WaferManager.Wafers[i].TrayBelongTo = ModuleName.PM2.ToString();
}
if (!isEFEMInstalled)
{
info.WaferManager.Wafers[i].TrayBelongTo = wafers[index].TrayBelongTo;
}
if (info.WaferManager.Wafers[i].ToolTip == null)
{
info.WaferManager.Wafers[i].ToolTip = new ToolTip()
{
Content = $"LotId : {wafers[index].LotId}\r\nWaferId : {wafers[index].WaferID}\r\nSequenceName : {wafers[index].ProcessJobID}\r\nRecipeName : {convertedWafer.RecipeName}\r\nWaferStatus : {((int)wafers[index].WaferStatus).ToString()}\r\nNextSequenceStep : {wafers[index].NextSequenceStep + 1}\r\nTrayState : {((int)wafers[index].TrayStatus).ToString()}\r\nTrayProcessCount : {wafers[index].TrayProcessCount}\r\nTrayOriginStation : {wafers[index].TrayOriginStation}\r\nTrayOriginSlot : {wafers[index].TrayOriginSlot + 1}\r\nTrayBelongTo : {info.WaferManager.Wafers[i].TrayBelongTo}"
};
}
else
{
info.WaferManager.Wafers[i].ToolTip.Content = $"LotId : {wafers[index].LotId}\r\nWaferId : {wafers[index].WaferID}\r\nSequenceName : {wafers[index].ProcessJobID}\r\nRecipeName : {convertedWafer.RecipeName}\r\nWaferStatus : {((int)wafers[index].WaferStatus).ToString()}\r\nNextSequenceStep : {wafers[index].NextSequenceStep + 1}\r\nTrayState : {((int)wafers[index].TrayStatus).ToString()}\r\nTrayProcessCount : {wafers[index].TrayProcessCount}\r\nTrayOriginStation : {wafers[index].TrayOriginStation}\r\nTrayOriginSlot : {wafers[index].TrayOriginSlot + 1}\r\nTrayBelongTo : {info.WaferManager.Wafers[i].TrayBelongTo}";
}
}
}
}
}));
}
}
catch (Exception ex)
{
LOG.Error(ex.Message);
}
return true;
}
private WaferInfo WaferInfoConverter(RTDefine.WaferInfoRt awafer, string modid, int slotid)
{
WaferInfo wafer = new WaferInfo();
wafer.ModuleID = modid;
wafer.SlotID = slotid;
wafer.SlotIndex = slotid + 1;
wafer.WaferID = awafer.WaferID;
wafer.SourceName = awafer.WaferOrigin;
wafer.LotID = awafer.LotId == "" ? awafer.WaferOrigin : awafer.LotId;
wafer.WaferStatus = WaferStatusConverter(awafer);
wafer.TrayStatus = (int)awafer.TrayStatus; //awafer.TrayState == RTDefine.TrayStatus.Normal ? 1 : 0;
wafer.RecipeName = "";
if (awafer.ProcessJob != null && awafer.ProcessJob.Sequence != null)
{
for (int i = 0; i < awafer.ProcessJob.Sequence.Steps.Count; i++)
{
if (!String.IsNullOrEmpty(awafer.ProcessJob.Sequence.Steps[i].RecipeName))
{
wafer.RecipeName = awafer.ProcessJob.Sequence.Steps[i].RecipeName;
wafer.SequenceName = awafer.ProcessJob.Sequence.Name;
break;
}
}
}
return wafer;
}
//0: no wafer
//1:light blue == idle no pj
//2:blue = idle with pj
//3:cyan = in process
//4:green = complete
//5:error = error
//6:dummy
//7:warning = has error
//8:partial processed
private int WaferStatusConverter(RTDefine.WaferInfoRt awafer)
{
if (awafer.WaferStatus == RTDefine.WaferStatus.Empty)
return 0;
if (awafer.WaferStatus == RTDefine.WaferStatus.Normal)
{
switch (awafer.ProcessState)
{
case RTDefine.WaferProcessStatus.InProcess: return 3;
case RTDefine.WaferProcessStatus.Completed: return awafer.HasWarning ? 7 : 4;
case RTDefine.WaferProcessStatus.Failed: return 5;
case RTDefine.WaferProcessStatus.Wait: return 3;
case RTDefine.WaferProcessStatus.Idle: return awafer.ProcessJob == null ? 1 : 2;
}
}
if (awafer.WaferStatus == RTDefine.WaferStatus.Dummy)
{
return 6;
}
return 5;
}
}
}
@@ -0,0 +1,58 @@
using Caliburn.Micro.Core;
namespace MECF.Framework.UI.Client.ClientBase
{
public class ModuleInfo : PropertyChangedBase
{
private string _moduleID;
public string ModuleID
{
get { return _moduleID; }
set { _moduleID = value; NotifyOfPropertyChange("ModuleID"); }
}
private string _waferModuleID;
public string WaferModuleID
{
get { return _waferModuleID; }
set { _waferModuleID = value; NotifyOfPropertyChange("WaferModuleID"); }
}
private bool _IsInstalled;
public bool IsInstalled
{
get { return _IsInstalled; }
set { _IsInstalled = value; NotifyOfPropertyChange("IsInstalled"); }
}
private bool _IsOnline;
public bool IsOnline
{
get { return _IsOnline; }
set { _IsOnline = value; NotifyOfPropertyChange("IsOnline"); }
}
private ModuleWaferManager _WaferManager;
public ModuleWaferManager WaferManager
{
get { return _WaferManager; }
set { _WaferManager = value; NotifyOfPropertyChange("WaferManager"); }
}
public string WaferDataName { get; set; }
public bool IsWaferReverseDisplay { get; set; }
public ModuleInfo(string name, string waferModuleName, string waferDataName, bool isWaferReverseDisplay, bool isInstalled )
{
ModuleID = name;
WaferDataName = waferDataName;
WaferModuleID = string.IsNullOrEmpty(waferModuleName) ? name : waferModuleName;
IsWaferReverseDisplay = isWaferReverseDisplay;
IsInstalled = isInstalled;
WaferManager = new ModuleWaferManager(name);
}
}
}
@@ -0,0 +1,24 @@
using System.Collections.Generic;
namespace MECF.Framework.UI.Client.ClientBase
{
public static class ModuleManager
{
public static Dictionary<string, ModuleInfo> ModuleInfos { get; private set; }
static ModuleManager()
{
ModuleInfos = new Dictionary<string, ModuleInfo>();
}
public static void Initialize(List<ModuleInfo> allModules)
{
ModuleInfos.Clear();
foreach (var info in allModules)
{
ModuleInfos.Add(info.ModuleID, info);
}
}
}
}
@@ -0,0 +1,57 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Caliburn.Micro.Core;
namespace MECF.Framework.UI.Client.ClientBase
{
public class ModuleWaferManager : PropertyChangedBase
{
public string ModuleID;
private bool hasWafer = false;
private WaferInfo topWafer;
private ObservableCollection<WaferInfo> wafers;
public ModuleWaferManager(string _mod)
{
this.ModuleID = _mod;
this.wafers = new ObservableCollection<WaferInfo>();
}
public ObservableCollection<WaferInfo> Wafers
{
get { return this.wafers; }
set
{
this.wafers = value;
this.RaisePropertyChangedEventImmediately("Wafers");
}
}
public WaferInfo TopWafer
{
get { return this.topWafer; }
set
{
if (this.topWafer != value)
{
this.topWafer = value;
this.NotifyOfPropertyChange("TopWafer");
}
}
}
public bool HasWafer
{
get { return this.hasWafer; }
set
{
if (this.hasWafer != value)
{
this.hasWafer = value;
this.RaisePropertyChangedEventImmediately("HasWafer");
}
}
}
}
}
@@ -0,0 +1,87 @@
using System.Collections.Generic;
using MECF.Framework.Common.Account.Extends;
using MECF.Framework.Common.Account.Permissions;
using MECF.Framework.UI.Core.Accounts;
using OpenSEMI.ClientBase.ServiceProvider;
namespace MECF.Framework.UI.Client.ClientBase
{
public class RoleAccountProvider : IProvider
{
private static RoleAccountProvider _Instance = null;
public static RoleAccountProvider Instance
{
get
{
if (_Instance == null)
{
_Instance = new RoleAccountProvider();
_Instance.Create();
}
return _Instance;
}
}
public void Create()
{
}
#region Account Operations
public List<AccountEx> GetAccounts()
{
return AccountClient.Instance.Service.GetAccounts();
}
public bool UpdateAccount(AccountEx p_newAccount)
{
return AccountClient.Instance.Service.UpdateAccountEx(p_newAccount);
}
public bool DeleteAccount(string p_strUserID)
{
return AccountClient.Instance.Service.DeleteAccountEx(p_strUserID);
}
#endregion
#region Roles Operations
public List<Role> GetRoles()
{
return AccountClient.Instance.Service.GetRoles();
}
public bool UpdateRole(Role p_newRole)
{
return AccountClient.Instance.Service.UpdateRole(p_newRole);
}
public bool DeleteRole(string p_strRoleID)
{
return AccountClient.Instance.Service.DeleteRole(p_strRoleID);
}
public string GetAvailableID()
{
return AccountClient.Instance.Service.GetAvailableRoleID();
}
#endregion
#region Permission Operations
public List<AppMenu> GetAccessibleMenusByRole(string roleId)
{
return AccountClient.Instance.Service.GetAccessibleMenusByRole(roleId);
}
public MenuPermissionEnum GetMenuPermission(string roleId, string menuName)
{
return AccountClient.Instance.Service.GetMenuPermission(roleId, menuName);
}
#endregion
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenSEMI.ClientBase.ServiceProvider
{
public interface IProvider
{
void Create();
}
}
@@ -0,0 +1,318 @@
using Aitex.Core.RT.Log;
using Aitex.Core.Util;
using MECF.Framework.Common.DataCenter;
using OpenSEMI.Ctrlib.Controls;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace MECF.Framework.UI.Client.ClientBase
{
public class UiViewModelBase : BaseModel
{
#region Variables
private int UnknowKeysCount = 0;
private readonly PeriodicJob _timer;
protected Func<object, bool> _isSubscriptionAttribute;
protected Func<MemberInfo, bool> _hasSubscriptionAttribute;
protected ConcurrentBag<string> _subscribedKeys = new ConcurrentBag<string>();
#endregion
#region Constructors
public UiViewModelBase()
{
_timer = new PeriodicJob(1000, OnTimer, "UIUpdateThread-" + GetType().Name);
_isSubscriptionAttribute = attribute => attribute is SubscriptionAttribute;
_hasSubscriptionAttribute = mi => mi.GetCustomAttributes(false).Any(_isSubscriptionAttribute);
}
#endregion
#region Properties
public string SystemName { get; set; }
public bool ActiveUpdateData { get; set; }
#endregion
#region Methods
protected override void OnActivate()
{
base.OnActivate();
EnableTimer(true);
}
protected override void OnDeactivate(bool close)
{
base.OnDeactivate(close);
if(ActiveUpdateData)
{
EnableTimer(false);
}
}
public virtual void EnableTimer(bool enable)
{
if (enable)
{
_timer.Start();
}
else
{
_timer.Pause();
}
}
protected override void OnInitialize()
{
base.OnInitialize();
SubscribeKeys();
}
protected void Subscribe(string key)
{
if (!string.IsNullOrEmpty(key))
{
_subscribedKeys.Add(key);
}
}
public virtual void SubscribeKeys()
{
SubscribeKeys(this);
}
public void SubscribeKeys(UiViewModelBase vm)
{
Parallel.ForEach(vm.GetType().GetProperties().Where(_hasSubscriptionAttribute),
property =>
{
SubscriptionAttribute subscription = property.GetCustomAttributes(false).First(_isSubscriptionAttribute) as SubscriptionAttribute;
string key = subscription.ModuleKey;
if (!string.IsNullOrEmpty(SystemName))
{
key = $"{SystemName}.{key}";
subscription.SetModule(SystemName);
}
if (!_subscribedKeys.Contains(key))
{
_subscribedKeys.Add(key);
}
});
Parallel.ForEach(vm.GetType().GetFields().Where(_hasSubscriptionAttribute),
field =>
{
SubscriptionAttribute subscription = field.GetCustomAttributes(false).First(_isSubscriptionAttribute) as SubscriptionAttribute;
string key = subscription.ModuleKey;
if (!string.IsNullOrEmpty(SystemName))
{
key = $"{SystemName}.{key}";
subscription.SetModule(SystemName);
}
if (!_subscribedKeys.Contains(key))
{
_subscribedKeys.Add(key);
}
});
}
protected virtual bool OnTimer()
{
try
{
Poll();
return true;
}
catch (Exception)
{
return false;
}
}
protected virtual void Poll()
{
int _unknowKeysCount = 0;
if (_subscribedKeys.Count > 0)
{
Dictionary<string, object> data = QueryDataClient.Instance.Service.PollData(_subscribedKeys);
if (data == null)
{
LOG.Error("获取RT数据失败");
return;
}
if (data.Count != _subscribedKeys.Count)
{
string unknowKeys = string.Empty;
foreach (string key in _subscribedKeys)
{
if (!data.ContainsKey(key))
{
unknowKeys += key + "\r\n";
_unknowKeysCount += 1;
}
}
if (UnknowKeysCount != _unknowKeysCount)
{
LOG.Error("获取如下SubscribeKey数据失败" + unknowKeys);
UnknowKeysCount = _unknowKeysCount;
}
}
InvokeBeforeUpdateProperty(data);
UndateData(data);
Application.Current?.Dispatcher.Invoke(new Action(() =>
{
InvokePropertyChanged();
InvokeAfterUpdateProperty(data);
}));
}
}
protected virtual void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
{
}
protected virtual void InvokeAfterUpdateProperty(Dictionary<string, object> data)
{
}
protected virtual void InvokePropertyChanged()
{
Refresh();
}
private void UndateData(Dictionary<string, object> data)
{
if (data != null)
{
UpdateSubscribe(data, this);
}
}
public void UpdateSubscribe(Dictionary<string, object> data, object vm)
{
Parallel.ForEach(vm.GetType().GetProperties().Where(_hasSubscriptionAttribute),
property =>
{
PropertyInfo pi = (PropertyInfo)property;
SubscriptionAttribute subscription = property.GetCustomAttributes(false).First(_isSubscriptionAttribute) as SubscriptionAttribute;
string key = SystemName == null ? subscription.ModuleKey : $"{SystemName}.{subscription.ModuleKey}";
if (_subscribedKeys.Contains(key) && data.ContainsKey(key))
{
try
{
var convertedValue = Convert.ChangeType(data[key], pi.PropertyType);
var originValue = Convert.ChangeType(pi.GetValue(vm, null), pi.PropertyType);
if (originValue != convertedValue)
{
pi.SetValue(vm, convertedValue, null);
}
}
catch (Exception ex)
{
LOG.Error("由RT返回的数据更新失败" + key, ex);
}
}
});
Parallel.ForEach(vm.GetType().GetFields().Where(_hasSubscriptionAttribute),
field =>
{
FieldInfo fi = (FieldInfo)field;
SubscriptionAttribute subscription = field.GetCustomAttributes(false).First(_isSubscriptionAttribute) as SubscriptionAttribute;
string key = SystemName == null ? subscription.ModuleKey : $"{SystemName}.{subscription.ModuleKey}";
if (_subscribedKeys.Contains(key) && data.ContainsKey(key))
{
try
{
var convertedValue = Convert.ChangeType(data[key], fi.FieldType);
var originValue = Convert.ChangeType(fi.GetValue(vm), fi.FieldType);
if (originValue != convertedValue)
{
fi.SetValue(vm, convertedValue);
}
}
catch (Exception ex)
{
LOG.Error("由RT返回的数据更新失败" + key, ex);
}
}
});
}
public virtual void OnWaferTransfer(DragDropEventArgs args)
{
try
{
WaferMoveManager.Instance.TransferWafer(args.TranferFrom, args.TranferTo);
}
catch (Exception ex)
{
LOG.Write(ex);
}
}
public void OnMouseUp(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton != MouseButton.Right)
return;
if (sender is Slot slot)
{
ContextMenu cm = ContextMenuManager.Instance.GetSlotMenus(slot);
if (cm != null)
{
((FrameworkElement)e.Source).ContextMenu = cm;
}
return;
}
if (sender is CarrierContentControl carrier)
{
ContextMenu cm = ContextMenuManager.Instance.GetCarrierMenus(carrier);
if (cm != null)
{
((FrameworkElement)e.Source).ContextMenu = cm;
}
return;
}
}
public string GetUnitStatusBackground(string status)
{
return ModuleStatusBackground.GetStatusBackground(status);
}
#endregion
}
}
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace OpenSEMI.ClientBase.Utility
{
public class AssemblyUtil
{
public static Type GetType(string typeName)
{
Type type = Type.GetType(typeName);
return type;
}
public static object CreateInstance(Type type)
{
return Activator.CreateInstance(type);
}
public static Assembly LoadAssembly(string assemblyName)
{
return Assembly.Load(assemblyName);
}
public static object CreateInstance(Assembly assembly, string typeName)
{
return assembly.CreateInstance(typeName);
}
public static string GetExecutePath()
{
return AppDomain.CurrentDomain.BaseDirectory;
}
}
}
@@ -0,0 +1,38 @@
using System.ComponentModel;
using OpenSEMI.ClientBase;
namespace MECF.Framework.UI.Client.ClientBase
{
public abstract class ValidatorBase
: IDataErrorInfo
{
private DataErrorInfo<ValidatorBase> DataErrorValidator;
#region Implementation of IDataErrorInfo
public string this[string propertyName]
{
get { return GetDataErrorInfo()[propertyName]; }
}
public string Error
{
get { return GetDataErrorInfo().Error; }
}
#endregion
public bool IsValid
{
get { return string.IsNullOrEmpty(Error); }
}
private DataErrorInfo<ValidatorBase> GetDataErrorInfo()
{
if (DataErrorValidator != null) return DataErrorValidator;
DataErrorValidator = new DataErrorInfo<ValidatorBase>(this);
return DataErrorValidator;
}
}
}
@@ -0,0 +1,133 @@
using System.Windows;
using System.Windows.Controls;
using Caliburn.Micro.Core;
namespace MECF.Framework.UI.Client.ClientBase
{
public class WaferInfo : PropertyChangedBase
{
private int _waferStatus = 0; // WaferStatus.Empty;
public int WaferStatus
{
get => _waferStatus;
set { _waferStatus = value; NotifyOfPropertyChange(); }
}
private int _waferTrayStatus = 0;
public int TrayStatus
{
get => _waferTrayStatus;
set { _waferTrayStatus = value; NotifyOfPropertyChange(); }
}
private int _trayProcessCount = 0;
public int TrayProcessCount
{
get => _trayProcessCount;
set { _trayProcessCount = value; NotifyOfPropertyChange(); }
}
private string _recipeName;
public string RecipeName
{
get => _recipeName;
set { _recipeName = value; NotifyOfPropertyChange(); }
}
private string _trayBelongTo;
public string TrayBelongTo
{
get => _trayBelongTo;
set { _trayBelongTo = value; NotifyOfPropertyChange(); }
}
private bool _isTrayExhausted;
public bool IsTrayExhausted
{
get => _isTrayExhausted;
set { _isTrayExhausted = value; NotifyOfPropertyChange(); }
}
/// <summary>
/// SlotID start from 0
/// </summary>
private int _slotID;
public int SlotID
{
get => _slotID;
set { _slotID = value; NotifyOfPropertyChange(); }
}
/// <summary>
/// SlotIndex start from 1
/// </summary>
private int _slotIndex;
public int SlotIndex
{
get => _slotIndex;
set { _slotIndex = value; NotifyOfPropertyChange(); }
}
private string _moduleID;
public string ModuleID
{
get => _moduleID;
set { _moduleID = value; NotifyOfPropertyChange(); }
}
private string _waferId;
public string WaferID
{
get => _waferId;
set { _waferId = value; NotifyOfPropertyChange(); }
}
private string _sourceName;
public string SourceName
{
get => _sourceName;
set { _sourceName = value; NotifyOfPropertyChange(); }
}
private string _lotID;
public string LotID
{
get => _lotID;
set { _lotID = value; NotifyOfPropertyChange(); }
}
private string _sequenceName = string.Empty;
public string SequenceName
{
get => _sequenceName;
set { _sequenceName = value; NotifyOfPropertyChange(); }
}
private string _originName = string.Empty;
public string OriginName
{
get => _originName;
set { _originName = value; NotifyOfPropertyChange(); }
}
private ToolTip _toolTip;
public ToolTip ToolTip
{
get => _toolTip;
set { _toolTip = value; NotifyOfPropertyChange(); }
}
private bool _isChecked;
public bool IsChecked
{
get => _isChecked;
set
{
_isChecked = value;
NotifyOfPropertyChange();
}
}
public Visibility IsVisibility => _waferStatus > 0 ? Visibility.Visible : Visibility.Hidden;
}
}
@@ -0,0 +1,87 @@
using System;
using System.Windows;
using Aitex.Core.RT.Log;
using Caliburn.Micro;
using MECF.Framework.Common.OperationCenter;
using OpenSEMI.Ctrlib.Controls;
namespace MECF.Framework.UI.Client.ClientBase
{
public class WaferMoveManager
{
#region single Instance
public bool ShowAligner { get; set; }
public bool ShowCooling { get; set; }
public bool ShowBlade { get; set; }
private WaferMoveManager()
{
ShowAligner = true;
ShowCooling = true;
ShowBlade = false;
}
private static WaferMoveManager m_Instance = null;
public static WaferMoveManager Instance
{
get
{
if (m_Instance == null)
{
m_Instance = new WaferMoveManager();
}
return m_Instance;
}
}
#endregion
public void TransferWafer(Slot p_from, Slot p_to)
{
try
{
if (p_from == null || p_to == null || !p_from.IsValidSlot() || !p_to.IsValidSlot())
return;
//DialogButton btns = DialogButton.Transfer | DialogButton.Cancel;
string info = " from " + p_from.ModuleID + " slot " + (p_from.SlotID + 1).ToString() + " to " + p_to.ModuleID + " slot " + (p_to.SlotID + 1).ToString();
string message = "Are you sure to transfer the wafer: \n" + info;
//DialogButton m_dResult = DialogBox.ShowDialog(btns, DialogType.CONFIRM, message);
bool displayAlignerCondition = (p_from.ModuleID == "LP1" || p_from.ModuleID == "LP2" || p_from.ModuleID == "LP3" || p_from.ModuleID == "EfemRobot")
|| ((p_from.ModuleID == "LLA" || p_from.ModuleID == "LLB" || p_from.ModuleID == "LLC" || p_from.ModuleID == "LLD") && (p_to.ModuleID == "LP1" || p_to.ModuleID == "LP2" || p_to.ModuleID == "LP3" || p_to.ModuleID == "EfemRobot"));
displayAlignerCondition = displayAlignerCondition && (p_from.ModuleID != "Aligner" && p_to.ModuleID != "Aligner");
bool displayPassCoolingCondition = (p_from.ModuleID.Contains("PM") || p_from.ModuleID == "TMRobot");
displayPassCoolingCondition = displayPassCoolingCondition && (!p_to.ModuleID.Contains("PM")) && (p_to.ModuleID != "TMRobot")
&& (p_to.ModuleID != "LLA") && (p_to.ModuleID != "LLB") && (p_to.ModuleID != "LLC") && (p_to.ModuleID != "LLD");
bool displayBladeCondition = ShowBlade;
WindowManager wm = new WindowManager();
WaferTransferDialogViewModel _transferVM = new WaferTransferDialogViewModel(message, displayAlignerCondition, displayPassCoolingCondition, displayBladeCondition);
_transferVM.AlignerVisibility = ShowAligner ? Visibility.Visible : Visibility.Hidden;
_transferVM.CoolingVisibility = ShowCooling ? Visibility.Visible : Visibility.Hidden;
_transferVM.BladeVisibility = ShowBlade ? Visibility.Visible : Visibility.Hidden;
bool? bret = wm.ShowDialogWithNoStyle(_transferVM);
if ((bool)bret)
{
//get and use transfer conditions
WaferTransferCondition conditions = _transferVM.DialogResult;
InvokeClient.Instance.Service.DoOperation("System.MoveWafer",
p_from.ModuleID, p_from.SlotID, p_to.ModuleID, p_to.SlotID,
conditions.IsPassAligner, conditions.AlignerAngle, conditions.IsPassCooling, conditions.CoolingTime, (int)conditions.Blade);
}
p_from.ClearDragDropStatus();
p_to.ClearDragDropStatus();
}
catch (Exception ex)
{
LOG.Write(ex);
}
}
}
}
@@ -0,0 +1,54 @@
using MECF.Framework.Common.CommonData;
namespace MECF.Framework.UI.Client.ClientBase
{
public class WaferTransferCondition
{
private bool _IsPassAligner;
public bool IsPassAligner
{
get { return _IsPassAligner; }
set { _IsPassAligner = value; }
}
private int _AlignerAngle;
public int AlignerAngle
{
get { return _AlignerAngle; }
set { _AlignerAngle = value; }
}
private bool _IsPassCooling;
public bool IsPassCooling
{
get { return _IsPassCooling; }
set { _IsPassCooling = value; }
}
private int _CoolingTime;
public int CoolingTime
{
get { return _CoolingTime; }
set { _CoolingTime = value; }
}
private RobotArm _Blade;
public RobotArm Blade
{
get { return _Blade; }
set { _Blade = value; }
}
private bool _IsVirtualTransferWaferInfo;
public bool IsVirtualTransferWaferInfo
{
get { return _IsVirtualTransferWaferInfo; }
set { _IsVirtualTransferWaferInfo = value; }
}
private bool _IsVirtualTransferTrayInfo;
public bool IsVirtualTransferTrayInfo
{
get { return _IsVirtualTransferTrayInfo; }
set { _IsVirtualTransferTrayInfo = value; }
}
}
}
@@ -0,0 +1,253 @@
<UserControl
x:Class="MECF.Framework.UI.Client.ClientBase.WaferTransferDialogView"
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"
Background="Transparent"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
<RowDefinition Height="10" />
</Grid.RowDefinitions>
<Grid.Effect>
<DropShadowEffect
BlurRadius="6"
Opacity="0.6"
ShadowDepth="6" />
</Grid.Effect>
<Grid
Grid.Row="1"
Width="400"
Height="250"
Margin="0,0,10,0">
<Border
x:Name="DialogWindow"
Background="{DynamicResource Color_BG_Dialog}"
BorderBrush="{DynamicResource Color_BD_Dialog}"
BorderThickness="1,1,0,0">
<Border BorderBrush="{DynamicResource Color_BG_Dialog_Shadow}" BorderThickness="0,0,1,1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle
Grid.RowSpan="2"
Margin="5"
Fill="{DynamicResource Color_BG_Dialog_Inner}" />
<ScrollViewer
Margin="20,20,20,0"
CanContentScroll="True"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid VerticalAlignment="Top">
<Grid
x:Name="Information"
Width="40"
Height="40">
<Grid Width="30" Height="30">
<Ellipse Fill="#FF00628B">
<Ellipse.Effect>
<DropShadowEffect
BlurRadius="10"
ShadowDepth="0"
Color="White" />
</Ellipse.Effect>
</Ellipse>
<Ellipse Margin="3,3,3,1.5">
<Ellipse.Effect>
<BlurEffect Radius="10" />
</Ellipse.Effect>
<Ellipse.Fill>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0" Color="#FF007BDA" />
<GradientStop Offset="1" Color="#FF68C6D8" />
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse Margin="5,2.5,5,12">
<Ellipse.Fill>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0.2" Color="White" />
<GradientStop Offset="1" />
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<TextBlock
Margin="9.5,2.5,6.5,-2.5"
FontFamily="Monotype Corsiva"
FontSize="26.667"
FontWeight="Bold"
Foreground="#FF002368"
Text="i"
TextWrapping="Wrap">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="0" Color="White" />
</TextBlock.Effect>
</TextBlock>
</Grid>
<!--<Grid.Style>
<Style>
<Setter Property="Grid.Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding DialogType}" Value="INFO">
<Setter Property="Grid.Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>-->
</Grid>
</Grid>
<TextBlock
Grid.Column="1"
Margin="0,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontFamily="Arial"
FontSize="14"
Foreground="{DynamicResource FG_Black}"
Text="{Binding ConfirmText}"
TextWrapping="Wrap" />
<StackPanel
Grid.Column="1"
VerticalAlignment="Bottom"
Orientation="Vertical">
<StackPanel
Grid.Column="1"
Margin="0,0,0,10"
Orientation="Horizontal"
Visibility="{Binding AlignerVisibility}">
<CheckBox
Width="120"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
IsChecked="{Binding Conditions.IsPassAligner}"
IsEnabled="{Binding DisplayPassAlignerCondition}">
Auto align
</CheckBox>
<TextBlock
Width="80"
VerticalAlignment="Bottom"
Text="Aligner Angle" />
<TextBox
Width="50"
IsEnabled="{Binding DisplayPassAlignerCondition}"
Text="{Binding Conditions.AlignerAngle, Mode=TwoWay}" />
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Bottom"
Text="" />
</StackPanel>
<StackPanel
Grid.Column="1"
Margin="0,0,0,10"
Orientation="Horizontal"
Visibility="{Binding CoolingVisibility}">
<CheckBox
Width="120"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Content="Auto Cooling"
IsChecked="{Binding Conditions.IsPassCooling}"
IsEnabled="{Binding DisplayPassCoolingCondition}" />
<TextBlock
Width="80"
VerticalAlignment="Bottom"
Text="Cooling time" />
<TextBox
Width="50"
IsEnabled="{Binding DisplayPassCoolingCondition}"
Text="{Binding Conditions.CoolingTime, Mode=TwoWay}" />
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Bottom"
Text="s" />
</StackPanel>
<StackPanel Margin="0,0,0,10" Orientation="Horizontal">
<Label Width="230" Content="Virtual Transfer(无动作)" />
</StackPanel>
<StackPanel
Grid.Column="1"
Margin="0,0,0,10"
Orientation="Horizontal">
<WrapPanel VerticalAlignment="Center">
<CheckBox
x:Name="ChkVirtualTransferWaferInfo"
Margin="8,0,13,0"
VerticalContentAlignment="Center"
Checked="ChkAuto_Checked"
IsChecked="{Binding Conditions.IsVirtualTransferWaferInfo}" />
<Label Content="WaferInfo" />
<CheckBox
x:Name="ChkVirtualTransferTrayInfo"
Margin="8,0,13,0"
VerticalContentAlignment="Center"
Checked="ChkAuto_Checked"
IsChecked="{Binding Conditions.IsVirtualTransferTrayInfo}" />
<Label Content="TrayInfo" />
</WrapPanel>
</StackPanel>
<StackPanel
Grid.Column="2"
Margin="0,0,0,10"
Orientation="Horizontal"
Visibility="{Binding BladeVisibility}">
<Label
Width="50"
Content="Blade:"
IsEnabled="{Binding DisplayBladeCondition}" />
<WrapPanel VerticalAlignment="Center" IsEnabled="{Binding DisplayBladeCondition}">
<RadioButton Content="Blade1" IsChecked="{Binding IsBlade1, Mode=TwoWay}" />
<RadioButton
Margin="8,0"
Content="Blade2"
IsChecked="{Binding IsBlade2, Mode=TwoWay}" />
</WrapPanel>
</StackPanel>
</StackPanel>
</Grid>
</ScrollViewer>
<StackPanel
Grid.Row="3"
Margin="0,0,0,20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button
Width="80"
Height="25"
HorizontalAlignment="Left"
Command="{Binding TransferCommand}"
Content="Transfer" />
<Button
Width="80"
Height="25"
Margin="5,0,0,0"
HorizontalAlignment="Left"
Command="{Binding CancelCommand}"
Content="Cancel" />
</StackPanel>
</Grid>
</Border>
</Border>
</Grid>
<Path
Grid.Row="2"
Width="8"
Margin="0,-2,40,0"
HorizontalAlignment="Right"
Data="M8,0 L8,4 4,0"
Fill="{DynamicResource Color_BG_Dialog}"
Stretch="Fill"
Stroke="{DynamicResource Color_BG_Dialog_Shadow}" />
</Grid>
</UserControl>
@@ -0,0 +1,27 @@
using System.Windows;
using System.Windows.Controls;
namespace MECF.Framework.UI.Client.ClientBase
{
/// <summary>
/// WaferTransferDialogView.xaml 的交互逻辑
/// </summary>
public partial class WaferTransferDialogView : UserControl
{
public WaferTransferDialogView()
{
InitializeComponent();
}
private void ChkAuto_Checked(object sender, RoutedEventArgs e)
{
//PassWordView passWordView = new PassWordView();
//passWordView.ShowDialog();
//if (!passWordView.VerificationResult)
//{
// ChkVirtualTransfer.IsChecked = false;
//}
}
}
}
@@ -0,0 +1,130 @@
using System;
using System.Windows;
using System.Windows.Input;
using Aitex.Core.RT.Log;
using MECF.Framework.Common.CommonData;
using MECF.Framework.Common.DataCenter;
using OpenSEMI.ClientBase;
using OpenSEMI.ClientBase.Command;
namespace MECF.Framework.UI.Client.ClientBase
{
public class WaferTransferDialogViewModel : DialogViewModel<WaferTransferCondition>
{
private WaferTransferCondition _Conditions;
public WaferTransferCondition Conditions
{
get { return _Conditions; }
set { _Conditions = value; }
}
private string _ConfirmText;
public string ConfirmText
{
get { return _ConfirmText; }
set { _ConfirmText = value; }
}
public bool IsBlade1 { get; set; }
public bool IsBlade2 { get; set; }
public bool DisplayPassAlignerCondition { get; set; }
public bool DisplayPassCoolingCondition { get; set; }
public bool DisplayBladeCondition { get; set; }
public Visibility AlignerVisibility { get; set; }
public Visibility CoolingVisibility { get; set; }
public Visibility BladeVisibility { get; set; }
private ICommand _TransferCommand;
public ICommand TransferCommand
{
get
{
if (this._TransferCommand == null)
this._TransferCommand = new BaseCommand<EventCommandParameter<object, RoutedEventArgs>>((EventCommandParameter<object, RoutedEventArgs> arg) => this.OnTransferCommand(arg));
return this._TransferCommand;
}
}
private ICommand _BtnCancelCommand;
public ICommand CancelCommand
{
get
{
if (this._BtnCancelCommand == null)
this._BtnCancelCommand = new BaseCommand<EventCommandParameter<object, RoutedEventArgs>>((EventCommandParameter<object, RoutedEventArgs> arg) => this.OnCancelCommand(arg));
return this._BtnCancelCommand;
}
}
protected override void OnInitialize()
{
base.OnInitialize();
}
public WaferTransferDialogViewModel(string message, bool displayPassAlignerCondition, bool displayPassCoolingCondition, bool displayBladeCondition = false)
{
AlignerVisibility = Visibility.Visible;
CoolingVisibility = Visibility.Visible;
BladeVisibility = displayBladeCondition ? Visibility.Visible : Visibility.Hidden;
this.DisplayName = "Wafer Transfer Dialog";
ConfirmText = message;
Conditions = new WaferTransferCondition();
DisplayPassAlignerCondition = displayPassAlignerCondition;
DisplayPassCoolingCondition = displayPassCoolingCondition;
DisplayBladeCondition = displayBladeCondition;
try
{
var defaultAutoAlign = QueryDataClient.Instance.Service.GetConfig("System.AutoAlignManualTransfer");
if (!displayPassAlignerCondition)
defaultAutoAlign = false;
var defaultPassCooling = QueryDataClient.Instance.Service.GetConfig("System.AutoPassCooling");
if (!displayPassCoolingCondition)
defaultPassCooling = false;
Conditions.IsPassAligner = defaultAutoAlign == null || (bool)defaultAutoAlign;
Conditions.IsPassCooling = defaultPassCooling == null || (bool)defaultPassCooling;
var alignerAngle = QueryDataClient.Instance.Service.GetConfig("Aligner.DefaultNotchDegree");
var coolingTime = QueryDataClient.Instance.Service.GetConfig("LoadLock.DefaultCoolingTime");
if (alignerAngle != null)
Conditions.AlignerAngle = (int)((double)alignerAngle);
if (coolingTime != null)
Conditions.CoolingTime = (int)coolingTime;
}
catch (Exception ex)
{
LOG.Write(ex);
}
}
private void OnTransferCommand(EventCommandParameter<object, RoutedEventArgs> arg)
{
if (IsBlade1)
Conditions.Blade = RobotArm.ArmA;
else if (IsBlade2)
Conditions.Blade = RobotArm.ArmB;
DialogResult = Conditions;
TryClose(true);
}
private void OnCancelCommand(EventCommandParameter<object, RoutedEventArgs> arg)
{
TryClose(false);
}
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MECF.Framework.UI.Client.ClientBase
{
public enum MESSAGE
{
MSG_NONE,
}
}