Exemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Initialisation du jedi view Model
            JediViewModel jvm = new JediViewModel(_source);

            jediController.DataContext = jvm;
        }
Exemplo n.º 2
0
        public IActionResult GetByGrade(string grade)
        {
            var jediViewModel = new JediViewModel
            {
                Jedis = jediApp.GetByGrade(grade)
            };

            return(PartialView("_Jedis", jediViewModel));
        }
Exemplo n.º 3
0
        public PartialViewResult GetAll()
        {
            var jediViewModel = new JediViewModel
            {
                Jedis = jediApp.GetAll()
            };

            return(PartialView("_Jedis", jediViewModel));
        }
Exemplo n.º 4
0
        public IActionResult Index()
        {
            var jediViewModel = new JediViewModel
            {
                Jedis = jediApp.GetAll()
            };

            return(View(jediViewModel));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Give the winner of the "battle"
        /// </summary>
        private void getWinner(Key player1, Key player2)
        {
            switch (player1)
            {
            case (Key.Q):
                if (player2 == Key.L)
                {
                    m_winner = m_joueur2;
                }
                else if (player2 == Key.M)
                {
                    m_winner = m_joueur1;
                }
                break;

            case (Key.S):
                if (player2 == Key.M)
                {
                    m_winner = m_joueur2;
                }
                else if (player2 == Key.K)
                {
                    m_winner = m_joueur1;
                }
                break;

            case (Key.D):
                if (player2 == Key.K)
                {
                    m_winner = m_joueur2;
                }
                else if (player2 == Key.L)
                {
                    m_winner = m_joueur1;
                }
                break;
            }

            if (m_winner == null)                        // Egalité
            {
                egalite.Visibility           = Visibility.Visible;
                winner.Visibility            = Visibility.Hidden;
                egalite.MouseLeftButtonDown += launchAgain;
            }
            else                                        // A winner is defined
            {
                JediViewModel       jvm       = new JediViewModel(m_winner);
                JediReadUserControl winner_uc = new JediReadUserControl(jvm);

                resultsGrid.Children.Add(winner_uc);
                winner.Visibility = Visibility.Visible;
                winner.Text       = m_winner.Nom + " gagne !";
                winner_uc.SetValue(Grid.ColumnProperty, 3);
                winner_uc.SetValue(Grid.RowProperty, 3);
                winner_uc.Margin = new Thickness(10);

                m_timer.Interval = new TimeSpan(0, 0, 3);
                m_timer.Tick    -= new EventHandler(doGame);
                m_timer.Tick    += new EventHandler(endingGame);
                m_timer.Start();

                // TODO : update match and tournament table
                // TODO : go to the next match
            }
        }
Exemplo n.º 6
0
 public JediReadUserControl(JediViewModel jvm)
 {
     InitializeComponent();
     DataContext = jvm;
 }