12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- 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;
- 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()
- {
- ((Window)GetView()).DialogResult = true;
- }
- }
- }
|