private void button_Click(object sender, RoutedEventArgs e) { byte caps = 0; if (capitalization.SelectedItem.ToString() == "ALL CAPS") { caps = 1; } else if (capitalization.SelectedItem.ToString() == "all lower") { caps = 2; } brushes.Clear(); words.Clear(); //delims to split text by //Starts new Dialog, and gets the return value string[] input = new string[1]; using (var form = new TextInput()) { var result = form.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { input = form.values; //values preserved after close } else { System.Windows.MessageBox.Show("You left the TextBox Empty!"); return; } } //End of Dialog //Starts new thread to display splashscreen bool wordExists; bool blackListExist; //add first word to List<Word> words //words.Add(new Word(input[0])); //loop through rest of words of input text for (int i = 0; i < input.Length; i++) { blackListExist = false; foreach (Word t in blackList) { if (String.Equals(input[i], t.actualWord, StringComparison.OrdinalIgnoreCase) || input[i].Length <= 2) { blackListExist = true; break; } } if (!blackListExist) { //assume input[i] doesnt exist in List<Word> words wordExists = false; //loop through all Word objects in List<Word> words foreach (Word j in words) { //if input[i] is equal to the actualWord element of j //j is a Word in List<Word> words if (j.actualWord == input[i]) { //if the strings match, increment the count of j //set wordExists to true and break out of foreach loop j.count++; wordExists = true; break; } } //if input[i] did not match any actualWord variable in List<Word> words if (!wordExists) { //create new entry for List<Word> words string temp = input[i]; if (caps == 1) { temp = temp.ToUpper(); } else if (caps == 2) { temp = temp.ToLower(); } words.Add(new Word(temp)); } } } //checks for all colors used for words if (checkBox.IsChecked == true) { brushes.Add(System.Drawing.Brushes.Black); } if (checkBox1.IsChecked == true) { brushes.Add(System.Drawing.Brushes.Gray); } if (checkBox2.IsChecked == true) { brushes.Add(System.Drawing.Brushes.Orange); } if (checkBox3.IsChecked == true) { brushes.Add(System.Drawing.Brushes.Red); } if (checkBox4.IsChecked == true) { brushes.Add(System.Drawing.Brushes.Purple); } if (checkBox5.IsChecked == true) { brushes.Add(System.Drawing.Brushes.Blue); } if (checkBox6.IsChecked == true) { brushes.Add(System.Drawing.Brushes.Green); } if (checkBox7.IsChecked == true) { brushes.Add(System.Drawing.Brushes.Yellow); } if (checkBox8.IsChecked == true) { brushes.Add(System.Drawing.Brushes.White); } //if they have no color selected, makes black default if (brushes.Count == 0) { checkBox.IsChecked = true; brushes.Add(System.Drawing.Brushes.Black); } //gets shape to be used if (shapeList.SelectedItem.ToString() != "Custom") { filename = AppDomain.CurrentDomain.BaseDirectory; } if (shapeList.SelectedItem.ToString() == "Square") { filename += "\\square.png"; } else if (shapeList.SelectedItem.ToString() == "Triangle") { filename += "\\triangle.png"; } else if (shapeList.SelectedItem.ToString() == "Circle") { filename += "\\circle.png"; } else if (shapeList.SelectedItem.ToString() == "Heart") { filename += "\\heart.png"; } bool transparent = false; System.Drawing.Color color = System.Drawing.Color.White; if (trans.IsChecked == true) { transparent = true; } if (bgColor.SelectedItem.ToString() != "Custom Background") { color = System.Drawing.Color.FromName(bgColor.SelectedItem.ToString()); backFilename = null; } int maxCount = ((int)Math.Sqrt(int.Parse(widthtext.Text) * int.Parse(heighttext.Text))) / 7; //Console.WriteLine(maxCount); if (words.Count > maxCount) { words.RemoveRange(maxCount, words.Count - maxCount); } else { int tempCount = 0; while (words.Count < maxCount) { words.Add(new Word(words[tempCount++].actualWord)); } } byte fontStyle = 0; if (bold.IsChecked == true && ital.IsChecked == true) { fontStyle = 3; } else if (ital.IsChecked == true) { fontStyle = 2; } else if (bold.IsChecked == true) { fontStyle = 1; } int scale = 1; if (times1.IsChecked == true) { scale = 1; } else if (times2.IsChecked == true) { scale = 2; } else if (times3.IsChecked == true) { scale = 3; } else if (times4.IsChecked == true) { scale = 4; } //this is where the tranistion to the winform happens //as soon as the object is created, the calculations begin //first arg is the list of words //second arg is the name of the font //third arg is shape //forth arg is list of colors used for words //fifth arg is width but make sure its the height value //sixth arg is height but make sure its the width value //seventh arg is background color main pic = new main(words, fontsList.SelectedItem.ToString(), brushes, int.Parse(heighttext.Text), int.Parse(widthtext.Text), color, filename, fontStyle, transparent, scale, backFilename); while (pic.ShowDialog() == System.Windows.Forms.DialogResult.Yes) { pic = new main(words, fontsList.SelectedItem.ToString(), brushes, int.Parse(heighttext.Text), int.Parse(widthtext.Text), color, filename, fontStyle, transparent, scale, backFilename); } //draw pic = new draw(int.Parse(textBox1.Text), int.Parse(textBox2.Text)); //pic.ShowDialog(); }