| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 | 
							- using Aitex.Core.RT.SCCore;
 
- using Caliburn.Micro;
 
- using Caliburn.Micro.Core;
 
- using MECF.Framework.Common.DataCenter;
 
- using MECF.Framework.Common.RecipeCenter;
 
- using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Collections.ObjectModel;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows;
 
- using FurnaceUI.Models;
 
- using FurnaceUI.Views.Parameter;
 
- using FurnaceUI.Views.Recipes;
 
- using System.Windows.Controls;
 
- using System.Windows.Media;
 
- using Aitex.Core.Util;
 
- using Aitex.Core.Common.DeviceData;
 
- namespace FurnaceUI.Views.Editors
 
- {
 
-     public class ManualPressCommandViewModel : FurnaceUIViewModelBase
 
-     {
 
-         private Dictionary<string, string> boatCmd = new Dictionary<string, string>();
 
-         [Subscription("PM1.APC.DeviceData")]
 
-         public AITAPCData APCData { get; set; }
 
-         public bool IsSave { get; set; }
 
-         public bool IsCommandButtonEnable => true;
 
-         public string SelectedCmd { get; set; }
 
-         public bool SetRecipeProcessEditViewEnable { get; set; } = true;
 
-         private string _description = "";
 
-         public string Description
 
-         {
 
-             get => _description;
 
-             set
 
-             {
 
-                 _description = value;
 
-                 NotifyOfPropertyChange(nameof(Description));
 
-             }
 
-         }
 
-         private ManualPressCommandView _view;
 
-         public string ReturnString { get; set; } = "";
 
-         public string DefaultUnit { get; set; } = "Torr";
 
-         public ManualPressCommandViewModel()
 
-         {
 
-             //CreateRadioButton();
 
-         }
 
-         public void RdoChecked(string cmd, object sender)
 
-         {
 
-             if (sender is RadioButton)
 
-             {
 
-                 DefaultUnit = (string)QueryDataClient.Instance.Service.GetConfig($"PM1.APC.PressureUnit");
 
-                 ReturnString = cmd;
 
-                 switch (cmd)
 
-                 {
 
-                     case "Slow Vac":
 
-                         DefaultUnit = $"{DefaultUnit}/S";
 
-                         break;
 
-                     default:
 
-                         break;
 
-                 }
 
-             }
 
-         }
 
-         //private void CreateRadioButton()
 
-         //{
 
-         //    boatCmd.Clear();
 
-         //    boatCmd.Add("Boat Load", "The boat is loaded in the furnace.(Speed set avai lable)");
 
-         //    boatCmd.Add("Boat Unload", "The boat is unloaded f rom the furnace.(Speed set available)");
 
-         //    boatCmd.Add("Boat Loader Home", "Boat Loader ismoved to the home position.");
 
-         //    boatCmd.Add("Boat Rotate", "The boat is rotated.");
 
-         //    boatCmd.Add("Boat Rotate Stop", "The rotat ion of the boat is stopped and R-axis is moved to the home position.");
 
-         //    boatCmd.Add("Boat CAP2", "Boat Loader is moved to CAP2 position.(CAP2 : CAP position in condition to not seal the reactor)");
 
-         //    boatCmd.Add("Stop(Include R-axis)", "Boat Loader is stopped. (Include R-axis.");
 
-         //}
 
-         public void RdoChecked(object sender)
 
-         {
 
-             Description = boatCmd[(string)((RadioButton)sender).Content];
 
-             if ((bool)((RadioButton)sender).IsChecked)
 
-             {
 
-                 ReturnString = (string)((RadioButton)sender).Content;
 
-             }
 
-         }
 
-         public bool IsEnable
 
-         {
 
-             get
 
-             {
 
-                 if (SetRecipeProcessEditViewEnable)
 
-                 {
 
-                     return CGlobal.RecipeProcessEditViewEnable;//是否是View模式
 
-                 }
 
-                 else
 
-                 {
 
-                     return true;
 
-                 }
 
-             }
 
-         }
 
-         public string RecipeType { get; set; }
 
-         protected override void OnViewLoaded(object view)
 
-         {
 
-             base.OnViewLoaded(view);
 
-             LoadData(view);
 
-         }
 
-         private void LoadData(object view)
 
-         {
 
-             if (!string.IsNullOrEmpty(SelectedCmd))
 
-             {
 
-                 _view = ((GetView() as Window).Content) as ManualPressCommandView;
 
-                 string selectedCmd = SelectedCmd.Replace(" ", "");
 
-                 var control = _view.FindName(selectedCmd);
 
-                 if (control is null)
 
-                     return;
 
-                 RadioButton radioButton = control as RadioButton;
 
-                 radioButton.IsChecked = true;
 
-             }
 
-             ReturnString = SelectedCmd;
 
-         }
 
-         /// <summary>
 
-         /// 查找子控件
 
-         /// </summary>
 
-         /// <typeparam name="T">子控件的类型</typeparam>
 
-         /// <param name="obj">要找的是obj的子控件</param>
 
-         /// <param name="name">想找的子控件的Name属性</param>
 
-         /// <returns>目标子控件</returns>
 
-         public static T GetChildObject<T>(DependencyObject obj, string name) where T : FrameworkElement
 
-         {
 
-             DependencyObject child = null;
 
-             T grandChild = null;
 
-             for (int i = 0; i <= VisualTreeHelper.GetChildrenCount(obj) - 1; i++)
 
-             {
 
-                 child = VisualTreeHelper.GetChild(obj, i);
 
-                 if (child is T && (((T)child).Name == name | string.IsNullOrEmpty(name)))
 
-                 {
 
-                     return (T)child;
 
-                 }
 
-                 else
 
-                 {
 
-                     // 在下一级中没有找到指定名字的子控件,就再往下一级找
 
-                     grandChild = GetChildObject<T>(child, name);
 
-                     if (grandChild != null)
 
-                         return grandChild;
 
-                 }
 
-             }
 
-             return null;
 
-         }
 
-         public void TempSetSave()
 
-         {
 
-             IsSave = true;
 
-             ((Window)GetView()).DialogResult = true;
 
-         }
 
-         public void TempSetCancel()
 
-         {
 
-             IsSave = false;
 
-             ((Window)GetView()).DialogResult = false;
 
-         }
 
-     }
 
- }
 
 
  |