public void CheckWordsGeneration()
 {
     SpecialWords sw = new SpecialWords("chórzysta");
     //List<string> lst = sw.GetWrongWords(0,new List<string>());
 }
Exemple #2
0
        private void GenerateLayout(SpecialWords sw)
        {
            string word  = sw.ProperWord;
            int    index = 0;

            foreach (Char c in word.ToCharArray())
            {
                if (sw.lstch.Count > 0 && sw.lstch.Contains(index))
                {
                    sLayout.Children.Add(GeneratePicker(new string[] { "h", "ch" }));
                }
                else if (sw.lstchLarge.Count > 0 && sw.lstchLarge.Contains(index))
                {
                    sLayout.Children.Add(GeneratePicker(new string[] { "H", "Ch" }));
                }
                else if (sw.lsth.Count > 0 && sw.lsth.Contains(index))
                {
                    if (index == 0 || (word[index - 1] != 'c' && word[index - 1] != 'C'))
                    {
                        sLayout.Children.Add(GeneratePicker(new string[] { "h", "ch" }));
                    }
                }
                else if (sw.lsthLarge.Count > 0 && sw.lsthLarge.Contains(index))
                {
                    sLayout.Children.Add(GeneratePicker(new string[] { "H", "Ch" }));
                }
                else if (sw.lstrz.Count > 0 && sw.lstrz.Contains(index))
                {
                    sLayout.Children.Add(GeneratePicker(new string[] { "rz", "ż" }));
                }
                else if (sw.lstrzLarge.Count > 0 && sw.lstrzLarge.Contains(index))
                {
                    sLayout.Children.Add(GeneratePicker(new string[] { "Rz", "Ż" }));
                }
                else if (sw.lstu.Count > 0 && sw.lstu.Contains(index))
                {
                    sLayout.Children.Add(GeneratePicker(new string[] { "u", "ó" }));
                }
                else if (sw.lstuLarge.Count > 0 && sw.lstuLarge.Contains(index))
                {
                    sLayout.Children.Add(GeneratePicker(new string[] { "U", "Ó" }));
                }
                else if (sw.lstÓ.Count > 0 && sw.lstÓ.Contains(index))
                {
                    sLayout.Children.Add(GeneratePicker(new string[] { "ó", "u" }));
                }
                else if (sw.lstż.Count > 0 && sw.lstż.Contains(index))
                {
                    sLayout.Children.Add(GeneratePicker(new string[] { "ż", "rz" }));
                }
                else if (sw.lstżLarge.Count > 0 && sw.lstżLarge.Contains(index))
                {
                    sLayout.Children.Add(GeneratePicker(new string[] { "Ż", "Rz" }));
                }
                else
                {
                    if (c != 'z')
                    {
                        Label l = new Label();
                        l.Text     = c.ToString();
                        l.FontSize = 20;
                        sLayout.Children.Add(l);
                    }
                    else
                    {
                        if (index > 0)
                        {
                            if (word[index - 1] != 'r' && word[index - 1] != 'R')
                            {
                                Label l = new Label();
                                l.Text     = c.ToString();
                                l.FontSize = 20;

                                sLayout.Children.Add(l);
                            }
                        }
                        else
                        {
                            if (c == 'z' || c == 'Z')
                            {
                                Label l = new Label();
                                l.Text     = c.ToString();
                                l.FontSize = 20;
                                sLayout.Children.Add(l);
                            }
                        }
                    }
                }
                index++;
            }
        }
Exemple #3
0
 /// <summary>
 /// Determines whether the given word indicates a method that needs special handling.
 /// </summary>
 /// <param name="word">The word to test.</param>
 /// <returns>True if the word indicats a method that need special handling, False otherwise.</returns>
 protected bool IsSpecialCase(string word)
 {
     //TODO: Is the second clause even possible in non-Java languages?
     return(SpecialWords.Contains(word) || Regex.IsMatch(word, "^[0-9].*"));
 }
Exemple #4
0
        public void InitializeLayout(SpecialWords sw)
        {
            _sw = sw;

            GenerateLayout(sw);
        }