private static void QuitLingvo(String postfix, IEnsoService service) { try { ILingvoApplication lingvo = new CLingvoApplication(); lingvo.Quit(); } catch (Exception) { service.DisplayMessage(new EnsoMessage(ERROR_MESSAGE)); } }
private static void TranslateWord(String postfix, IEnsoService service) { Match m = wordParser.Match(postfix); String word = m.Groups[1].Value; if ("".Equals(word.Trim())) { word = service.GetUnicodeSelection(); } bool isLatin = latinMatcher.IsMatch(word); m = directionParser.Match(postfix); String from = m.Groups[1].Value; if (!lang2code.Keys.Contains(from)) { from = isLatin ? LINGVO_SECONDARY_LANG : LINGVO_CORE_LANG; } String to = m.Groups[2].Value; if (!lang2code.Keys.Contains(to)) { to = isLatin ? LINGVO_CORE_LANG : LINGVO_SECONDARY_LANG; } try { ILingvoApplication lingvo = new CLingvoApplication(); lingvo.TranslateTextInDirection(word, lang2code[from], lang2code[to]); } catch (Exception) { service.DisplayMessage(new EnsoMessage(ERROR_MESSAGE)); } }
private static void TranslateWord(String postfix, IEnsoService service) { Match m = wordParser.Match(postfix); String word = m.Groups[1].Value; if ("".Equals(word.Trim())) word = service.GetUnicodeSelection(); bool isLatin = latinMatcher.IsMatch(word); m = directionParser.Match(postfix); String from = m.Groups[1].Value; if (!lang2code.Keys.Contains(from)) from = isLatin ? LINGVO_SECONDARY_LANG : LINGVO_CORE_LANG; String to = m.Groups[2].Value; if (!lang2code.Keys.Contains(to)) to = isLatin ? LINGVO_CORE_LANG : LINGVO_SECONDARY_LANG; try { ILingvoApplication lingvo = new CLingvoApplication(); lingvo.TranslateTextInDirection(word, lang2code[from], lang2code[to]); } catch (Exception) { service.DisplayMessage(new EnsoMessage(ERROR_MESSAGE)); } }