예제 #1
0
        private void Expander_Expanded(object sender, RoutedEventArgs e)
        {
            ThicknessAnimation borderSettingAnimation = new ThicknessAnimation();

            Thickness wide = new Thickness(0, 0, 0, 0);

            borderSettingAnimation.From = SettingsBorder.Margin;
            borderSettingAnimation.To   = wide;

            borderSettingAnimation.Duration          = TimeSpan.FromSeconds(0.15);
            borderSettingAnimation.DecelerationRatio = 0.5;



            SettingsBorder.BeginAnimation(Border.MarginProperty, borderSettingAnimation);
            if (ChatGrid != null)
            {
                DoubleAnimation borderChatAnimation = new DoubleAnimation();
                double          thin = 0;
                borderChatAnimation.From = ChatGrid.Width;
                borderChatAnimation.To   = thin;

                borderChatAnimation.Duration          = TimeSpan.FromSeconds(0.15);
                borderChatAnimation.DecelerationRatio = 0.5;

                ChatGrid.BeginAnimation(WidthProperty, borderChatAnimation);
            }
        }
예제 #2
0
        private void Expander_Collapsed(object sender, RoutedEventArgs e)
        {
            ThicknessAnimation borderSettingAnimation = new ThicknessAnimation();
            Thickness          thin = new Thickness(685, 0, 0, 0);

            borderSettingAnimation.From = SettingsBorder.Margin;
            borderSettingAnimation.To   = thin;

            borderSettingAnimation.Duration          = TimeSpan.FromSeconds(0.3);
            borderSettingAnimation.AccelerationRatio = 0.5;

            SettingsBorder.BeginAnimation(Border.MarginProperty, borderSettingAnimation);
            DoubleAnimation borderChatAnimation = new DoubleAnimation();

            double wide = 680;

            borderChatAnimation.From = ChatGrid.Width;
            borderChatAnimation.To   = wide;

            borderChatAnimation.Duration          = TimeSpan.FromSeconds(0.30);
            borderChatAnimation.AccelerationRatio = 0.5;

            ChatGrid.BeginAnimation(Border.WidthProperty, borderChatAnimation);

            //ChatGrid.Width = 670;
            //680
        }
예제 #3
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;
        }
예제 #4
0
        private void SettingsButton_Click(object sender, RoutedEventArgs e)
        {
            if (SettingsBorder.Height != 0)
            {
                return;
            }

            AddPlayerBtn.Visibility = Visibility.Collapsed;

            DoubleAnimation settingsHeightAnimation = new DoubleAnimation();

            settingsHeightAnimation.From              = 0;
            settingsHeightAnimation.To                = (SystemParameters.PrimaryScreenHeight - 30) / 2;
            settingsHeightAnimation.Duration          = TimeSpan.FromMilliseconds(100);
            settingsHeightAnimation.AccelerationRatio = 0.3;

            ShowBlacker();
            SettingsBorder.BeginAnimation(HeightProperty, settingsHeightAnimation);

            StartButton.Text = "Продолжить";
            FooterGrid.ColumnDefinitions[0].Width = new GridLength(2.1, GridUnitType.Star);
        }