public void TranslateTemplateThread() { articleContentCache.TranslatedArticle_Content = ""; articleContentCache.IsTranslatedArticle = false; pr = new PostProcessor(SessionsManager.RuleFileName, SessionsManager.VerbListFileName, SessionsManager.NounListFileName, SessionsManager.AdjectiveListFileName, SessionsManager.PronounListFileName, SessionsManager.UsersCustomFileName); pr.LoadTextToTranslate(articleContentCache.Article_WikiContent); pr.OnTranslationComplete += new PostProcessor.TranslationCompleteDelegate(TranslationOfThreadCompleted); templateTranslatorThread = new Thread(new ThreadStart(pr.TranslateVoid)); //inside the thread is the function that will be executed templateTranslatorThread.Name = "TemplateTranslatorThread"; //Name of the thread templateTranslatorThread.Start(); //starting translation. }
/// <summary> /// Note: two files will be used: "Templateparser.txt" /// Templateparser.txt will contain the regular expressions on how to get text from recentchanges pages /// or from any other sources, /// template_temp is a blank page, which might be required just in case, to feed the postprocessor before translating /// May be it should be just fine by providing the first parameter. /// TODO: will work on this later to change the postprocessor /// </summary> private void PrepareTemplateListByParsingTheTextBox() { if (!string.IsNullOrEmpty(richTextBoxTemplateList.Text)) { PostProcessor pr = new PostProcessor(SessionsManager.TemplateParserFileName, SessionsManager.BlankFileName, SessionsManager.BlankFileName, SessionsManager.BlankFileName, SessionsManager.BlankFileName, SessionsManager.BlankFileName); pr.LoadTextToTranslate(richTextBoxTemplateList.Text); pr.OnTranslationComplete += new PostProcessor.TranslationCompleteDelegate(C_TranslateComplete); pr.TranslateVoid(); } //Required : C_TranslationComplete method }