using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Toolkit.Mvvm.ComponentModel; using System.Collections.ObjectModel; using Microsoft.Toolkit.Mvvm.Input; using BPASmartClient.Helper; using BPASmartClient.DosingHKProject.Model; using BPASmartClient.CustomResource.Pages.Model; namespace BPASmartClient.DosingHKProject.ViewModel { public class RecipeInfosViewModel : ObservableObject { public RecipeInfosViewModel() { ActionManage.GetInstance.CancelRegister("RecipeInfo"); ActionManage.GetInstance.Register(new Action((o) => { if (o != null && o is RemoteRecipeData rm) { RecipeName = rm.RecipeName; RecipeCode = rm.RecipeCode; //TrayCode = rm.TrayCode; foreach (var item in rm.RawMaterial) { RawMaterialsInfo.Add(item); } } }), "RecipeInfo"); ReturnPage = new RelayCommand(() => { ActionManage.GetInstance.Send("CloseRecipeInfosView"); }); } public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } private string _mRecipeName; public string RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value; OnPropertyChanged(); } } private string _mRecipeCode; public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } } private int _mTrayCode; public RelayCommand ReturnPage { get; set; } public ObservableCollection RawMaterialsInfo { get; set; } = new ObservableCollection(); } }