Пример #1
0
 /// <summary>
 /// Method unregisters the subscriber.
 /// </summary>
 /// <param name="subscriber">Subscriber to unregister</param>
 public void RemoveSubscriber(IExchangeRateSubscriber subscriber)
 {
     try
     {
         if (subscribers.Contains(subscriber))
         {
             subscribers.Remove(subscriber);
         }
         else
         {
             Console.ForegroundColor = ConsoleColor.Yellow;
             Console.WriteLine("Subscriber not registered yet!!!");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #2
0
        ///// <summary>
        ///// Enum of currencies
        ///// </summary>
        //enum Currencies
        //{
        //    USDINR,
        //    USDGBP,
        //    USDJPY
        //}

        ///// <summary>
        ///// Console colors enum just to notify an update has been displayed
        ///// </summary>
        //enum ConsoleColors
        //{
        //    Yellow,
        //    Blue,
        //    Green
        //}

        /// <summary>
        /// Method registers a new subscriber.
        /// </summary>
        /// <param name="subscriber">Subscriber to register</param>
        public void AddSubscriber(IExchangeRateSubscriber subscriber)
        {
            try
            {
                if (!subscribers.Contains(subscriber))
                {
                    subscribers.Add(subscriber);
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("Subscriber already registered!!!");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }