/// <summary> /// Method that is called by wrapper client code used to make de async call to the API /// </summary> /// <param name="pSuccessCallback">Reference to a method that will be invoked when the async API callBack finish successfully</param> /// <param name="pErrorCallback">Reference to a method that will be invoked when the async API callBack retunrs an error</param> public void ViewJob(ViewJobCallBackDelegate pSuccessCallback, ErrorCallBackDelegate pErrorCallback, string pJob_Id, string pPre_mt) { try { // set callback handlers viewJobSuccessCallback = pSuccessCallback; methodErrorCallback = pErrorCallback; // create async caller object ViewJobMethodCaller caller = null; if (!_modeOffline) caller = new ViewJobMethodCaller(myGengoClient.myGengoClient.TranslateJobsGetByIdRaw); else caller = new ViewJobMethodCaller(ViewJobOffLineData); bool pHTMLEncode = false; IAsyncResult result = caller.BeginInvoke(pJob_Id, pPre_mt, pHTMLEncode, new AsyncCallback(ViewJobCallBack), caller); } catch (Exception ex) { ErrorInfo error = new ErrorInfo(ErrorType.AppError, ex.Message); methodErrorCallback.Invoke(error); } }
/// <summary> /// Method that is called by wrapper client code used to make de async call to the API /// </summary> /// <param name="pSuccessCallback">Reference to a method that will be invoked when the async API callBack finish successfully</param> /// <param name="pErrorCallback">Reference to a method that will be invoked when the async API callBack retunrs an error</param> public void ReviewJob(ReviewJobCallBackDelegate pSuccessCallback, ErrorCallBackDelegate pErrorCallback, string pJob_Id) { try { // set callback handlers reviewJobSuccessCallback = pSuccessCallback; methodErrorCallback = pErrorCallback; // create async caller object ReviewJobMethodCaller caller = null; if (!_modeOffline) caller = new ReviewJobMethodCaller(myGengoClient.myGengoClient.GetJobPreview); else caller = new ReviewJobMethodCaller(ReviewJobOffLineData); //string specificFolder = string.Format(Properties.Resources.AppDirectory, _specificFolderName); //string folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + specificFolder + "Previews"; //if (!System.IO.Directory.Exists(folder)) // System.IO.Directory.CreateDirectory(folder); string folder = GetFolderPathPreviewImage(); string impagePath = string.Format("{0}/preview{1}.jpg", folder, pJob_Id); string imagePathPrefix = ""; IAsyncResult result = caller.BeginInvoke(pJob_Id, impagePath, imagePathPrefix, new AsyncCallback(ReviewJobCallBack), caller); } catch (Exception ex) { ErrorInfo error = new ErrorInfo(ErrorType.AppError, ex.Message); methodErrorCallback.Invoke(error); } }
/// <summary> /// Method that is called by wrapper client code used to make de async call to the API /// </summary> /// <param name="pSuccessCallback">Reference to a method that will be invoked when the async API callBack finish successfully</param> /// <param name="pErrorCallback">Reference to a method that will be invoked when the async API callBack retunrs an error</param> public void TranslateJob(TranslateJobCallBackDelegate pSuccessCallback, ErrorCallBackDelegate pErrorCallback, string pType, string pSlug, string pBodySrc, string pLc_src, string pLc_tgt, string pTier, string pAutoApprove, string pCustomData, string pComment) { try { // set callback handlers translateJobSuccessCallback = pSuccessCallback; methodErrorCallback = pErrorCallback; // create async caller object TranslateJobMethodCaller caller = null; if (!_modeOffline) caller = new TranslateJobMethodCaller(myGengoClient.myGengoClient.Translate_JobsRaw); else caller = new TranslateJobMethodCaller(TranslateJobOffLineData); IAsyncResult result = caller.BeginInvoke(pType, pSlug, pBodySrc, pLc_src, pLc_tgt, pTier, pAutoApprove, pCustomData, pComment, new AsyncCallback(TranslateJobCallBack), caller); } catch (Exception ex) { ErrorInfo error = new ErrorInfo(ErrorType.AppError, ex.Message); methodErrorCallback.Invoke(error); } }
/// <summary> /// Method that is called by wrapper client code used to make de async call to the API /// </summary> /// <param name="pSuccessCallback">Reference to a method that will be invoked when the async API callBack finish successfully</param> /// <param name="pErrorCallback">Reference to a method that will be invoked when the async API callBack retunrs an error</param> public void RejectJob(RejectJobCallBackDelegate pSuccessCallback, ErrorCallBackDelegate pErrorCallback, string pJob_Id, string pReason, string pComment, string pCaptcha, string pFollowUp) { try { // set callback handlers rejectJobSuccessCallback = pSuccessCallback; methodErrorCallback = pErrorCallback; // create async caller object RejectJobMethodCaller caller = null; if (!_modeOffline) caller = new RejectJobMethodCaller(myGengoClient.myGengoClient.RejectJob); else caller = new RejectJobMethodCaller(RejectJobOffLineData); IAsyncResult result = caller.BeginInvoke(pJob_Id, pReason, pComment, pCaptcha, pFollowUp, new AsyncCallback(RejectJobCallBack), caller); } catch (Exception ex) { ErrorInfo error = new ErrorInfo(ErrorType.AppError, ex.Message); methodErrorCallback.Invoke(error); } }
/// <summary> /// Method that is called by wrapper client code used to make de async call to the API /// </summary> /// <param name="pSuccessCallback">Reference to a method that will be invoked when the async API callBack finish successfully</param> /// <param name="pErrorCallback">Reference to a method that will be invoked when the async API callBack retunrs an error</param> public void GetMyJobs(GetMyJobsCallBackDelegate pSuccessCallback, ErrorCallBackDelegate pErrorCallback, string pStatus, string pTimespan, string pCount, bool pLazyLoad) { try { // set callback handlers getMyJobsSuccessCallback = pSuccessCallback; methodErrorCallback = pErrorCallback; // create async caller object GetMyJobsMethodCaller caller = null; if (!_modeOffline) caller = new GetMyJobsMethodCaller(myGengoClient.myGengoClient.GetMyJobs); else caller = new GetMyJobsMethodCaller(GetMyJobsOffLineData); string jobCount = ConfigurationManager.AppSettings["wGengo_jobCount"]; IAsyncResult result = caller.BeginInvoke(pStatus, pTimespan, jobCount, pLazyLoad, new AsyncCallback(GetMyJobsCallBack), caller); } catch (Exception ex) { ErrorInfo error = new ErrorInfo(ErrorType.AppError, ex.Message); methodErrorCallback.Invoke(error); } }
/// <summary> /// Method that is called by wrapper client code used to make de async call to the API /// </summary> /// <param name="pSuccessCallback">Reference to a method that will be invoked when the async API callBack finish successfully</param> /// <param name="pErrorCallback">Reference to a method that will be invoked when the async API callBack retunrs an error</param> public void GetLanguages(GetLanguagesCallBackDelegate pSuccessCallback, ErrorCallBackDelegate pErrorCallback) { try { // set callback handlers getLanguagesSuccessCallback = pSuccessCallback; methodErrorCallback = pErrorCallback; // create async caller object GetLanguagesMethodCaller caller = null; if (!_modeOffline) caller = new GetLanguagesMethodCaller(myGengoClient.myGengoClient.Translate_Service_LanguageRaw); else caller = new GetLanguagesMethodCaller(GetLanguagesOffLineData); string jobCount = ConfigurationManager.AppSettings["wGengo_jobCount"]; IAsyncResult result = caller.BeginInvoke(new AsyncCallback(GetLanguagesCallBack), caller); } catch (Exception ex) { ErrorInfo error = new ErrorInfo(ErrorType.AppError, ex.Message); methodErrorCallback.Invoke(error); } }
//public delegate string AsyncMethodCaller(string jobId); /// <summary> /// Method that is called by wrapper client code used to make de async call to the API /// </summary> /// <param name="pSuccessCallback">Reference to a method that will be invoked when the async API callBack finish successfully</param> /// <param name="pErrorCallback">Reference to a method that will be invoked when the async API callBack retunrs an error</param> public void GetAccountBalance(GetAccountBalanceCallBackDelegate pSuccessCallback, ErrorCallBackDelegate pErrorCallback) { try { // set callback handlers getAccountBalanceSuccessCallback = pSuccessCallback; methodErrorCallback = pErrorCallback; // create ayns caller object GetAccountBalanceMethodCaller caller = null; if (!_modeOffline) caller = new GetAccountBalanceMethodCaller(myGengoClient.myGengoClient.Account_BalanceRaw); else caller = new GetAccountBalanceMethodCaller(TestMethodOffLineData); // call async IAsyncResult result = caller.BeginInvoke(new AsyncCallback(GetAccountBalanceCallBack), caller); } catch (Exception ex) { ErrorInfo error = new ErrorInfo(ErrorType.AppError, ex.Message); methodErrorCallback.Invoke(error); } }
/// <summary> /// Method that is called by wrapper client code used to make de async call to the API /// </summary> /// <param name="pSuccessCallback">Reference to a method that will be invoked when the async API callBack finish successfully</param> /// <param name="pErrorCallback">Reference to a method that will be invoked when the async API callBack retunrs an error</param> public void CorrectJob(CorrectJobCallBackDelegate pSuccessCallback, ErrorCallBackDelegate pErrorCallback, string pJob_Id, string pRequestCorrection) { try { // set callback handlers correctJobSuccessCallback = pSuccessCallback; methodErrorCallback = pErrorCallback; // create async caller object CorrectJobMethodCaller caller = null; if (!_modeOffline) caller = new CorrectJobMethodCaller(myGengoClient.myGengoClient.RequestCorrection); else caller = new CorrectJobMethodCaller(CorrectJobOffLineData); IAsyncResult result = caller.BeginInvoke(pJob_Id, pRequestCorrection, new AsyncCallback(CorrectJobCallBack), caller); } catch (Exception ex) { ErrorInfo error = new ErrorInfo(ErrorType.AppError, ex.Message); methodErrorCallback.Invoke(error); } }