Exemple #1
0
    public Team(string name)
    {
        Name           = name;
        Time           = TotalTime;
        Timer.Elapsed += TimerElapsed;
        Timer.Start();
        totalScore = 1500;

        //Start scoreboard
        if (WindowManager.IsWindowOpen("scoreboard"))
        {
            var scoreboardWindow = (RoomScoreboard)WindowManager.GetWindow("scoreboard");
            scoreboardWindow.Reset(this);
            //Timer.Elapsed += scoreboardWindow.Tick;
            Timer.Elapsed += scoreboardWindow.Tick;
        }
        else
        {
            System.Windows.Application.Current.Dispatcher.Invoke(() =>
            {
                var scoreboardWindow = new RoomScoreboard(this);
                scoreboardWindow.Show();
                WindowManager.SetWindowOpenState("scoreboard", true, scoreboardWindow);
                scoreboardWindow.Reset(this);
                //Timer.Elapsed += scoreboardWindow.Tick;
                Timer.Elapsed += scoreboardWindow.Tick;
            });
        }

        RoomScoreboard.IsSet = true;
    }
        private void OnRoomScoreboard(object sender, RoutedEventArgs e)
        {
            if (WindowManager.IsWindowOpen("scoreboard"))
            {
                MessageBox.Show("Room Scoreboard is already open");
                return;
            }

            var newScoreboard = new RoomScoreboard(null);

            WindowManager.SetWindowOpenState("scoreboard", true, newScoreboard);
            newScoreboard.Show();
        }