123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- 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;
- namespace FurnaceUI.Views.Editors
- {
- public class RecipeSkipWaitCommandViewModel : FurnaceUIViewModelBase
- {
- private bool _isStepSkipIsChecked = false;
- public bool IsStepSkipIsChecked
- {
- get => _isStepSkipIsChecked;
- set
- {
- _isStepSkipIsChecked = value;
- NotifyOfPropertyChange("IsStepSkipIsChecked");
- }
- }
- private bool _isStepWaitIsChecked = false;
- public bool IsStepWaitIsChecked
- {
- get => _isStepWaitIsChecked;
- set
- {
- _isStepWaitIsChecked = value;
- NotifyOfPropertyChange("IsStepWaitIsChecked");
- }
- }
- public string SkipWait { get; set; }
- private Visibility _isStepSkipVisibility = Visibility.Visible;
- public Visibility IsStepSkipVisibility
- {
- get => _isStepSkipVisibility;
- set
- {
- _isStepSkipVisibility = value;
- NotifyOfPropertyChange("IsStepSkipVisibility");
- }
- }
- private Visibility _isStepWaitVisibility = Visibility.Visible;
- public Visibility IsStepWaitVisibility
- {
- get => _isStepWaitVisibility;
- set
- {
- _isStepWaitVisibility = value;
- NotifyOfPropertyChange("IsStepWaitVisibility");
- }
- }
- private int _stepSkipValue=0;
- public int StepSkipValue
- {
- get => _stepSkipValue;
- set
- {
- _stepSkipValue = value;
- NotifyOfPropertyChange("StepSkipValue");
- }
- }
- private int _stepWaitValue=0;
- public int StepWaitValue
- {
- get => _stepWaitValue;
- set
- {
- _stepWaitValue = value;
- NotifyOfPropertyChange("StepWaitValue");
- }
- }
- public bool IsSave { get; set; }
- public RecipeSkipWaitCommandViewModel()
- {
- }
- public bool IsEnable => CGlobal.RecipeProcessEditViewEnable;//是否是View模式
- public string RecipeType { get; set; }
- protected override void OnViewLoaded(object view)
- {
- base.OnViewLoaded(view);
- LoadData();
- }
- public void StepClick(string cmd)
- {
- switch (cmd)
- {
- case "Skip":
- IsStepSkipIsChecked = !IsStepSkipIsChecked;
- break;
- case "Wait":
- IsStepWaitIsChecked = !IsStepWaitIsChecked;
- break;
- default:
- break;
- }
- }
- public string RtnString
- {
- get
- {
- StringBuilder stringBuilder = new StringBuilder();
- if (IsStepSkipIsChecked)
- {
- stringBuilder.Append($"Skip:{StepSkipValue}");
- }
- if (IsStepWaitIsChecked)
- {
- if (stringBuilder.Length == 0)
- {
- stringBuilder.Append($"Wait:{StepWaitValue}");
- }
- else
- {
- stringBuilder.Append($";Wait:{StepWaitValue}");
- }
- }
- return stringBuilder.ToString();
- }
- }
- private void LoadData()
- {
- if (!string.IsNullOrEmpty(SkipWait))
- {
- string[] temps = SkipWait.Split(';');
- foreach (var item in temps)
- {
- if (item.Contains("Skip"))
- {
- var subTemps = item.Split(':');
- if (subTemps.Length == 2)
- {
- IsStepSkipIsChecked = true;
- StepSkipValue =int.Parse(subTemps[1]);
- }
- }
- if (item.Contains("Wait"))
- {
- var subTemps = item.Split(':');
- if (subTemps.Length == 2)
- {
- IsStepWaitIsChecked = true;
- StepWaitValue = int.Parse(subTemps[1]);
- }
- }
- }
- }
- }
- public void TempSetSave()
- {
- IsSave = true;
- ((Window)GetView()).DialogResult = true;
- }
- public void TempSetCancel()
- {
- IsSave = false;
- ((Window)GetView()).DialogResult = false;
- }
- }
- }
|