123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using FurnaceUI.Models;
- using System.Collections.ObjectModel;
- using MECF.Framework.UI.Client.ClientBase;
- using OpenSEMI.ClientBase;
- namespace FurnaceUI.Views.Recipes
- {
- public class RecipeStepSelectDialogViewModel : FurnaceUIViewModelBase
- {
- public RecipeDataBase Recipe { get; set; }
- public Step SelectedStep { get; set; }
- private ObservableCollection<Step> _newSteps = new ObservableCollection<Step>();
- public ObservableCollection<Step> NewSteps
- {
- get
- {
- if (Recipe != null && Recipe.Steps != null)
- {
- _newSteps.Clear();
- Recipe.Steps.Where(x => !x.Name.ToLower().Contains("standby") && !x.Name.ToLower().Contains("end")).ToList().ForEach(s => _newSteps.Add(s));
- return _newSteps;
- }
- else
- {
- return null;
- }
- }
- }
- private bool isSaveEnabled;
- public bool IsSaveEnabled
- {
- get => isSaveEnabled;
- set
- {
- isSaveEnabled = value;
- NotifyOfPropertyChange(nameof(IsSaveEnabled));
- }
- }
- public RecipeStepSelectDialogViewModel(RecipeDataBase CurrentRecipe)
- {
- Recipe = CurrentRecipe;
- IsSaveEnabled = false;
- }
- public void SelectStepCmd(object obj)
- {
- SelectedStep = (Step)obj;
- if (SelectedStep != null)
- IsSaveEnabled = true;
- }
- public void CancelCmd()
- {
- ((Window)GetView()).DialogResult = false;
- }
- public void SaveCmd()
- {
- if (DialogButton.No == DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
- DialogType.CONFIRM,
- $"Make sure to Copy the selected step?"))
- {
- return;
- }
- ((Window)GetView()).DialogResult = true;
- }
- }
- }
|