RecipePressWaitValveAngleViewModel.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using Aitex.Core.Common.DeviceData;
  2. using Caliburn.Micro;
  3. using Caliburn.Micro.Core;
  4. using MECF.Framework.Common.DataCenter;
  5. using MECF.Framework.Common.OperationCenter;
  6. using MECF.Framework.Common.RecipeCenter;
  7. using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
  8. using MECF.Framework.UI.Client.CenterViews.Dialogs;
  9. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  10. using MECF.Framework.UI.Core.Control;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.Collections.ObjectModel;
  14. using System.Linq;
  15. using System.Windows;
  16. using System.Windows.Controls;
  17. using FurnaceUI.Models;
  18. namespace FurnaceUI.Client.Dialog
  19. {
  20. public class RecipePressWaitValveAngleViewModel : FurnaceUIViewModelBase
  21. {
  22. private RecipePressWaitValveAngleView _view;
  23. public bool IsSave { get; set; } = false;
  24. public Step SelectedStep { get; set; }
  25. public bool IsEnable => CGlobal.RecipeProcessEditViewEnable;//是否是View模式
  26. public RecipePressWaitValveAngleViewModel()
  27. {
  28. }
  29. protected override void OnViewLoaded(object view)
  30. {
  31. _view = (RecipePressWaitValveAngleView)view;
  32. base.OnViewLoaded(view);
  33. LoadData();
  34. }
  35. private void LoadData()
  36. {
  37. if (SelectedStep.PressWaitUnit.Value != "%" && SelectedStep.PressWaitUnit.Value != "%d")
  38. {
  39. SelectedStep.PressWaitUnit.Value = "%";
  40. }
  41. switch (SelectedStep.PressWaitUnit.Value)
  42. {
  43. case "%":
  44. _view.RdoPercent.IsChecked = true;
  45. break;
  46. case "%d":
  47. _view.RdoPercentd.IsChecked = true;
  48. break;
  49. default:
  50. _view.RdoPercent.IsChecked = true;
  51. break;
  52. }
  53. }
  54. public void GASSettingCancel()
  55. {
  56. ((Window)GetView()).DialogResult = false;
  57. }
  58. public void ButtonSelectClick(string cmd)
  59. {
  60. switch (cmd.ToLower())
  61. {
  62. case "%":
  63. SelectedStep.PressWaitUnit.SetValue("%");
  64. break;
  65. case "%d":
  66. SelectedStep.PressWaitUnit.SetValue("%d");
  67. break;
  68. default:
  69. break;
  70. }
  71. IsSave = true;
  72. ((Window)GetView()).DialogResult = true;
  73. }
  74. }
  75. }