SequenceDataProvider.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Xml;
  8. using OpenSEMI.ClientBase.ServiceProvider;
  9. using MECF.Framework.Common.RecipeCenter;
  10. using MECF.Framework.Common.Equipment;
  11. using RecipeEditorLib.DGExtension.CustomColumn;
  12. namespace VirgoUI.Client.Models.Recipe.Sequence
  13. {
  14. public class SequenceDataProvider : IProvider
  15. {
  16. private static SequenceDataProvider _Instance = null;
  17. public static SequenceDataProvider Instance
  18. {
  19. get
  20. {
  21. if (_Instance == null)
  22. _Instance = new SequenceDataProvider();
  23. return _Instance;
  24. }
  25. }
  26. public void Create()
  27. {
  28. }
  29. public bool CreateSequenceFolder(string foldername)
  30. {
  31. return RecipeClient.Instance.Service.CreateSequenceFolder(foldername);
  32. }
  33. public bool DeleteSequenceFolder(string foldername)
  34. {
  35. return RecipeClient.Instance.Service.DeleteSequenceFolder(foldername);
  36. }
  37. public bool Save(SequenceData seq)
  38. {
  39. return RecipeClient.Instance.Service.SaveSequence(seq.Name, seq.ToXml());
  40. }
  41. public List<string> GetSequences()
  42. {
  43. return RecipeClient.Instance.Service.GetSequenceNameList();
  44. }
  45. public List<string> GetRecipes(ModuleName modulename)
  46. {
  47. return RecipeClient.Instance.Service.GetRecipes(modulename, true).ToList();
  48. }
  49. public SequenceData GetSequenceByName(ObservableCollection<ColumnBase> _columns, string name)
  50. {
  51. string content = RecipeClient.Instance.Service.GetSequence(name);
  52. SequenceData seq = new SequenceData();
  53. XmlDocument doc = new XmlDocument();
  54. doc.LoadXml(content);
  55. seq.Name = name;
  56. seq.Load(_columns, doc);
  57. return seq;
  58. }
  59. public bool Rename(string beforename, string currentname)
  60. {
  61. return RecipeClient.Instance.Service.RenameSequence(beforename, currentname);
  62. }
  63. public bool Delete(string name)
  64. {
  65. return RecipeClient.Instance.Service.DeleteSequence(name);
  66. }
  67. public bool SaveAs(string name, SequenceData seq)
  68. {
  69. return RecipeClient.Instance.Service.SaveAsSequence(name, seq.ToXml());
  70. }
  71. public string GetSequenceFromXml()
  72. {
  73. string template = RecipeClient.Instance.Service.GetSequenceFormatXml();
  74. return template;
  75. }
  76. }
  77. }