示例#1
0
 private void SearchCMD(object snu)
 {
     if (PossibleWordsList.Contains(Search))
     {
         SearchList = Search;
     }
 }
示例#2
0
 private void clearList(object suoo)
 {
     App.Current.Dispatcher.Invoke((Action) delegate // <--- HERE
     {
         PossibleWordsList.Clear();
         RawWords  = 0;
         RealWords = 0;
     });
 }
示例#3
0
 private void DSelected(object sus)
 {
     PossibleWordsList.Remove(SearchList);
 }
示例#4
0
        public void Get(string Letters, int words)
        {
            Task.Factory.StartNew(() =>
            {
                RawWords             = 0;
                List <string> values = new List <string>();
                foreach (char oooti in Letters)
                {
                    values.Add(oooti.ToString());
                }
                // Add onto the combinations.
                int qq = 0;
                for (int i = 1; i < words; i++)
                {
                    // Make combinations containing i + 1 letters.
                    List <string> new_values = new List <string>();
                    int g = 0;
                    foreach (string str in values)
                    {
                        // Add all possible letters to this string.
                        foreach (char oooti in Letters)
                        {
                            new_values.Add(str + oooti); g++; RawWords = g;
                        }
                    }

                    // Replace the old values with the new ones.
                    values = new_values;
                }
                HashSet <string> Dict = GetEngDictionary();
                foreach (string siis in values)
                {
                    //Match dictionary for non-duped words
                    if (AllowDictionary)
                    {
                        var matches = new List <string>();
                        //checks for non-duped words
                        if (!PossibleWordsList.Contains(siis))
                        {
                            //match word with dictionary

                            if (Dict.Contains(siis))
                            {
                                App.Current.Dispatcher.Invoke((Action) delegate // <--- HERE
                                {
                                    PossibleWordsList.Add(siis); qq++;
                                    RealWords = qq;
                                });
                            }
                        }
                        foreach (string gh in matches)
                        {
                            App.Current.Dispatcher.Invoke((Action) delegate // <--- HERE
                            {
                                PossibleWordsList.Add(gh);
                            });
                        }
                    }

                    //list every non-duplicate word generated.
                    else
                    {
                        if (!PossibleWordsList.Contains(siis))
                        {
                            App.Current.Dispatcher.Invoke((Action) delegate // <--- HERE
                            {
                                PossibleWordsList.Add(siis);
                            });
                        }
                    }
                }
                RealWords = qq;
            });
        }