예제 #1
0
        static void Main(string[] args)
        {
            var textView        = new TextView();
            var scrollDecorator = new ScrollDecorator(textView);

            scrollDecorator.Draw();
            scrollDecorator.ScrollTo();
        }
예제 #2
0
        static void Main(string[] args)
        {
            IVisualComponent textView    = new TextView();
            IVisualComponent borderCompt = new BorderDecorator(textView);
            IVisualComponent scrollCompt = new ScrollDecorator(borderCompt);

            scrollCompt.Draw();
        }
예제 #3
0
        static void Main(string[] args)
        {
            TextField       tf = new TextField(3, 2);
            BorderDecorator bd = new BorderDecorator(tf);
            ScrollDecorator sd = new ScrollDecorator(bd);
            ColorDecorator  cd = new ColorDecorator(sd);

            Console.ReadKey();
        }
예제 #4
0
        static void Main(string[] args)
        {
            VisualComponent view = new TextView();
            //用边框装饰界面
            Decorator border = new BorderDecorator(view);
            //用滚动条装饰界面
            Decorator scroll = new ScrollDecorator(border);

            //滚动时
            scroll.Draw();
            Console.ReadLine();
        }
예제 #5
0
        static void Main(string[] args)
        {
            // Concrete Components
            var window1 = new LoginWindow("Login to System");
            var window2 = new ReportWindow("Stock Report Screen");
            var window3 = new ReportWindow("Sales Report Screen");

            // Concrete Decorators
            var decorator1 = new ScrollDecorator(window2, "Stock Report Screen");
            var decorator2 = new ThemeDecorator(window1, "Login to System");
            var decorator3 = new ThemeDecorator(window3, "Sales Report Screen");
            var decorator4 = new ThemeDecorator(window2, "Stock Report Screen");

            decorator1.ScrollBy(7);
            decorator2.SetTheme("sky");
            decorator3.SetTheme("autumn");
            decorator4.SetTheme("sea");

            Console.ReadKey();
        }
예제 #6
0
        public static void ExecuteScript()
        {
            Console.WriteLine(new string('_', 100));
            Console.WriteLine("DECORATOR\n\n");

            IVisualComponent visualComponent = new TextView();

            visualComponent.Draw();
            Console.WriteLine("\n\n\n");

            visualComponent = new BorderDecorator(visualComponent, 16);

            visualComponent.Draw();
            Console.WriteLine("\n\n\n");

            visualComponent = new ScrollDecorator(visualComponent, 10);

            visualComponent.Draw();
            Console.WriteLine("\n\n\n");
        }