public static void InvokeBridge()
        {
            IAbstractBridge bridge = new AbstractBridge();

            bridge.CallMethod1();
            bridge.CallMethod2();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Bridge1 b1 = new Bridge1();
            Bridge2 b2 = new Bridge2();

            AbstractBridge ab1 = new AbstractBridge(b1);
            AbstractBridge ab2 = new AbstractBridge(b2);
        }
        static void Main(string[] args)
        {
            AbstractBridge bridge = new AbstractBridge(new Bridge1());

            bridge.CallMethod1();
            bridge = new AbstractBridge(new Bridge2());
            bridge.CallMethod1();
            Console.ReadLine();
        }
Beispiel #4
0
        public MainViewModel(AbstractBridge bridge)
        {
            if (bridge == null)
            {
                throw new ArgumentNullException("bridge");
            }


            _dataBridge = bridge;
        }
Beispiel #5
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();


            // example 2
            var bridge1 = new Bridge1();
            var ab1     = new AbstractBridge(bridge1);

            ab1.CallMethod1();
            ab1.CallMethod2();

            var bridge2 = new Bridge2();
            var ab2     = new AbstractBridge(bridge2);

            ab2.CallMethod1();
            ab2.CallMethod2();

            // example 3
            var customers = new Customers();

            // Set ConcreteImplementor
            customers.DataObject = new CustomersData {
                City = "Chicago"
            };

            // Exercise the bridge
            customers.Show();
            customers.Next();
            customers.Show();
            customers.Next();
            customers.Show();

            customers.Add("Bob Dole");
            customers.ShowAll();
        }