static void Main(string[] args) { YouTubeChannel Youtube = new YouTubeChannel(); //Create new youtube account! ISubscriber Joey = new User(); ISubscriber Alex = new User(); ISubscriber Gai = new Moderator(); Youtube.Subscribe(Joey); Youtube.Subscribe(Alex); Youtube.Subscribe(Gai); Youtube.NotifySubscribers(); //I upload a new video! Console.WriteLine("Alex unsubscribed"); Youtube.Unsubscribe(Alex); Youtube.NotifySubscribers(); Console.Read(); }
static void Main(string[] args) { YouTubeChannel myChannel = new YouTubeChannel(); ISubscriber joey = new User("Joey"); ISubscriber alex = new User("Alex"); ISubscriber guy = new Moderator(); myChannel.Subscribe(joey); myChannel.Subscribe(alex); myChannel.Subscribe(guy); myChannel.NotifySubscribers(); Console.ReadKey(); myChannel.Unsubscribe(alex); myChannel.NotifySubscribers(); Console.ReadKey(); }
static void Main(string[] args) { //var subject = new Subject(); //var ob1 = new Observer("Observer_1", subject); //var ob2 = new Observer("Observer_2", subject); //subject.Attach(ob1); //subject.Attach(ob2); //subject.State = "UPDATED!!!"; var youtubeChannel = new YouTubeChannel(); var client = new Client("Rami"); var admin = new ChannelAdmin("John"); youtubeChannel.Subscribe(client); youtubeChannel.Subscribe(admin); youtubeChannel.LastVideo = "C# Design Patterns"; Console.ReadLine(); }
static void Main(string[] args) { YouTubeChannel RedChannel = new YouTubeChannel(); // Create new youtube account. ISubscriber Joey = new User(); ISubscriber Alex = new User(); ISubscriber Gal = new Moderator(); RedChannel.Subscribe(Joey); RedChannel.Subscribe(Alex); RedChannel.Subscribe(Gal); Console.WriteLine(" --- I upload a new video. --- "); RedChannel.NotifySubscribers(); // I upload a new video. Console.WriteLine(" --- Alex unsubscribe. --- "); RedChannel.Unsubscribe(Alex); Console.WriteLine(" --- I upload a new video. --- "); RedChannel.NotifySubscribers(); // I upload a new video. Console.ReadKey(); }