TempAutoPIDTable.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using Caliburn.Micro.Core;
  2. using RecipeEditorLib.RecipeModel.Params;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Collections.ObjectModel;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace MECF.Framework.UI.Client.CenterViews.Parameter
  10. {
  11. public class TempAutoPIDTable : ParameterTable
  12. {
  13. public TempAutoPIDTable() : base()
  14. {
  15. }
  16. public TempAutoPIDTable(ParameterDataBase recipeData)
  17. {
  18. if (recipeData.Steps.Count <= 0) return;
  19. SetCurrentRecipeStep(recipeData, recipeData.Steps[0]);
  20. }
  21. public TempAutoPIDTable(ParameterDataBase recipeData, int selectedStepNo)
  22. {
  23. ParameterTable step = recipeData.Steps.Where(x => x.StepNo == selectedStepNo).FirstOrDefault();
  24. SetCurrentRecipeStep(recipeData, step);
  25. }
  26. public void SetTempPIDData(string value)
  27. {
  28. if (string.IsNullOrEmpty(value)) return;
  29. string[] strTempPID = value.Split('|');
  30. foreach (var item in strTempPID)
  31. {
  32. if (string.IsNullOrEmpty(item)) continue;
  33. string[] subTempPID = item.Split(';');
  34. Dictionary<string, string> dictTempPID = new Dictionary<string, string>();
  35. foreach (var pid in subTempPID)
  36. {
  37. if (string.IsNullOrEmpty(item)) continue;
  38. var keyValue = pid.Split(':');
  39. if (keyValue == null || keyValue.Length != 2) continue;
  40. dictTempPID[keyValue[0]] = keyValue[1];
  41. }
  42. }
  43. }
  44. }
  45. }