예제 #1
0
    public static void Main(string[] args)
    {
        Display d1 = new StringDisplay("Hello, world.");
        Display d2 = new SideBorder(d1, '#');
        Display d3 = new FullBorder(d2);

        d1.Show();
        d2.Show();
        d3.Show();

        Display d4 = new FullBorder(d3);

        d4.Show();
    }
예제 #2
0
        static void Main(string[] args)
        {
            Display b1 = new StringDisplay("Hello, world.");
            Display b2 = new SideBorder(b1, '#');
            Display b3 = new FullBorder(b2);

            b1.Show();
            b2.Show();
            b3.Show();

            Display b4 = new SideBorder(new FullBorder(new SideBorder(new FullBorder(new StringDisplay("こんにちは。")), '*')), '/');

            b4.Show();
        }
예제 #3
0
        private static void CreateBorder()
        {
            Console.Clear();

            Console.WindowHeight = 20;
            Console.WindowWidth  = 50;
            Console.BufferHeight = Console.WindowTop + Console.WindowHeight;
            Console.BufferWidth  = Console.WindowLeft + Console.WindowWidth;

            var border = new FullBorder(new PointConsole(0, 0),
                                        new PointConsole(Console.WindowWidth - 1, 0),
                                        new PointConsole(1, Console.WindowHeight - 1),
                                        new PointConsole(Console.WindowWidth - 1, Console.WindowHeight - 1));

            _borderPointsList = border.BodrerPoints;
        }
예제 #4
0
 public FullBorderTest()
 {
     _stringDisplay = new StringDisplay("Hello World!");
     _fullBorder    = new FullBorder(_stringDisplay);
 }
예제 #5
0
        private void ToFull()
        {
            _fullTimer.Interval = TimeSpan.FromSeconds(7);
            //анимация отъезда назад
            var widthAnimation = new DoubleAnimation
            {
                To       = _mediaElements[_currentFull].ActualWidth,
                Duration = TimeSpan.FromSeconds(1)
            };
            var heightAnimation = new DoubleAnimation
            {
                To       = _mediaElements[_currentFull].ActualHeight,
                Duration = TimeSpan.FromSeconds(1)
            };

            var marginAnimation = new ThicknessAnimation(_previewPosition, TimeSpan.FromSeconds(1));

            var storyBoard = new Storyboard()
            {
                Children = new TimelineCollection {
                    widthAnimation, heightAnimation, marginAnimation
                }
            };

            FullBorder.VerticalAlignment   = VerticalAlignment.Top;
            FullBorder.HorizontalAlignment = HorizontalAlignment.Left;
            Storyboard.SetTarget(widthAnimation, FullBorder);
            Storyboard.SetTargetProperty(widthAnimation, new PropertyPath(WidthProperty));
            Storyboard.SetTarget(heightAnimation, FullBorder);
            Storyboard.SetTargetProperty(heightAnimation, new PropertyPath(HeightProperty));
            Storyboard.SetTarget(marginAnimation, FullBorder);
            Storyboard.SetTargetProperty(marginAnimation, new PropertyPath(MarginProperty));
            storyBoard.Completed += (s, e) => {
                //задержка перед показом нового ролика 2 сек
                FullBorder.Visibility = Visibility.Collapsed;
                var t = new DispatcherTimer();
                t.Interval = TimeSpan.FromSeconds(2);
                t.Tick    += (tt, t1) =>
                {
                    //выезд нового ролика
                    var p = _mediaElements[_currentFull].TransformToVisual(this).Transform(new Point(0, 0));
                    _previewPosition      = new Thickness(p.X, p.Y, 0, 0);
                    FullBorder.Visibility = Visibility.Visible;
                    var newWidthAnimation = new DoubleAnimation
                    {
                        To       = 400,
                        Duration = TimeSpan.FromSeconds(2)
                    };
                    var newHeightAnimation = new DoubleAnimation
                    {
                        To       = 225,
                        Duration = TimeSpan.FromSeconds(2)
                    };
                    var newMarginAnimation = new ThicknessAnimation(new Thickness(Root.ActualWidth / 2 - 200, Root.ActualHeight / 2 - 112.5, 0, 0), TimeSpan.FromSeconds(2))
                    {
                        From = _previewPosition
                    };
                    Storyboard.SetTarget(newWidthAnimation, FullBorder);
                    Storyboard.SetTargetProperty(newWidthAnimation, new PropertyPath(WidthProperty));
                    Storyboard.SetTarget(newHeightAnimation, FullBorder);
                    Storyboard.SetTargetProperty(newHeightAnimation, new PropertyPath(HeightProperty));
                    Storyboard.SetTarget(newMarginAnimation, FullBorder);
                    Storyboard.SetTargetProperty(newMarginAnimation, new PropertyPath(MarginProperty));
                    var newStory = new Storyboard()
                    {
                        Children = new TimelineCollection {
                            newHeightAnimation, newWidthAnimation, newMarginAnimation
                        }
                    };
                    FullMedia.Source       = _mediaElements[_currentFull].Source;
                    FullBorder.BorderBrush = new SolidColorBrush(Colors.Orange);
                    _currentFull++;
                    if (_currentFull == _currentCountVideos)
                    {
                        _currentFull = 0;
                    }
                    FullBorder.BeginStoryboard(newStory);
                    t.Stop();
                };
                t.Start();
            };
            FullBorder.BeginStoryboard(storyBoard);
        }