Nevar pievienot vairāk kā 25 tēmas
Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
|
- using BPASmartClient.Helper;
- using BPASmartClient.Message;
- using FryPot_DosingSystem.Model;
- using Microsoft.Toolkit.Mvvm.ComponentModel;
- using Microsoft.Toolkit.Mvvm.Input;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace FryPot_DosingSystem.ViewModel
- {
- internal class RecipeSetDownViewModel : ObservableObject
- {
-
-
- /// <summary>
- /// 配方下发
- /// </summary>
- public RelayCommand<object> RecipeSetDownCommand { get; set; }
- /// <summary>
- /// 配方一键下发
- /// </summary>
- public RelayCommand AllRecipeSetDownCommand { get; set; }
- public ObservableCollection<NewRecipeModel> Recipes { get; set; } = new ObservableCollection<NewRecipeModel>();
- public RecipeSetDownViewModel()
- {
- Json<RecipeManage>.Read();
- Recipes = Json<RecipeManage>.Data.Recipes;
- RecipeSetDownCommand = new RelayCommand<object>((Id) =>
- {
- if (Id != null && Id is string strId)
- {
- var res = Recipes.FirstOrDefault(p => p.RecipeId == strId);
- if (res != null)
- {
- RecipeSetDown(new NewRecipeModel[] { res });
- }
- }
- });
- AllRecipeSetDownCommand = new RelayCommand(() =>
- {
- if (Recipes != null)
- {
- //foreach (var recipeModel in Recipes)
- //{
- // RecipeSetDown(recipeModel);
- //}
- RecipeSetDown(Recipes.ToArray());
- }
-
- });
- }
- /// <summary>
- /// 数据下发方法
- /// </summary>
- public void RecipeSetDown(NewRecipeModel[] recipes)
- {
- ActionManage.GetInstance.Send("RecipeSetDown", recipes);
- }
- }
- }
|