Operation() public method

public Operation ( ) : void
return void
Example #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();
        }
Example #2
0
        static void Main(string[] args)
        {
            Abstraction ab = new RefinedAbstraction();

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

            ab.Implementor = new ConcreteImplementorSecond();
            ab.Operation();
        }
        static void Main(string[] args)
        {
            Abstraction ab = new RefinedAbstraction();

            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();
            ab.Implementor = new ConcreteImplementorB();
            ab.Operation();
            Console.ReadKey();
        }
Example #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();
        }
Example #6
0
        private static void Main()
        {
            var abstraction = new RefinedAbstraction {
                Implementor = new ConcreteImplementorA()
            };

            abstraction.Operation();

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

            Console.ReadKey();
        }
Example #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();
        }
Example #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();
        }
Example #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();
        }
Example #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();
        }
Example #11
0
        private void Start( )
        {
            Abstraction ab = new RefinedAbstraction();

            ab.Implementor = new ConcreteImplementorA();
            ab.Operation();
        }
        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
             */
        }
Example #13
0
        static void Main(string[] args)
        {
            Abstraction ra = new RefinedAbstraction();

            ra.Operation();

            Console.ReadKey();
        }
Example #14
0
        static void Main()
        {
            Abstraction abstraction = new RefinedAbstraction
                                          {
                                              Implementor = new ConcreteImplementorA()
                                          };

            abstraction.Operation();
        }
Example #15
0
        static void Main()
        {
            var abstraction = new RefinedAbstraction(new ImplementorA());

            abstraction.Operation();

            abstraction = new RefinedAbstraction(new ImplementorB());
            abstraction.Operation();
        }
Example #16
0
        static void Main()
        {
            Abstraction abstraction = new RefinedAbstraction
            {
                Implementor = new ConcreteImplementorA()
            };

            abstraction.Operation();
        }
Example #17
0
        static void Main(string[] args)
        {
            Abstraction abstraction;

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

            abstraction = new RefinedAbstraction(new ConcreteImp2());
            abstraction.Operation();
        }
Example #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();
        }
Example #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();
        }
Example #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();
        }