| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using FurnaceUI.Models;
- using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
- using OpenSEMI.ClientBase.Command;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Windows.Input;
- namespace FurnaceUI.Views.Recipes
- {
- public class RecipeStepSelectDialogViewModel : FurnaceUIViewModelBase
- {
- #region ctor
- public RecipeStepSelectDialogViewModel(RecipeDataBase CurrentRecipe)
- {
- Recipe = CurrentRecipe;
- }
- #endregion
- public RecipeDataBase Recipe { 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;
- }
- }
- }
- public Step SelectedStep
- {
- get { return _selectedStep; }
- set
- {
- _selectedStep = value;
- NotifyOfPropertyChange(() => SelectedStep);
- }
- }
- private Step _selectedStep;
- private ICommand _saveCommand;
- public ICommand SaveCommand
- {
- get
- {
- if (this._saveCommand == null)
- this._saveCommand = new BaseCommand(() => this.Save(), () => CanSave());
- return this._saveCommand;
- }
- }
- private bool CanSave()
- {
- return SelectedStep != null;
- }
- private void Save()
- {
- this.TryClose(true);
- }
- }
- }
|