Пример #1
0
        // Анимация сетки окна
        private void GridMainAnimation(double point, Grid[] grids)
        {
            ThicknessAnimation animation = new ThicknessAnimation                                                                     // Новая анимация
            {
                From       = new Thickness(GridMain.Margin.Left, GridMain.Margin.Top, GridMain.Margin.Right, GridMain.Margin.Bottom), // Стартовая позиция
                To         = new Thickness(point, GridMain.Margin.Top, GridMain.Margin.Right, GridMain.Margin.Bottom),                // Конечная позиция
                Duration   = TimeSpan.FromSeconds(1),                                                                                 // Время
                SpeedRatio = 7                                                                                                        // Скорость
            };

            animation.Completed += (s, a) => GridsVisibility(grids);

            GridMain.BeginAnimation(MarginProperty, animation); // Запуск
        }
Пример #2
0
        private void GridMainAnimation(double point, bool completed = false)
        {
            ThicknessAnimation animation = new ThicknessAnimation                                                                     // Новая анимация
            {
                From       = new Thickness(GridMain.Margin.Left, GridMain.Margin.Top, GridMain.Margin.Right, GridMain.Margin.Bottom), // Стартовая позиция
                To         = new Thickness(point, GridMain.Margin.Top, GridMain.Margin.Right, GridMain.Margin.Bottom),                // Конечная позиция
                Duration   = TimeSpan.FromSeconds(1),                                                                                 // Время
                SpeedRatio = 4,                                                                                                       // Скорость
            };

            if (completed)
            {
                animation.Completed += Animation_Completed;
            }

            GridMain.BeginAnimation(MarginProperty, animation); // Запуск
        }
Пример #3
0
        private void AutoGenerateGridsPosition()
        {
            Grid[] Grids = { GridName, GridSubname, GridPatronymic, GridDateBirth, GridLocation, GridGroupNameOrPlaceWork, GridPhone, GridGender, GridAdditional };

            int       count     = 0;
            Thickness thickness = new Thickness();

            for (int i = 0; i < Grids.Length; i++)
            {
                if (Grids[i].Visibility == Visibility.Visible)
                {
                    switch (count)
                    {
                    case 0:
                        thickness = new Thickness(10, 10, 0, 0);
                        break;

                    case 1:
                        thickness = new Thickness(10, 40, 0, 0);
                        break;

                    case 2:
                        thickness = new Thickness(10, 70, 0, 0);
                        break;

                    case 3:
                        thickness = new Thickness(10, 100, 0, 0);
                        break;

                    case 4:
                        thickness = new Thickness(10, 130, 0, 0);
                        break;

                    case 5:
                        thickness = new Thickness(10, 160, 0, 0);
                        break;

                    case 6:
                        thickness = new Thickness(10, 190, 0, 0);
                        break;

                    case 7:
                        thickness = new Thickness(10, 220, 0, 0);
                        break;

                    case 8:
                        thickness = new Thickness(10, 250, 0, 0);
                        break;
                    }

                    ThicknessAnimation animation = new ThicknessAnimation                                                                     // Новая анимация
                    {
                        From       = new Thickness(Grids[i].Margin.Left, Grids[i].Margin.Top, Grids[i].Margin.Right, Grids[i].Margin.Bottom), // Стартовая позиция
                        To         = thickness,                                                                                               // Конечная позиция
                        Duration   = TimeSpan.FromSeconds(1),                                                                                 // Время
                        SpeedRatio = 6,                                                                                                       // Скорость
                    };

                    Grids[i].BeginAnimation(MarginProperty, animation); // Запуск
                    count++;
                }
            }
        }