Example #1
0
        private void loopOverFormsButton_Click(object sender, EventArgs e)
        {
            WODAApplicationForm waf = new WODAApplicationForm();
            WODAMatchesForm     wmf = new WODAMatchesForm();

            waf.Show();
            wmf.Show();

            foreach (Form f in Application.OpenForms)
            {
                f.BackColor = Color.Plum;

                foreach (Control c in f.Controls)
                {
                    c.BackColor = Color.Red;

                    if (c is GroupBox)
                    {
                        foreach (Control d in c.Controls)
                        {
                            d.BackColor = Color.Blue;
                        }
                    }
                }
            }
        }
Example #2
0
        private void openCloseFormsButton_Click(object sender, EventArgs e)
        {
            WODAApplicationForm waf = new WODAApplicationForm();
            WODAMatchesForm     wmf = new WODAMatchesForm();

            waf.Show();
            wmf.Show();

            for (int i = Application.OpenForms.Count - 1; i > 0; i--)
            {
                Application.OpenForms[i].Close();
            }
        }
Example #3
0
        private void showMatches()
        {
            WODAMatchesForm matchesForm = new WODAMatchesForm();

            using (StreamReader clientsFile = new StreamReader(@"C:\Users\Andrew.Gould\Desktop\WODAClients.txt"))
            {
                clientsFile.ReadLine();

                while (!clientsFile.EndOfStream)
                {
                    string eachClient = clientsFile.ReadLine();

                    string[] clientDetails = eachClient.Split('\t');

                    string   clientGender        = clientDetails[3];
                    string   clientPartnerGender = clientDetails[4];
                    DateTime clientDOB           = Convert.ToDateTime(clientDetails[2]);
                    int      clientAge           = calculateAge(clientDOB);
                    int      yourAge             = calculateAge(dateOfBirthPicker.Value);
                    int      clientMinimumAge    = Convert.ToInt32(clientDetails[5]);
                    int      clientMaximumAge    = Convert.ToInt32(clientDetails[6]);

                    if (clientGender == theirGenderList.Text && clientPartnerGender == yourGenderList.Text)
                    {
                        if (clientAge >= minimumAgeSpinner.Value && clientAge <= maximumAgeSpinner.Value)
                        {
                            if (yourAge >= clientMinimumAge && yourAge <= clientMaximumAge)
                            {
                                matchesForm.YourMatchesList.Items.Add(
                                    clientDetails[0] + " " + clientDetails[1] + "\t" + clientAge);
                            }
                        }
                    }
                }
            }

            matchesForm.Show();
        }