Beispiel #1
0
        /// <summary>
        /// Event Handler for new profile shots being generated
        /// </summary>
        /// <param name="source"></param>
        /// <param name="eventArgs"></param>
        public void OnProfilesGenerated(Object source, ProfilesEventArgs eventArgs)
        {
            ProfileShots   = eventArgs.ProfileShots;
            CorrectProfile = eventArgs.CorrectProfile;
            txtWhois.Text  = "Who is " + eventArgs.CorrectProfile.FullName + "?";

            // Bindings.Update often gives an error message before compiling, but should be OK
            Bindings.Update();
        }
Beispiel #2
0
        /// <summary>
        /// Tapping an Image event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Panel_Tapped(object sender, TappedRoutedEventArgs e)
        {
            StackPanel  panel = sender as StackPanel;
            ProfileShot shot  = panel.DataContext as ProfileShot;

            panel.Background = new SolidColorBrush(shot.FullName.Equals(CorrectProfile.FullName) ?
                                                   Colors.LightGreen : Colors.LightCoral);
            shot.TextVisible = Visibility.Visible;
        }
Beispiel #3
0
        /// <summary>
        /// Generate five new profileShots (and a correct profile) to play a new game
        /// </summary>
        public void Play()
        {
            profileShots.Clear();
            while (profileShots.Count < selectionSize)
            {
                int r = rnd.Next(profileList.Count);
                profileShots.Add(new ProfileShot(profileList[r].FullName, profileList[r].Headshot.Url));
            }
            int rand = rnd.Next(selectionSize);

            correctProfile = profileShots[rand];

            OnProfilesGenerated();
        }