using System; using System.Collections.Generic; using System.Collections.ObjectModel; using Aitex.Core.RT.RecipeCenter; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.RecipeCenter; using Newtonsoft.Json; namespace CyberX8_MainPages.PMs { class UiRecipeManager : IUiRecipeManager { public string LoadRecipe(string chamId, string receipeName) { return RecipeClient.Instance.Service.LoadRecipe(ModuleNameString.ToEnum(chamId), receipeName); } public string LoadRecipeByPath(string path) { return RecipeClient.Instance.Service.LoadRecipeByPath(path); } public Tuple LoadRunTimeRecipeInfo(string chamId) { return RecipeClient.Instance.Service.LoadRunTimeRecipeInfo(ModuleNameString.ToEnum(chamId)); } public IEnumerable GetRecipes(string chamId, bool includeUsedRecipe) { return RecipeClient.Instance.Service.GetRecipes(ModuleNameString.ToEnum(chamId), includeUsedRecipe); } public ObservableCollection GetRecipesByType(string recipeType) { return RecipeClient.Instance.Service.GetRecipesByType(recipeType); } public ObservableCollection GetEngineeringRecipesByType(string recipeType) { return RecipeClient.Instance.Service.GetEngineeringRecipesByType(recipeType); } public ObservableCollection GetRecipeByDirectoryList(List recipeType) { return RecipeClient.Instance.Service.GetRecipeByDirectoryList(recipeType); } /// /// 通过绝对路径删除recipe /// /// /// public bool DeleteRecipeByFullPath(string fullPath) { return RecipeClient.Instance.Service.DeleteRecipeByFullPath(fullPath); } /// /// Promot recipe /// /// /// public bool PromoteRecipe(List FilePaths) { return RecipeClient.Instance.Service.PromoteRecipe(FilePaths); } /// /// 加载 recipe /// /// /// public T LoadRecipe(string recipeFullName) { Type type = typeof(T); string recipeContent =RecipeClient.Instance.Service.LoadGenericityRecipe(type.ToString(),recipeFullName); if(!string.IsNullOrEmpty(recipeContent)) { return JsonConvert.DeserializeObject(recipeContent); } else { return default(T); } } /// /// 保存 recipe /// /// /// public void SaveRecipe(string root, string recipeName,string recipeType, object recipe) { Type type = typeof(T); string str=JsonConvert.SerializeObject(recipe); RecipeClient.Instance.Service.SaveRecipeTypeRecipe(root, recipeName,recipeType, str,type.ToString()); } public bool DeleteRecipe(string chamId, string recipeName) { return RecipeClient.Instance.Service.DeleteRecipe(ModuleNameString.ToEnum(chamId), recipeName); } public bool SaveAsRecipe(string chamId, string recipeName, string recipeContent) { return RecipeClient.Instance.Service.SaveAsRecipe(ModuleNameString.ToEnum(chamId), recipeName, recipeContent); } public bool SaveAsRecipe2(string chamId,string type, string recipeName, string recipeContent) { return RecipeClient.Instance.Service.SaveAsRecipe2(ModuleNameString.ToEnum(chamId),type, recipeName, recipeContent); } public bool SaveRecipe(string chamId, string recipeName, string recipeContent) { return RecipeClient.Instance.Service.SaveRecipe(ModuleNameString.ToEnum(chamId), recipeName, recipeContent); } public bool RenameRecipe(string chamId, string oldName, string newName) { return RecipeClient.Instance.Service.RenameRecipe(ModuleNameString.ToEnum(chamId), oldName, newName); } public bool CreateFolder(string chamId, string folderName) { return RecipeClient.Instance.Service.CreateFolder(ModuleNameString.ToEnum(chamId), folderName); } public bool MoveRecipeFile(string chamId, string folderName, string tragetFolderName) { return RecipeClient.Instance.Service.MoveRecipeFile(ModuleNameString.ToEnum(chamId), folderName, tragetFolderName); } public bool DeleteFolder(string chamId, string foldName) { return RecipeClient.Instance.Service.DeleteFolder(ModuleNameString.ToEnum(chamId), foldName); } public string GetXmlRecipeList(string chamId, bool includingUsedRecipe) { return RecipeClient.Instance.Service.GetXmlRecipeList(ModuleNameString.ToEnum(chamId), includingUsedRecipe); } public bool RenameFolder(string chamId, string oldName, string newName) { return RecipeClient.Instance.Service.RenameFolder(ModuleNameString.ToEnum(chamId), oldName, newName); } public string GetRecipeFormatXml(string chamId) { return RecipeClient.Instance.Service.GetRecipeFormatXml(ModuleNameString.ToEnum(chamId)); } public string GetRecipeTemplate(string chamId) { return RecipeClient.Instance.Service.GetRecipeTemplate(ModuleNameString.ToEnum(chamId)); } } }