ProcessRecipeViewModel.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  2. using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;
  3. using System.Collections.ObjectModel;
  4. using FurnaceUI.Client;
  5. using FurnaceUI.Models;
  6. namespace FurnaceUI.Views.Recipes
  7. {
  8. public class ProcessRecipeViewModel : FurnaceUIViewModelBase
  9. {
  10. public ObservableCollection<ProcessTypeFileItem> ProcessTypeFileList { get; set; } = new ObservableCollection<ProcessTypeFileItem>();
  11. public string FilePath { get; set; } = "";
  12. private RecipeProvider _recipeProvider = new RecipeProvider();
  13. public ProcessRecipeViewModel()
  14. {
  15. var type = new ProcessTypeFileItem();
  16. type.ProcessType = "Process";
  17. var prefix = $"Furnace\\Process";
  18. var recipes = _recipeProvider.GetXmlRecipeList(prefix);
  19. type.FileListByProcessType = RecipeSequenceTreeBuilder.BuildFileNode(prefix, "", false, recipes)[0].Files;
  20. ProcessTypeFileList.Add(type);
  21. }
  22. public void TreeSelectChanged(FileNode node)
  23. {
  24. if (node != null && node.IsFile)
  25. {
  26. FilePath = $" {node.PrefixPath}\\{node.FullPath}";
  27. }
  28. }
  29. public void SwitchPage(string page)
  30. {
  31. switch (page)
  32. {
  33. case "RecipeEdit":
  34. ClientApp.Instance.SwitchPage("Recipe", "recipeEdit", null);
  35. break;
  36. //case "SelfCheck":
  37. // ClientApp.Instance.SwitchPage("status", "selfCheck", null);
  38. // break;
  39. //case "Gas":
  40. // ClientApp.Instance.SwitchPage("status", "gas", null);
  41. //break;
  42. }
  43. }
  44. }
  45. }