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.JXJFoodBigStation.Model; using BPASmartClient.CustomResource.Pages.Model; namespace BPASmartClient.JXJFoodBigStation.ViewModel { public class RecipeInfosViewModel : ObservableObject { public RecipeInfosViewModel() { ActionManage.GetInstance.Register(new Action((o) => { if (o != null && o is RemoteRecipeData rm) { RecipeName = rm.RecipeName; RecipeCode = rm.RecipeCode; TrayCode = rm.TrayCode; //RawMaterialsInfo = rm.RawMaterial; //var rest = RawMaterialsInfo.GetHashCode(); 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 long RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value; OnPropertyChanged(); } } private long _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(); } }