Beispiel #1
0
        static void Main(string[] args)
        {
            WeatherFactory      factory = new WeatherFactory();
            Location            loc     = new Location("london", "uk");
            IweatherDataService func1   = factory.WeatherService(loc);

            func1.GetWeatherData(loc, Key);
            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("hello client");
            WeatherFactory      factory = new WeatherFactory();
            Location            l       = new Location("london", "uk");
            IweatherDataService adi     = factory.WeatherService(l);

            adi.GetWeatherData(l, "4f3cbed25685e619c16d94f45e622782");
        }
Beispiel #3
0
        //use getYouTubeData method to get object that implements IyouTubeDataService interface
        public IweatherDataService WeatherService(Location loc)
        {
            if (loc == null)
            {
                return(null);
            }

            if (string.Equals(loc.city, "london", StringComparison.OrdinalIgnoreCase))
            {
                IweatherDataService obj = MyUploads.getInstance();
                return(obj);
            }

            if (!string.Equals(loc.city, "london", StringComparison.OrdinalIgnoreCase))
            {
                throw new WeatherDataServiceException();
            }

            return(null);
        }