private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            List <string>      Queries = new List <string>();
            GroupedListDisplay groupedlistDisplay;

            // for each of the following queries there should be a case in the switch below
            Queries.Add("Nannies grouped according to the minimal acceptable age of their children");
            Queries.Add("Nannies grouped according to the maximal acceptable age of their children");
            Queries.Add("Contracts grouped by the distance between the nanny and her location");
            // note that the constructor below has a quite long parameter
            ChoicePromptWin choicePromptWin = new ChoicePromptWin(Queries, "Which group are you looking for?", (s) =>
            {
                switch ((string)s)
                // a case for each of the queries above
                {
                case "Nannies grouped according to the minimal acceptable age of their children":
                    groupedlistDisplay = new GroupedListDisplay((string)s, "Go to selected Nanny's window", bl.NannyByMinimalAge(true));
                    groupedlistDisplay.ShowDialog();
                    break;

                case "Nannies grouped according to the maximal acceptable age of their children":
                    groupedlistDisplay = new GroupedListDisplay((string)s, "Go to selected Nanny's window", bl.NannyByMinimalAge(false));
                    groupedlistDisplay.ShowDialog();
                    break;

                case "Contracts grouped by the distance between the nanny and her location":
                    new Thread(() =>
                    {
                        try
                        {
                            List <IGrouping <int, Contract> > ListToDisplay = bl.ContractsByDistance(true);
                            Dispatcher.Invoke(() =>
                            {
                                groupedlistDisplay = new GroupedListDisplay((string)s, "Go to selected Contract's window", ListToDisplay);
                                groupedlistDisplay.ShowDialog();
                            });
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("An error has occured when measuring the distances for the contracts, try again, and check your internet connection if the problem persists or ensure that the addresses are written flawlessly.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }).Start();
                    break;
                }
            });

            choicePromptWin.ShowDialog();
            ///////////////////////////////////////////////////////////////////////// OLD***********************OLD
            //string param= "";
            //if (MotherLST.SelectedItem != null)
            //    param = MotherLST.SelectedItem.ToString();
            //else
            //{
            //    MessageBox.Show("To test this function, please select a mother first");
            //    return;
            //}
            //Thread t = new Thread(forThread1);
            //t.Start(param);
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            List <string> Queries = new List <string>();

            // for each of the following queries there should be a case in the switch below
            Queries.Add("Children who don't have a single contract");
            Queries.Add("Nannies who get their vacation from the minister of economy");
            Queries.Add("Contracts in which the children met the nanny");
            Queries.Add("Contracts that are signed");
            Queries.Add("Mothers for which there is no nanny that can fit 100% with their schedule");
            ListDisplay listDisplay;
            // note that the constructor below has a quite long parameter
            ChoicePromptWin choicePromptWin = new ChoicePromptWin(Queries, "What do you wish to find?", (s) =>
            {
                switch ((string)s)
                { // a case for each of the queries above
                case "Children who don't have a single contract":
                    listDisplay = new ListDisplay((string)s, "Go to selected child's window", bl.UnattendedChildren());
                    listDisplay.ShowDialog();
                    break;

                case "Nannies who get their vacation from the minister of economy":
                    listDisplay = new ListDisplay((string)s, "Go to selected nanny's window", bl.VacationByEconomy());
                    listDisplay.ShowDialog();
                    break;

                case "Contracts in which the children met the nanny":
                    listDisplay = new ListDisplay((string)s, "Go to selected contract's window", bl.ContractsByCondition(c => c.IsMet));
                    listDisplay.ShowDialog();
                    break;

                case "Contracts that are signed":
                    listDisplay = new ListDisplay((string)s, "Go to selected contract's window", bl.ContractsByCondition(c => c.IsSigned));
                    listDisplay.ShowDialog();
                    break;

                case "Mothers for which there is no nanny that can fit 100% with their schedule":
                    listDisplay = new ListDisplay((string)s, "Go to selected mother's window", from Mother m in bl.GetMothers() where bl.SuitableNannies(m).Count() == 0 select m);
                    listDisplay.ShowDialog();
                    break;
                }
            }); // This is the end of the constructor above

            choicePromptWin.ShowDialog();
            ///////////////////////////////////////////////////////////////////////// OLD***********************OLD
            //string ret = "Nannies with vaction from the minister of economy:\n";
            //foreach (Nanny n in bl.VacationByEconomy())
            //    ret += bl.ToShortString(n) + "\n";
            //ret += "**************\nUnattended Children:\n";
            //foreach (Child c in bl.UnattendedChildren())
            //    ret += bl.ToShortString(c) +"\n";
            //ret += "***************\nContracts where children met the nanny:\n";
            //foreach (Contract c in bl.ContractsByCondition(c => c.IsMet))
            //    ret += bl.ToShortString(c) + "\n";
            //ret += "***************\nNumber of signed contracts:" + bl.NumOfContractsByCondition(c => c.IsSigned);
            //MessageBox.Show(ret);
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //TextBox temp = new TextBox();
            try
            {
                ChoicePromptWin choicePromptWin = new ChoicePromptWin(bl.ContractsByCondition(c => !c.IsSigned), "Choose contract to sign", c => { bl.SignContract((Contract)c); MessageBox.Show("successfully signed"); });

                choicePromptWin.ShowDialog();
                //Contract c = bl.FindContractBySerialNum(temp.Text);
                //if (c == null)
                //{
                //    MessageBox.Show("Contract not found!", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                //    return;
                //}
                //bl.SignContract(c);
            }
            catch (Exception excep)
            {
                MessageBox.Show("ERROR: " + excep.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }