示例#1
0
        public static void Run()
        {
            ShapePublisher shape = new ShapePublisher();
            Subscriber1    sub   = new Subscriber1(shape);
            Subscriber2    sub2  = new Subscriber2(shape);

            shape.Draw();
        }
示例#2
0
        public Subscriber2(ShapePublisher shape)
        {
            IShape d = (IShape)shape;

            d.OnDraw += d_OnDraw;
        }
示例#3
0
        // References the shape object as an IDrawingObject
        public Subscriber1(ShapePublisher shape)
        {
            IDrawingObject d = (IDrawingObject)shape;

            d.OnDraw += d_OnDraw;
        }