Exemplo n.º 1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Start.IsEnabled = false;
            games = new List<Game>();
            try
            {
                int browTarget = Convert.ToInt32(Ex1.Text);
                int lipsTarget = Convert.ToInt32(Ex2.Text);
                int mouthTarget = Convert.ToInt32(Ex3.Text);
                int cycles = Convert.ToInt32(cyclesCount.Text);
                if (browTarget < 0 || lipsTarget < 0 || mouthTarget < 0 || cycles < 1)
                    throw new FormatException();
                for (int i = 0; i < cycles; i++)
                {
                    if (browTarget > 0)
                        games.Add(new BrowGame(browTarget));
                    if (lipsTarget > 0)
                        games.Add(new WideLipsGame(lipsTarget));
                    if (mouthTarget > 0)
                        games.Add(new OpenMouthGame(mouthTarget));
                }
                faceWindow = new FaceWindow(games, difficulty, this);

                faceWindow.Show();
            }
            catch (FormatException)
            {
                Start.IsEnabled = true;
                return;
            }
        }
 internal void setMainWindow(FaceWindow window)
 {
     faceWindow = window;
 }