Operation() публичный Метод

public Operation ( ) : void
Результат void
Пример #1
0
        static void Main(string[] args)
        {
            //桥接模式
            Abstraction straction = new RefinedAbstraction();

            straction.SetImplementor(new ConcreteImplementorA());
            straction.Operation();

            straction.SetImplementor(new ConcreteImplementorB());
            straction.Operation();

            Console.WriteLine("----------------------------------------");

            HandsetBrand hb;

            hb = new HandsetBrandN();
            hb.SetHandsetSoft(new Handsetgame());
            hb.Run();
            hb.SetHandsetSoft(new HandsetAddressList());
            hb.Run();


            hb = new HandsetBrandM();
            hb.SetHandsetSoft(new Handsetgame());
            hb.Run();
            hb.SetHandsetSoft(new HandsetAddressList());
            hb.Run();

            Console.Read();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Abstraction ab = new RefinedAbstraction();

            ab.Implementor = new ConcreteImplementorFirst();
            ab.Operation();

            ab.Implementor = new ConcreteImplementorSecond();
            ab.Operation();
        }
Пример #3
0
        static void Main(string[] args)
        {
            Abstraction ab = new RefinedAbstraction();

            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();
            Console.ReadKey();
        }
Пример #4
0
        static void Main()
        {
            Abstraction ab = new RefinedAbstraction();

            // Set implementation and call
            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();

            // Change implemention and call
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();
        }
        static void Main(string[] args)
        {
            Abstraction abstraction = new RefinedAbstraction();

            abstraction.Implementor = new ConcreteImplementorA();
            abstraction.Operation();

            abstraction.Implementor = new ConcreteImplementorB();
            abstraction.Operation();

            Console.Read();
        }
Пример #6
0
        private static void Main()
        {
            var abstraction = new RefinedAbstraction {
                Implementor = new ConcreteImplementorA()
            };

            abstraction.Operation();

            abstraction.Implementor = new ConcreteImplementorB();
            abstraction.Operation();

            Console.ReadKey();
        }
Пример #7
0
        static void Main(string[] args)
        {
            Abstraction ab = new RefinedAbstraction();

            // Set implementation and call
            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();
            // Change implemention and call
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();
            // Wait for user
            Console.ReadKey();
        }
Пример #8
0
        /// <summary>
        /// The test bridge.
        /// </summary>
        private static void TestBridge()
        {
            Abstraction ab = new RefinedAbstraction();

            // Set implementation and call
            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();

            // Change implemention and call
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();

            // Wait for user
            Console.ReadKey();
        }
Пример #9
0
        static void Main()
        {
            Abstraction ab = new RefinedAbstraction();

            // Set implementation and call
            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();

            // Change implementation and call
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();

            // Wait for user
            Console.Read();
        }
Пример #10
0
        static void Main(string[] args)
        {
            Abstraction library = new RefinedAbstraction();

            library.Implementor = new ConcreteImplementorCPU();
            library.Operation();

            library.Implementor = new ConcreteImplementorVideoCard();
            library.Operation();

            library.Implementor = new ConcreteImplementorHardDisc();
            library.Operation();

            Console.Read();
        }
Пример #11
0
        private void Start( )
        {
            Abstraction ab = new RefinedAbstraction();

            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();
        }
Пример #12
0
        public static void Run()
        {
            Console.WriteLine("This structural code demonstrates the Bridge pattern which separates (decouples) the interface from its implementation. The implementation can evolve without changing clients which use the abstraction of the object.");
            Abstraction ab = new RefinedAbstraction();

            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();

            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();

            /*
             * ConcreteImplementorA Operation
             * ConcreteImplementorB Operation
             */
        }
Пример #13
0
        static void Main(string[] args)
        {
            Abstraction ra = new RefinedAbstraction();

            ra.Operation();

            Console.ReadKey();
        }
Пример #14
0
        static void Main()
        {
            Abstraction abstraction = new RefinedAbstraction
                                          {
                                              Implementor = new ConcreteImplementorA()
                                          };

            abstraction.Operation();
        }
Пример #15
0
        static void Main()
        {
            var abstraction = new RefinedAbstraction(new ImplementorA());

            abstraction.Operation();

            abstraction = new RefinedAbstraction(new ImplementorB());
            abstraction.Operation();
        }
Пример #16
0
        static void Main()
        {
            Abstraction abstraction = new RefinedAbstraction
            {
                Implementor = new ConcreteImplementorA()
            };

            abstraction.Operation();
        }
Пример #17
0
        static void Main(string[] args)
        {
            Abstraction abstraction;

            abstraction = new RefinedAbstraction(new ConcreteImp1());
            abstraction.Operation();

            abstraction = new RefinedAbstraction(new ConcreteImp2());
            abstraction.Operation();
        }
Пример #18
0
        private static void Main(string[] args)
        {
            // live example
            Window window = new XWindow();

            window.Draw();

            window = new IosWindow();
            window.Draw();

            Console.WriteLine();

            // canonical example
            var abstraction = new RefinedAbstraction();

            abstraction.Implementor = new ConcreateImplementorA();
            abstraction.Operation();

            abstraction.Implementor = new ConcreateImplementorB();
            abstraction.Operation();
        }
Пример #19
0
        static void Main()
        {
            Implementor implementor;
            Abstraction abstraction;

            implementor = new ConcreteImplementorA();
            abstraction = new RefinedAbstraction(implementor);
            abstraction.Operation();

            implementor = new ConcreteImplementorB();
            abstraction = new RefinedAbstraction(implementor);
            abstraction.Operation();
        }
Пример #20
0
        static void Main(string[] args)
        {
            #region 结构实现
            Abstraction abstraction = new RefinedAbstraction();

            abstraction.Implementor = new ConcreteImplementorA();
            abstraction.Operation();

            abstraction.Implementor = new ConcreteImplementorB();
            abstraction.Operation();
            #endregion

            Console.WriteLine("******************************");

            #region 实践应用
            MakeCoffeeSingleton whiteCoffeeSingleton = new MakeCoffeeSingleton(new WhiteCoffee());

            // 中杯牛奶咖啡
            MediumCupCoffee mediumWhiteCoffee = new MediumCupCoffee();
            mediumWhiteCoffee.Make();

            // 大杯牛奶咖啡
            LargeCupCoffee largeCupWhiteCoffee = new LargeCupCoffee();
            largeCupWhiteCoffee.Make();

            MakeCoffeeSingleton blackCoffeeSingleton = new MakeCoffeeSingleton(new BlackCoffee());
            // 中杯原味咖啡
            MediumCupCoffee mediumBlackCoffee = new MediumCupCoffee();
            mediumBlackCoffee.Make();

            // 大杯牛奶咖啡
            LargeCupCoffee largeCupBlackCoffee = new LargeCupCoffee();
            largeCupBlackCoffee.Make();
            #endregion

            Console.ReadKey();
        }