public static void Match( [Required(Description = "Word to match")] string word, [Required(Description = "Strategy identifier")] string strategy, [Optional("", Description = "Dictionary identifier")] string dict, [Optional("", Description = "The url of the proxy server to use for http requests")] string proxy, [Optional("", Description = "The user name to use when the connecting to a proxy server that requires authentication")] string proxyusername, [Optional("", Description = "The password to use when the connecting to a proxy server that requires authentication")] string proxypassword, [Optional("", Description = "The domain to use when the connecting to a proxy server that requires authentication")] string proxydomain ) { try { DictService svc = new DictService(); SetupProxyServer(svc, proxy, proxyusername, proxypassword, proxydomain); DictionaryWord[] words; if (String.IsNullOrEmpty(dict)) { words = svc.Match(word, strategy); } else { words = svc.MatchInDict(dict, word, strategy); } foreach (DictionaryWord w in words) { Console.WriteLine("{0} : {1}", w.DictionaryId, w.Word); } } catch (System.Exception e) { Console.WriteLine("Error: {0}", e.Message); } }
private async void metroBtnLoadSimilarWords_Click(object sender, EventArgs e) { MakeLoadPanelVisible(metroPanelMatch); //lstSimilarWords.Items.Clear(); string strWordToMatch = metroTxtWordToMatch.Text; string strStrategies = metroComboStratagies.Text; DictionaryWord[] words = await Task.Run(() => service.Match(strWordToMatch, strStrategies)); string strDetails; lstSimilarWords.DataSource = await Task.Run(() => { List <string> lstWords = new List <string>(); foreach (DictionaryWord dictionaryWord in words) { lstWords.Add(dictionaryWord.Word); } return(lstWords); }); MakeLoadPanelHide(metroPanelMatch); }