The code below has many Lists<>
but I'm not sure how to modify it. The only thing here that is an algorithm is the Fisher Yates shuffle algorithm. I am trying to put in good use an algorithm or just code better said to do this. It seems a bunch of code just used in repetition.
My question is, is there a way to make this code better? My task is to randomize names either male or female. The ListBox
should stay like this. I don't want them to do much but just be there. Like the Country or birth date. How can improve this code to make it look cleaner and better? I am not concerned about the shuffler algorithm but more of the code that I have wrote down on here.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace PerfectName
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
ListBoxItem item1;
List<string> MaleNamesThatStartWithA;
List<string> MaleNamesThatStartWithB;
List<string> MaleNamesThatStartWithC;
List<string> MaleNamesThatStartWithD;
List<string> MaleNamesThatStartWithE;
List<string> MaleNamesThatStartWithF;
List<string> MaleNamesThatStartWithG;
List<string> MaleNamesThatStartWithH;
List<string> MaleNamesThatStartWithI;
List<string> MaleNamesThatStartWithJ;
List<string> MaleNamesThatStartWithK;
List<string> MaleNamesThatStartWithL;
List<string> MaleNamesThatStartWithM;
List<string> MaleNamesThatStartWithN;
List<string> MaleNamesThatStartWithO;
List<string> MaleNamesThatStartWithP;
List<string> MaleNamesThatStartWithQ;
List<string> MaleNamesThatStartWithR;
List<string> MaleNamesThatStartWithS;
List<string> MaleNamesThatStartWithT;
List<string> MaleNamesThatStartWithU;
List<string> MaleNamesThatStartWithV;
List<string> MaleNamesThatStartWithW;
List<string> MaleNamesThatStartWithX;
List<string> MaleNamesThatStartWithY;
List<string> MaleNamesThatStartWithZ;
List<string> FemaleNamesThatStartWithA;
List<string> FemaleNamesThatStartWithB;
List<string> FemaleNamesThatStartWithC;
List<string> FemaleNamesThatStartWithD;
List<string> FemaleNamesThatStartWithE;
List<string> FemaleNamesThatStartWithF;
List<string> FemaleNamesThatStartWithG;
List<string> FemaleNamesThatStartWithH;
List<string> FemaleNamesThatStartWithI;
List<string> FemaleNamesThatStartWithJ;
List<string> FemaleNamesThatStartWithK;
List<string> FemaleNamesThatStartWithL;
List<string> FemaleNamesThatStartWithM;
List<string> FemaleNamesThatStartWithN;
List<string> FemaleNamesThatStartWithO;
List<string> FemaleNamesThatStartWithP;
List<string> FemaleNamesThatStartWithQ;
List<string> FemaleNamesThatStartWithR;
List<string> FemaleNamesThatStartWithS;
List<string> FemaleNamesThatStartWithT;
List<string> FemaleNamesThatStartWithU;
List<string> FemaleNamesThatStartWithV;
List<string> FemaleNamesThatStartWithW;
List<string> FemaleNamesThatStartWithX;
List<string> FemaleNamesThatStartWithY;
List<string> FemaleNamesThatStartWithZ;
public MainWindow()
{
InitializeComponent();
MaleNamesThatStartWithA = new List<string>();
MaleNamesThatStartWithA.Add("Arnie");
MaleNamesThatStartWithA.Add("Albert");
MaleNamesThatStartWithB = new List<string>();
MaleNamesThatStartWithB.Add("Bart");
MaleNamesThatStartWithB.Add("Bernie");
MaleNamesThatStartWithC = new List<string>();
MaleNamesThatStartWithC.Add("Catherine");
MaleNamesThatStartWithC.Add("Caroline");
MaleNamesThatStartWithD = new List<string>();
MaleNamesThatStartWithD.Add("Dilbert");
MaleNamesThatStartWithD.Add("Danial");
MaleNamesThatStartWithE = new List<string>();
MaleNamesThatStartWithE.Add("Evan");
MaleNamesThatStartWithE.Add("Ethan");
MaleNamesThatStartWithF = new List<string>();
MaleNamesThatStartWithF.Add("Frank");
MaleNamesThatStartWithF.Add("Frankie");
MaleNamesThatStartWithG = new List<string>();
MaleNamesThatStartWithG.Add("Grover");
MaleNamesThatStartWithG.Add("Gabriel");
MaleNamesThatStartWithH = new List<string>();
MaleNamesThatStartWithH.Add("Harold");
MaleNamesThatStartWithH.Add("Harry");
MaleNamesThatStartWithI = new List<string>();
MaleNamesThatStartWithI.Add("Ivan");
MaleNamesThatStartWithI.Add("Iuri");
MaleNamesThatStartWithJ = new List<string>();
MaleNamesThatStartWithJ.Add("James");
MaleNamesThatStartWithJ.Add("Jim");
MaleNamesThatStartWithK = new List<string>();
MaleNamesThatStartWithK.Add("Kyle");
MaleNamesThatStartWithK.Add("Kory");
MaleNamesThatStartWithL = new List<string>();
MaleNamesThatStartWithL.Add("Leon");
MaleNamesThatStartWithL.Add("Larry");
MaleNamesThatStartWithM = new List<string>();
MaleNamesThatStartWithM.Add("Martin");
MaleNamesThatStartWithM.Add("Mario");
MaleNamesThatStartWithN = new List<string>();
MaleNamesThatStartWithN.Add("Neto");
MaleNamesThatStartWithN.Add("Nathan");
MaleNamesThatStartWithO = new List<string>();
MaleNamesThatStartWithO.Add("Omar");
MaleNamesThatStartWithO.Add("Omarion");
MaleNamesThatStartWithP = new List<string>();
MaleNamesThatStartWithP.Add("Peter");
MaleNamesThatStartWithP.Add("Pedro");
MaleNamesThatStartWithQ = new List<string>();
MaleNamesThatStartWithQ.Add("Quil");
MaleNamesThatStartWithQ.Add("Quavo");
MaleNamesThatStartWithR = new List<string>();
MaleNamesThatStartWithR.Add("Rico");
MaleNamesThatStartWithR.Add("Robert");
MaleNamesThatStartWithS = new List<string>();
MaleNamesThatStartWithS.Add("Stewart");
MaleNamesThatStartWithS.Add("Steven");
MaleNamesThatStartWithT = new List<string>();
MaleNamesThatStartWithT.Add("Tom");
MaleNamesThatStartWithT.Add("Todd");
MaleNamesThatStartWithU = new List<string>();
MaleNamesThatStartWithU.Add("Ustavo");
MaleNamesThatStartWithU.Add("Ulisius");
MaleNamesThatStartWithV = new List<string>();
MaleNamesThatStartWithV.Add("Victor");
MaleNamesThatStartWithV.Add("Vinny");
MaleNamesThatStartWithW = new List<string>();
MaleNamesThatStartWithW.Add("Will");
MaleNamesThatStartWithW.Add("William");
MaleNamesThatStartWithX = new List<string>();
MaleNamesThatStartWithX.Add("Xaviar");
MaleNamesThatStartWithX.Add("Xumeo");
MaleNamesThatStartWithY = new List<string>();
MaleNamesThatStartWithY.Add("Yolondo");
MaleNamesThatStartWithY.Add("Yuvio");
MaleNamesThatStartWithZ = new List<string>();
MaleNamesThatStartWithZ.Add("Zether");
MaleNamesThatStartWithZ.Add("Zeypher");
FemaleNamesThatStartWithA = new List<string>();
FemaleNamesThatStartWithA.Add("Alice");
FemaleNamesThatStartWithA.Add("Amber");
FemaleNamesThatStartWithB = new List<string>();
FemaleNamesThatStartWithB.Add("Bernadette");
FemaleNamesThatStartWithB.Add("Betsy");
FemaleNamesThatStartWithC = new List<string>();
FemaleNamesThatStartWithC.Add("Catherine");
FemaleNamesThatStartWithC.Add("Cathy");
FemaleNamesThatStartWithD = new List<string>();
FemaleNamesThatStartWithD.Add("Dania");
FemaleNamesThatStartWithD.Add("Day");
FemaleNamesThatStartWithE = new List<string>();
FemaleNamesThatStartWithE.Add("Esther");
FemaleNamesThatStartWithE.Add("Etssy");
FemaleNamesThatStartWithF = new List<string>();
FemaleNamesThatStartWithF.Add("Faria");
FemaleNamesThatStartWithF.Add("Floria");
FemaleNamesThatStartWithG = new List<string>();
FemaleNamesThatStartWithG.Add("Grace");
FemaleNamesThatStartWithG.Add("Gracie");
FemaleNamesThatStartWithH = new List<string>();
FemaleNamesThatStartWithH.Add("Hello");
FemaleNamesThatStartWithH.Add("Happy");
FemaleNamesThatStartWithI = new List<string>();
FemaleNamesThatStartWithI.Add("Isuvia");
FemaleNamesThatStartWithI.Add("Isabella");
FemaleNamesThatStartWithJ = new List<string>();
FemaleNamesThatStartWithJ.Add("Joy");
FemaleNamesThatStartWithJ.Add("Joyce");
FemaleNamesThatStartWithK = new List<string>();
FemaleNamesThatStartWithK.Add("Kate");
FemaleNamesThatStartWithK.Add("Kathy");
FemaleNamesThatStartWithL = new List<string>();
FemaleNamesThatStartWithL.Add("Lucy");
FemaleNamesThatStartWithL.Add("Lin");
FemaleNamesThatStartWithM = new List<string>();
FemaleNamesThatStartWithM.Add("Maria");
FemaleNamesThatStartWithM.Add("Margot");
FemaleNamesThatStartWithN = new List<string>();
FemaleNamesThatStartWithN.Add("Nuvia");
FemaleNamesThatStartWithN.Add("Nancy");
FemaleNamesThatStartWithO = new List<string>();
FemaleNamesThatStartWithO.Add("Osakia");
FemaleNamesThatStartWithO.Add("Osaku");
FemaleNamesThatStartWithP = new List<string>();
FemaleNamesThatStartWithP.Add("Patty");
FemaleNamesThatStartWithP.Add("Patricia");
FemaleNamesThatStartWithQ = new List<string>();
FemaleNamesThatStartWithQ.Add("Quava");
FemaleNamesThatStartWithQ.Add("Quisha");
FemaleNamesThatStartWithR = new List<string>();
FemaleNamesThatStartWithR.Add("Rita");
FemaleNamesThatStartWithR.Add("Riri");
FemaleNamesThatStartWithS = new List<string>();
FemaleNamesThatStartWithS.Add("Suzy");
FemaleNamesThatStartWithS.Add("Susan");
FemaleNamesThatStartWithT = new List<string>();
FemaleNamesThatStartWithT.Add("Tanya");
FemaleNamesThatStartWithT.Add("TIffany");
FemaleNamesThatStartWithU = new List<string>();
FemaleNamesThatStartWithU.Add("Uvia");
FemaleNamesThatStartWithU.Add("Urania");
FemaleNamesThatStartWithV = new List<string>();
FemaleNamesThatStartWithV.Add("Vanessa");
FemaleNamesThatStartWithV.Add("Vania");
FemaleNamesThatStartWithW = new List<string>();
FemaleNamesThatStartWithW.Add("Wendy");
FemaleNamesThatStartWithW.Add("War");
FemaleNamesThatStartWithX = new List<string>();
FemaleNamesThatStartWithX.Add("Xuvia");
FemaleNamesThatStartWithX.Add("Xuia");
FemaleNamesThatStartWithY = new List<string>();
FemaleNamesThatStartWithY.Add("Yolonda");
FemaleNamesThatStartWithY.Add("Yosi");
FemaleNamesThatStartWithZ = new List<string>();
FemaleNamesThatStartWithZ.Add("Zania");
FemaleNamesThatStartWithZ.Add("Zuvia");
item1 = new ListBoxItem();
item1.Content = "German";
ListBoxItem item2 = new ListBoxItem();
item2.Content = "American";
listBox1.Items.Add(item1);
listBox1.Items.Add(item2);
ListBoxItem sign1 = new ListBoxItem();
sign1.Content = "Cancer";
ListBoxItem sign2 = new ListBoxItem();
sign2.Content = "Gemini";
listBox2.Items.Add(sign1);
listBox2.Items.Add(sign2);
ListBoxItem bday1 = new ListBoxItem();
bday1.Content = "1900";
ListBoxItem bday2 = new ListBoxItem();
bday2.Content = "1901";
listBox3.Items.Add(bday1);
listBox3.Items.Add(bday2);
}
private string ShuffleNames(List<string> name)
{
Random random = new Random();
string tmp = "";
int length = name.Count;
for (int i = 0; i < length; i++)
{
int r = (int)(random.NextDouble() * (length - i));
tmp = name[r];
name[r] = name[i];
name[i] = tmp;
}
return tmp;
}
private void Submit(object sender, RoutedEventArgs e)
{
try{
if (radioButton1.IsChecked != null && radioButton2.IsChecked != null && listBox3.SelectedItem.ToString() != null && listBox2.SelectedItem.ToString() != null && listBox1.SelectedItem.ToString() != null)
{
if (radioButton1.IsChecked == true && textBox1.Text == "A" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithA);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "A" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithA);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "B" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithB);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "B" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithB);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "C" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithC);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "C" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithC);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "D" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithD);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "D" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithD);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "E" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithE);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "E" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithE);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "F" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithF);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "F" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithF);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "G" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithG);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "G" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithG);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "H" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithH);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "H" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithH);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "J" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithJ);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "J" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithJ);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "K" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithK);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "K" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithK);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "L" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithL);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "L" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithL);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "M" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithM);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "M" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithM);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "N" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithN);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "N" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithN);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "O" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithO);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "O" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithO);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "P" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithP);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "P" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithP);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "Q" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithQ);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "Q" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithQ);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "R" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithR);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "R" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithR);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "S" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithS);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "S" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithS);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "T" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithT);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "T" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithT);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "U" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithU);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "U" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithU);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "V" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithV);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "V" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithV);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "W" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithW);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "W" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithW);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "X" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithX);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "X" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithX);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "Y" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithY);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "Y" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithY);
}
else if (radioButton1.IsChecked == true && textBox1.Text == "Z" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(MaleNamesThatStartWithZ);
}
else if (radioButton2.IsChecked == true && textBox1.Text == "Z" && listBox3.SelectedItem.ToString() == listBox3.SelectedValue.ToString() && listBox2.SelectedItem.ToString() == listBox2.SelectedValue.ToString() && listBox1.SelectedItem.ToString() == listBox1.SelectedValue.ToString())
{
label3.Content = ShuffleNames(FemaleNamesThatStartWithZ);
}
else
{
label3.Content = "Fill in form";
}
}
} catch(NullReferenceException nre){
MessageBox.Show("Please fill in form");
Console.WriteLine(nre.GetBaseException());
}
}
}
}