Beispiel #1
0
        private void StartButton_MouseUp(object sender, MouseButtonEventArgs e)
        {
            DoubleAnimation settingsHeightAnimation = new DoubleAnimation();

            settingsHeightAnimation.From              = SettingsBorder.ActualHeight;
            settingsHeightAnimation.To                = 0;
            settingsHeightAnimation.Duration          = TimeSpan.FromMilliseconds(100);
            settingsHeightAnimation.AccelerationRatio = 0.3;

            HideBlacker();
            SettingsBorder.BeginAnimation(WidthProperty, settingsHeightAnimation);

            registrationManager.StopManager();

            Thread thread = new Thread(() => {
                foreach (Player p in Players)
                {
                    if (p.ButtonIndex == -1)
                    {
                        dbWorker.DeletePlayer(p.PlayerIndex);
                    }
                    else
                    {
                        dbWorker.AddOrUpdatePlayerInfo(p.PlayerIndex, p.Name, p.Points);
                    }
                }

                foreach (Player p in Players)
                {
                    if (p.ButtonIndex == -1)
                    {
                        Extensions.ExcecuteWithAppIdleDispatcher(() => {
                            Players.Remove(p);
                        });
                    }
                }
            });

            thread.Start();

            if (!isQuizStarted)
            {
                quizManager.StartQuiz();
                isQuizStarted = true;
            }

            this.WindowStyle = WindowStyle.None;
            this.WindowState = WindowState.Maximized;
        }