public void unsubscribeChannel() { Console.WriteLine("Enter your youtube channel name: "); String yourName = Console.ReadLine(); Console.WriteLine("Enter youtube channel to unsubscribe: "); String channelName = Console.ReadLine(); try { YouTubeChannel subscriber = channels[yourName]; try { YouTubeChannel channel = channels[channelName]; subscriber.unsubscribe(channel); } catch (KeyNotFoundException) { Console.WriteLine("Youtube channel name you want to unsubscribe does not exist!"); } } catch (KeyNotFoundException) { Console.WriteLine("Your youtube channel name is incorrect!"); } }
//bez update funkcije public void subscribe(YouTubeChannel toSubscribe) { try { this.subscribedTo.Add(toSubscribe.Name, toSubscribe); toSubscribe.GoogleAccountSubscribers.Add(this); } catch (ArgumentException) { Console.WriteLine("You are already subscribed to this channel!"); } }
public void createNewVideo() { Console.WriteLine("Enter youtube channel: "); String channelName = Console.ReadLine(); try { YouTubeChannel channel = channels[channelName]; channel.createNewVideo(); } catch (KeyNotFoundException) { Console.WriteLine("Youtube channel name does not exist!"); } }
public void clearYouTubeChannelNotifications() { Console.WriteLine("Enter youtube channel name: "); String channelName = Console.ReadLine(); try { YouTubeChannel channel = channels[channelName]; channel.clearNotifications(); } catch (KeyNotFoundException) { Console.WriteLine("Youtube channel name does not exist!"); } }
//bez registerObserver,removeObserver,notifyObservers kao i update funkcije public void subscribe(YouTubeChannel toSubscribe) { if (this == toSubscribe) { Console.WriteLine("You can not subscribe to your own channel!"); return; } try { this.subscribedTo.Add(toSubscribe.Name, toSubscribe); toSubscribe.youTubeSubscribers.Add(this); //obavestavamo direktno kanal na koji se subscribe-ujemo, konkretno preko liste } catch (ArgumentException) { Console.WriteLine("You are already subscribed to this channel!"); } }
public void unsubscribe(YouTubeChannel toUnsubscribe) { this.subscribedTo.Remove(toUnsubscribe.Name); toUnsubscribe.youTubeSubscribers.Remove(this); }
public void unsubscribe(YouTubeChannel toUnsubscribe) { this.subscribedTo.Remove(toUnsubscribe.Name); toUnsubscribe.GoogleAccountSubscribers.Remove(this); }