コード例 #1
0
ファイル: WeatherDataSourceProvider.cs プロジェクト: ifzz/FDK
 static IWeatherService GetWeatherService(WeatherServiceType type)
 {
     switch (type)
     {
         case WeatherServiceType.WeatherUnderground:
             return new WeatherUndergroundService("e7fe61b98ca8b216", "Latvia", "Riga");
         default:
             return new FakeWeatherService();
     }
 }
コード例 #2
0
        static IWeatherService GetWeatherService(WeatherServiceType type)
        {
            switch (type)
            {
            case WeatherServiceType.WeatherUnderground:
                return(new WeatherUndergroundService("e7fe61b98ca8b216", "Latvia", "Riga"));

            default:
                return(new FakeWeatherService());
            }
        }
コード例 #3
0
        /// <summary>
        /// Factory method
        /// </summary>
        /// <param name="type">The type of WeatherDataService desired</param>
        /// <returns>A class that implements IWeatherDataService</returns>
        public static IWeatherDataService GetWeatherDataService(WeatherServiceType type)
        {
            switch (type)
            {
            case WeatherServiceType.OpenWeatherMap:
                return(OpenMapDataService.Instance);

            default:
                throw new WeatherDataServiceException("unsupported factory type");
            }
        }