public async Task GetSynonyms() { using (WebClient client = new WebClient()) { try { GetHtmlHelper[3].PageContent = client.DownloadString($"{GetHtmlHelper[3].Uri}{GetHtmlHelper[3].VocText}"); } catch (Exception) { } } Synonyms.Clear(); while (GetHtmlHelper[3].PageContent != null && GetHtmlHelper[3].PageContent.Contains(GetHtmlHelper[3].Key)) { GetHtmlHelper[3].Text = ""; GetHtmlHelper[3].StartIndex = GetHtmlHelper[3].PageContent.IndexOf(GetHtmlHelper[3].Key) + GetHtmlHelper[3].Key.Length; GetHtmlHelper[3].Text = GetHtmlHelper[3].PageContent.Substring(GetHtmlHelper[3].StartIndex); GetHtmlHelper[3].EndIndex = GetHtmlHelper[3].Text.IndexOf(GetHtmlHelper[3].KeyEnd); GetHtmlHelper[3].PageContent = GetHtmlHelper[3].Text; GetHtmlHelper[3].Text = GetHtmlHelper[3].Text.Substring(0, GetHtmlHelper[3].EndIndex); Synonyms.Add(GetHtmlHelper[3].Text.Trim()); } }
public async void getSynonyms() { string lang; if (SelectedInput.Equals("English") && SelectedInput != null) { lang = "en"; } else { lang = " "; } var uri = "/api/v1/entries/" + lang + "/" + Word + "/synonyms"; if (SelectedInput == null) { DependencyService.Get <IMessage>().LongAlert("Please select language!"); } else { SynResult = await service.GetSynonymsAsync(uri); if (SynResult != null) { setSynonymValues(); } else { Synonyms.Clear(); } } }
public void setSynonymValues() { Synonyms.Clear(); foreach (var i in SynResult.results) { foreach (var j in i.lexicalEntries) { var synonym = new Synonym(); synonym.Type = j.lexicalCategory; synonym.SynonymItems = ""; foreach (var k in j.entries) { foreach (var l in k.senses) { foreach (var item in l.synonyms) { synonym.SynonymItems += "\n" + item.text; Console.WriteLine(); } } } Synonyms.Add(synonym); } } }
public override void Clear() { Tables.Clear(); Views.Clear(); MaterializedViews.Clear(); Indexes.Clear(); Sequences.Clear(); Synonyms.Clear(); Triggers.Clear(); StoredProcedures.Clear(); }
protected override void OnRemoving() { base.OnRemoving(); try { Synonyms.Clear(); //foreach thing in Synonyms en.Remove(); } catch (Exception ex) { throw new DocException("Failed to delete TermMaster in Synonyms delete", ex); } FlushCache(); }
public virtual void Invoke(Func <string, string> func) { if (null == func) { throw new ArgumentNullException("func"); } CanonicalForm = func.Invoke(CanonicalForm); var synonyms = Synonyms.ToList(); Synonyms.Clear(); foreach (var synonym in synonyms.OrderBy(x => x)) { Synonyms.Add(func.Invoke(synonym)); } }
private async void SentenceClick(string obj) { Translations.Clear(); Synonyms.Clear(); Antonyms.Clear(); Sentences.Clear(); var reply = await new OxfordDictionaryMVVMService().GetSentenceAsync(chosenSrc, obj); if (reply != null) { foreach (var result in reply.results) { foreach (var lexicalEntry in result.lexicalEntries) { foreach (var sentence in lexicalEntry.sentences) { Sentences.Add(sentence.text); } } } } // exception handling else if (ChosenSrc.ToString() != "en" && ChosenSrc.ToString() != "es") { var messageDialog = new MessageDialog("Sentences are not supported in this language at present.") { Title = "Warning" }; messageDialog.Commands.Add(new UICommand("Close")); await messageDialog.ShowAsync(); } else { var messageDialog = new MessageDialog("There is no example sentence for that word!") { Title = "Warning" }; messageDialog.Commands.Add(new UICommand("Close")); await messageDialog.ShowAsync(); } }
private async void TranslateClick(string obj) { Translations.Clear(); Synonyms.Clear(); Antonyms.Clear(); Sentences.Clear(); var reply = await new OxfordDictionaryMVVMService().GetTranslationAsync(chosenSrc, obj, ChosenDest); if (reply != null) { foreach (var result in reply.results) { foreach (var lexicalEntry in result.lexicalEntries) { foreach (var entry in lexicalEntry.entries) { foreach (var sense in entry.senses) { if (sense.translations == null) // exception handling { return; } foreach (var translation in sense.translations) { Translations.Add(translation.text); } } } } } } // exception handling else if (ChosenSrc == null) { var messageDialog = new MessageDialog("Choose a source language!") { Title = "Error" }; messageDialog.Commands.Add(new UICommand("Close")); await messageDialog.ShowAsync(); } else if (ChosenDest == null) { var messageDialog = new MessageDialog("Choose a destination language!") { Title = "Error" }; messageDialog.Commands.Add(new UICommand("Close")); await messageDialog.ShowAsync(); } else { var messageDialog = new MessageDialog("There is no translation for that word!") { Title = "Warning" }; messageDialog.Commands.Add(new UICommand("Close")); await messageDialog.ShowAsync(); } }
private async void AntonymClick(string obj) { Translations.Clear(); Synonyms.Clear(); Antonyms.Clear(); Sentences.Clear(); var reply = await new OxfordDictionaryMVVMService().GetAntonymAsync(chosenSrc, obj); if (reply != null) { foreach (var result in reply.results) { foreach (var lexicalEntry in result.lexicalEntries) { foreach (var entry in lexicalEntry.entries) { foreach (var sense in entry.senses) { foreach (var anonym in sense.antonyms) { Antonyms.Add(anonym.text); } } } } } } // exception handling else if (ChosenSrc == null) { var messageDialog = new MessageDialog("Choose a source language!") { Title = "Error" }; messageDialog.Commands.Add(new UICommand("Close")); await messageDialog.ShowAsync(); } else if (ChosenSrc.ToString() != "en") { var messageDialog = new MessageDialog("Antonyms are not supported in this language at present.") { Title = "Warning" }; messageDialog.Commands.Add(new UICommand("Close")); await messageDialog.ShowAsync(); } else { var messageDialog = new MessageDialog("There is no antonym for that word!") { Title = "Warning" }; messageDialog.Commands.Add(new UICommand("Close")); await messageDialog.ShowAsync(); } }
public void Reload(IEnumerable <SynonymViewModel> synonyms) { Synonyms.Clear(); Load(synonyms); }