using BPA.Helper; using BPASmartClient.SmallBatchingSystem.ViewModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace BPASmartClient.SmallBatchingSystem.Views { /// /// NewPfView.xaml 的交互逻辑 /// public partial class NewRecipeView : Window { public NewRecipeView() { InitializeComponent(); ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "NewRecipeViewModelClose", true); } private void Button_Click_1(object sender, RoutedEventArgs e) { //this.Close(); } private void Button_Click(object sender, RoutedEventArgs e) { //if (Json.Data.Recipes.FirstOrDefault(p => p.RecipeName == this.outName.Text) == null) //{ // Json.Data.Recipes.Add(new RecipeInfo() // { // RecipeName = this.outName.Text, // SiloInfoModels = NewRecipeViewModel.SiloInfoModels // }); //} //else //{ // int index = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeName == outName.Text); // if (index >= 0 && index < Json.Data.Recipes.Count) // { // Json.Data.Recipes.ElementAt(index).RecipeName = outName.Text; // Json.Data.Recipes.ElementAt(index).SiloInfoModels.Clear(); // NewRecipeViewModel.SiloInfoModels.ToList().ForEach(item => // { // Json.Data.Recipes.ElementAt(index).SiloInfoModels.Add(item); // }); // } //} //this.Close(); } } }