static void Main(string[] args) { IFacebookClientFactory facebookClientFactory = new FaceBookClientFactory(); IDisplay display = new DisplayWallPost(); IFacebookClient client1 = facebookClientFactory.CreateClient(display); IDisplay display1 = new DisplayWallPost1(); IFacebookClient client2 = facebookClientFactory.CreateClient(display1); client1.Subscribe(client2); client2.WriteNewWallPost("first post from client 2"); client1.Unsubscribe(client2); client2.WriteNewWallPost("sec post"); }
static void Main(string[] args) { IFacebookClientFactory facebookClientFactory = new FacebookClientFactory(); IDisplay consoleDispaler = new DisplayWallPost(); IDisplay consoleDispaler2 = new DisplayWallPost2(); IDisplay consoleDispaler3 = new DisplayWallPost3(); IFacebookClient dolphinsFacebookClient = facebookClientFactory.CreateClient(consoleDispaler); IFacebookClient dolphinsFacebookClient2 = facebookClientFactory.CreateClient(consoleDispaler2); IFacebookClient dolphinsFacebookClient3 = facebookClientFactory.CreateClient(consoleDispaler3); dolphinsFacebookClient2.Subscribe(dolphinsFacebookClient); dolphinsFacebookClient3.Subscribe(dolphinsFacebookClient); dolphinsFacebookClient.WriteNewWallPost("Hey from here"); Console.WriteLine("-----------------------------------------------"); dolphinsFacebookClient2.Unsubscribe(dolphinsFacebookClient); dolphinsFacebookClient3.Unsubscribe(dolphinsFacebookClient); dolphinsFacebookClient.WriteNewWallPost("aftre change"); }