| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 | using System;using System.Collections.Generic;using Aitex.Core.Util;using Aitex.Core.WCF;using MECF.Framework.Common.Equipment;namespace MECF.Framework.Common.RecipeCenter{    public class RecipeClient : Singleton<RecipeClient>    {        public bool InProcess { get; set; }        private IRecipeService _service;        public IRecipeService Service        {            get            {                if (_service == null)                {                    if (InProcess)                        _service = new RecipeService();                    else                        _service = new RecipeServiceClient();                }                return _service;            }        }    }    public class RecipeServiceClient : ServiceClientWrapper<IRecipeService>, IRecipeService    {        public RecipeServiceClient()            : base("Client_IRecipeService", "RecipeService")        {        }        public string LoadRecipe(ModuleName chamId, string recipeName)        {            string result = null;            Invoke(svc => { result = svc.LoadRecipe(chamId, recipeName); });            return result;           }        public Tuple<string, string> LoadRunTimeRecipeInfo(ModuleName chamId)        {            Tuple<string, string> result = null;            Invoke(svc => { result = svc.LoadRunTimeRecipeInfo(chamId); });            return result;           }        public IEnumerable<string> GetRecipes(ModuleName chamId, bool includeUsedRecipe)        {            IEnumerable<string> result = null;            Invoke(svc => { result = svc.GetRecipes(chamId, includeUsedRecipe); });            return result;           }        public string GetXmlRecipeList(ModuleName chamId, bool includeUsedRecipe)        {            string result = null;            Invoke(svc => { result = svc.GetXmlRecipeList(chamId, includeUsedRecipe); });            return result;           }        public bool DeleteRecipe(ModuleName chamId, string recipeName)        {            bool result = false;            Invoke(svc => { result = svc.DeleteRecipe(chamId, recipeName); });            return result;           }        public bool DeleteFolder(ModuleName chamId, string folderName)        {            bool result = false;            Invoke(svc => { result = svc.DeleteFolder(chamId, folderName); });            return result;           }        public bool SaveAsRecipe(ModuleName chamId, string recipeName, string recipeContent)        {            bool result = false;            Invoke(svc => { result = svc.SaveAsRecipe(chamId, recipeName, recipeContent); });            return result;           }        public bool SaveRecipe(ModuleName chamId, string recipeName, string recipeContent)        {            bool result = false;            Invoke(svc => { result = svc.SaveRecipe(chamId, recipeName, recipeContent); });            return result;           }        public bool CreateFolder(ModuleName chamId, string folderName)        {            bool result = false;            Invoke(svc => { result = svc.CreateFolder(chamId, folderName); });            return result;           }        public bool MoveRecipeFile(ModuleName chamId, string folderName, string tragetFolderName)        {            bool result = false;            Invoke(svc => { result = svc.MoveRecipeFile(chamId, folderName, tragetFolderName); });            return result;        }        public bool RenameRecipe(ModuleName chamId, string oldName, string newName)        {            bool result = false;            Invoke(svc => { result = svc.RenameRecipe(chamId, oldName, newName); });            return result;           }        public bool RenameFolder(ModuleName chamId, string oldName, string newName)        {            bool result = false;            Invoke(svc => { result = svc.RenameFolder(chamId, oldName, newName); });            return result;           }        public string GetRecipeFormatXml(ModuleName chamId)        {            string result = null;            Invoke(svc => { result = svc.GetRecipeFormatXml(chamId); });            return result;           }        public string GetRecipeTemplate(ModuleName chamId)        {            string result = string.Empty;            Invoke(svc => { result = svc.GetRecipeTemplate(chamId); });            return result;           }        public string GetRecipeByBarcode(ModuleName chamId, string barcode)        {            string result = string.Empty;            Invoke(svc => { result = svc.GetRecipeByBarcode(chamId, barcode); });            return result;           }        public string GetXmlSequenceList(ModuleName chamId)        {            string result = null;            Invoke(svc => { result = svc.GetXmlSequenceList(chamId); });            return result;        }        public string GetSequence(string sequenceName)        {            string result = string.Empty;            Invoke(svc => { result = svc.GetSequence(sequenceName); });            return result;        }        public List<string> GetSequenceNameList()        {            List<string> result = null;            Invoke(svc => { result = svc.GetSequenceNameList(); });            return result;        }        public bool DeleteSequence(string sequenceName)        {            bool result = false;            Invoke(svc => { result = svc.DeleteSequence(sequenceName); });            return result;        }        public bool SaveSequence(string sequenceName, string sequenceContent)        {            bool result = false;            Invoke(svc => { result = svc.SaveSequence(sequenceName, sequenceContent); });            return result;        }        public bool SaveAsSequence(string sequenceName, string sequenceContent)        {            bool result = false;            Invoke(svc => { result = svc.SaveAsSequence(sequenceName, sequenceContent); });            return result;        }        public bool RenameSequence(string oldName, string newName)        {            bool result = false;            Invoke(svc => { result = svc.RenameSequence(oldName, newName); });            return result;        }        public string GetSequenceFormatXml()        {            string result = string.Empty;            Invoke(svc => { result = svc.GetSequenceFormatXml(); });            return result;        }        public bool RenameSequenceFolder(string oldName, string newName)        {            bool result = false;            Invoke(svc => { result = svc.RenameSequenceFolder(oldName, newName); });            return result;        }        public bool CreateSequenceFolder(string folderName)        {            bool result = false;            Invoke(svc => { result = svc.CreateSequenceFolder(folderName); });            return result;        }        public bool DeleteSequenceFolder(string folderName)        {            bool result = false;            Invoke(svc => { result = svc.DeleteSequenceFolder(folderName); });            return result;        }        #region extended recipe interface        public string LoadRecipeByPath(string pathName, string recipeName)        {            string result = null;            Invoke(svc => { result = svc.LoadRecipeByPath(pathName, recipeName); });            return result;        }        public Tuple<string, string> LoadRunTimeRecipeInfoByPath(string pathName)        {            Tuple<string, string> result = null;            Invoke(svc => { result = svc.LoadRunTimeRecipeInfoByPath(pathName); });            return result;        }        public IEnumerable<string> GetRecipesByPath(string pathName, bool includeUsedRecipe)        {            IEnumerable<string> result = null;            Invoke(svc => { result = svc.GetRecipesByPath(pathName, includeUsedRecipe); });            return result;        }        public string GetXmlRecipeListByPath(string pathName, bool includeUsedRecipe)        {            string result = null;            Invoke(svc => { result = svc.GetXmlRecipeListByPath(pathName, includeUsedRecipe); });            return result;        }        public bool DeleteRecipeByPath(string pathName, string recipeName)        {            bool result = false;            Invoke(svc => { result = svc.DeleteRecipeByPath(pathName, recipeName); });            return result;        }        public bool DeleteFolderByPath(string pathName, string folderName)        {            bool result = false;            Invoke(svc => { result = svc.DeleteFolderByPath(pathName, folderName); });            return result;        }        public bool SaveAsRecipeByPath(string pathName, string recipeName, string recipeContent)        {            bool result = false;            Invoke(svc => { result = svc.SaveAsRecipeByPath(pathName, recipeName, recipeContent); });            return result;        }        public bool SaveRecipeByPath(string pathName, string recipeName, string recipeContent)        {            bool result = false;            Invoke(svc => { result = svc.SaveRecipeByPath(pathName, recipeName, recipeContent); });            return result;        }        public bool CreateFolderByPath(string pathName, string folderName)        {            bool result = false;            Invoke(svc => { result = svc.CreateFolderByPath(pathName, folderName); });            return result;        }        public bool RenameRecipeByPath(string pathName, string oldName, string newName)        {            bool result = false;            Invoke(svc => { result = svc.RenameRecipeByPath(pathName, oldName, newName); });            return result;        }        public bool RenameFolderByPath(string pathName, string oldName, string newName)        {            bool result = false;            Invoke(svc => { result = svc.RenameFolderByPath(pathName, oldName, newName); });            return result;        }        public string GetRecipeFormatXmlByPath(string pathName)        {            string result = null;            Invoke(svc => { result = svc.GetRecipeFormatXmlByPath(pathName); });            return result;        }        public string GetRecipeTemplateByPath(string pathName)        {            string result = string.Empty;            Invoke(svc => { result = svc.GetRecipeTemplateByPath(pathName); });            return result;        }        public string GetRecipeByBarcodeByPath(string pathName, string barcode)        {            string result = string.Empty;            Invoke(svc => { result = svc.GetRecipeByBarcodeByPath(pathName, barcode); });            return result;        }        #endregion    }}
 |