Example #1
0
        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!");
            }
        }
Example #2
0
        //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!");
            }
        }
Example #3
0
        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!");
            }
        }
Example #4
0
        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!");
            }
        }
Example #5
0
        //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!");
            }
        }
Example #6
0
 public void unsubscribe(YouTubeChannel toUnsubscribe)
 {
     this.subscribedTo.Remove(toUnsubscribe.Name);
     toUnsubscribe.youTubeSubscribers.Remove(this);
 }
Example #7
0
 public void unsubscribe(YouTubeChannel toUnsubscribe)
 {
     this.subscribedTo.Remove(toUnsubscribe.Name);
     toUnsubscribe.GoogleAccountSubscribers.Remove(this);
 }