Esempio n. 1
0
        public object GetWeather(string attr, string local = "桃園區")
        {
            //Initial Variables
            IWeather repos = DataFactory.WeatherRepository();

            return(repos.GetWeatherSearch(attr, local));
        }
        private void CreateChannelFactory()
        {
            ChannelFactory <IWeather> factory = new ChannelFactory <IWeather>(new NetTcpBinding(), new EndpointAddress("net.tcp://127.255.0.2:502/InputRequest")); // promeniti na svakom kompu

            //ChannelFactory<IWeather> factory = new ChannelFactory<IWeather>(new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:502/InputRequest"));
            proxy = factory.CreateChannel();
        }
Esempio n. 3
0
        private IWeather JsonToWeather(string result)
        {
            IWeather weather = _kernel.Get <IWeather>();

            if (string.IsNullOrWhiteSpace(result))
            {
                return(weather);
            }

            var jsonObject = JsonConvert.DeserializeObject <RootObject>(result);

            if (jsonObject.current_observation == null)
            {
                return(weather);
            }

            weather.CurrentWeatherSummary = jsonObject.current_observation.weather;
            weather.FeelsLikeF            = jsonObject.current_observation.feelslike_f;
            weather.FeelsLikeC            = jsonObject.current_observation.feelslike_c;
            weather.Humidity           = jsonObject.current_observation.relative_humidity;
            weather.PrecipToday        = jsonObject.current_observation.precip_today_in;
            weather.CurrentTemperature = jsonObject.current_observation.temp_f.ToString();
            weather.WeatherAlerts      = new List <IWeatherAlert>();
            weather.Pressure           = jsonObject.current_observation.pressure_in;
            weather.Wind          = jsonObject.current_observation.wind_mph.ToString();
            weather.WindDirection = jsonObject.current_observation.wind_dir;
            weather.UV            = jsonObject.current_observation.UV;
            weather.HeatIndexC    = jsonObject.current_observation.heat_index_c.ToString();
            weather.HeatIndexF    = jsonObject.current_observation.heat_index_f.ToString();

            return(weather);
        }
 public void NotifyObservers(IWeatherStation weatherStation, IWeather weather)
 {
     foreach (var observer in _observers)
     {
         observer.Action(weatherStation, weather);
     }
 }
        public StoredWeather Create(IWeather weather, string message, WeatherType type, int daysAhead)
        {
            var forecast = new StoredWeather();

            switch (type)
            {
            case WeatherType.Current:
                CurrentWeather currentWeather = weather as CurrentWeather;
                forecast.CityId       = currentWeather.Id;
                forecast.QueryDate    = DateTime.Now;
                forecast.RequiredDate = DateTime.Now;
                forecast.Type         = WeatherType.Current;
                forecast.Message      = message;
                break;

            case WeatherType.Forecast:
                WeatherForecast weatherForecast = weather as WeatherForecast;
                forecast.CityId       = weatherForecast.City.Id;
                forecast.QueryDate    = DateTime.Now;
                forecast.RequiredDate = DateTime.Now.AddDays(daysAhead);
                forecast.Type         = WeatherType.Forecast;
                forecast.Message      = message;
                break;
            }

            return(forecast);
        }
Esempio n. 6
0
        public MainWindow()
        {
            InitializeComponent();

            ConfigurationBuilder builder = new ConfigurationBuilder();

            builder.SetBasePath(Directory.GetCurrentDirectory());
            builder.AddJsonFile("appsettings.json");
            IConfigurationRoot config           = builder.Build();
            string             connectionString = config.GetConnectionString("DefaultConnection");
            string             telegramToken    = config.GetSection("TelegramToken").Value;
            string             weatherToken     = config.GetSection("WeatherToken").Value;

            DbContextOptionsBuilder <ApplicationContext> optionsBuilder = new DbContextOptionsBuilder <ApplicationContext>();
            DbContextOptions <ApplicationContext>        options        = optionsBuilder
                                                                          .UseSqlServer(connectionString)
                                                                          .Options;

            uiContext = SynchronizationContext.Current;

            this.db          = new ApplicationContext(options);
            this.telegramBot = new TelegramBot(db, telegramToken, uiContext);
            currentWeather   = new CurrentWeather(weatherToken);

            applicationViewModel = new ApplicationViewModel(db, telegramBot, currentWeather);
            this.DataContext     = applicationViewModel;
        }
        private double GetTravelDurationOnOrbit(IWeather weather, VehicleTypeEnum vehicleTypeEnum)
        {
            double CraterCountForInputWeather = weather.GetModifiedCratersCountBasedOnWeather(NoOfCraters);
            double timeToCrossCrater;
            double timeToCrossOrbit;

            switch (vehicleTypeEnum)
            {
            case VehicleTypeEnum.BIKE:
                Bike objbike = ObjectFactory.GetBikeInstance;
                timeToCrossCrater = (objbike.TimeToCrossCrater * CraterCountForInputWeather);
                timeToCrossOrbit  = ((_distance / (_speed > objbike.Speed ? objbike.Speed : _speed)) * 60);
                break;

            case VehicleTypeEnum.CAR:
                Car objcar = ObjectFactory.GetCarInstance;
                timeToCrossCrater = (objcar.TimeToCrossCrater * CraterCountForInputWeather);
                timeToCrossOrbit  = ((_distance / (_speed > objcar.Speed ? objcar.Speed : _speed)) * 60);
                break;

            case VehicleTypeEnum.TUKTUK:
                Tuktuk objtuktuk = ObjectFactory.GetTuktukInstance;
                timeToCrossCrater = (objtuktuk.TimeToCrossCrater * CraterCountForInputWeather);
                timeToCrossOrbit  = ((_distance / (_speed > objtuktuk.Speed ? objtuktuk.Speed : _speed)) * 60);
                break;

            default:
                throw new InvalidOperationException("Invalid Vehicle Type");
            }
            return(timeToCrossCrater + timeToCrossOrbit);
        }
Esempio n. 8
0
        public CubeEmitter(string cubeTexturePath,
                           string fileNamePatern,
                           string biomeColorFilePath,
                           float maximumAge,
                           float size,
                           VisualWorldParameters visualWorldParameters,
                           IWorldChunks worldChunk,
                           ILandscapeManager landscapeManager,
                           double maxRenderingDistance,
                           IWeather weather)
        {
            if (landscapeManager == null)
            {
                throw new ArgumentNullException("landscapeManager");
            }

            _cubeColorSampled      = new Dictionary <int, Color[]>();
            _fileNamePatern        = fileNamePatern;
            _cubeTexturePath       = cubeTexturePath;
            _visualWorldParameters = visualWorldParameters;
            _biomeColorFilePath    = biomeColorFilePath;
            _weather             = weather;
            MaxRenderingDistance = maxRenderingDistance;
            _worldChunk          = worldChunk;
            _landscapeManager    = landscapeManager;
            _isStopped           = false;
            _maximumAge          = maximumAge;
            _particules          = new List <ColoredParticule>();

            _rnd = new FastRandom();

            _cubeBB = new BoundingBox(new Vector3(-size / 2.0f, -size / 2.0f, -size / 2.0f), new Vector3(size / 2.0f, size / 2.0f, size / 2.0f));
        }
Esempio n. 9
0
 public static void Add(IWeather connector)
 {
     if (!Exists(connector.GetName()))
     {
         Connectors.Add(connector);
     }
 }
Esempio n. 10
0
        /// <summary>
        /// 取得搜尋天氣資訊
        /// </summary>
        /// <param name="attr"></param>
        /// <param name="date"></param>
        /// <param name="local"></param>
        /// <returns></returns>
        public ActionResult GetSearchWeather(string attr, DateTime date, string local = "桃園區")
        {
            //Initial Variables
            IWeather repos = DataFactory.WeatherRepository();

            return(Content(JsonConvert.SerializeObject(repos.GetWeatherSearch(attr, local)), "application/json"));
        }
Esempio n. 11
0
        public static void Run(IWeather[] items)
        {
            var forecast = items[0];

            // 1. serialize a single forecast to a JSON string
            Console.WriteLine(JsonConvert.SerializeObject(forecast));

            // 2. ... with nicer formatting
            Console.WriteLine(JsonConvert.SerializeObject(forecast, Formatting.Indented));

            // 3. serialize all items
            // ... include type, so we can deserialize sub-classes to interface type
            var settings = new JsonSerializerSettings() { Formatting = Formatting.Indented, TypeNameHandling = TypeNameHandling.Auto };
            Console.WriteLine(JsonConvert.SerializeObject(items, settings));

            // 4. store json string to file "items.json" on your Desktop
            var text = JsonConvert.SerializeObject(items, settings);
            var desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            var filename = Path.Combine(desktop, "items.json");
            File.WriteAllText(filename, text);

            // 5. deserialize items from "items.json"
            // ... and print Clouds of deserialized items
            var textFromFile = File.ReadAllText(filename);
            var itemsFromFile = JsonConvert.DeserializeObject<IWeather[]>(textFromFile, settings);
            foreach (var x in itemsFromFile) Console.WriteLine($"{x.Clouds}");
        }
Esempio n. 12
0
 public LocationController(ILogger <LocationController> logger, IWeather weatherSvc, ITimeZone timeZoneSvc, IElevation elevationSvc)
 {
     _logger       = logger;
     _weatherSvc   = weatherSvc;
     _timeZoneSvc  = timeZoneSvc;
     _elevationSvc = elevationSvc;
 }
        public void CreateWeather()
        {
            IWeatherFactory weatherFactory = new WeatherFactory(_kernel);
            IWeather        alerts         = weatherFactory.CreateCurrentWeather("15217", true);

            Assert.IsNotNull(alerts);
        }
Esempio n. 14
0
        public static string JudgeWeatherByEarthHistory(IWeather w)
        {
            double tempCelsius = w.GetTemperature();

            if (tempCelsius < -273)
            {
                throw new TooColdException.ColderThanAbsoluteZeroException();
            }
            else if (tempCelsius >= -273 && tempCelsius < -89)
            {
                return("Colder than Earth");
            }
            else if (tempCelsius > 56)
            {
                return("Hotter than Earth");
            }
            else if (tempCelsius >= -89 && tempCelsius <= 56)
            {
                return("Meh");
            }
            else
            {
                return("Inconclusive");
            }
        }
Esempio n. 15
0
 public DataController(IWeather weather, IToDoList toDoList, IEngWord engword, ITranslate translate, INews news)
 {
     _Weather   = weather;
     _ToDoList  = toDoList;
     _EngWord   = engword;
     _Translate = translate;
     _News      = news;
 }
        public void GetStatesFromWeb()
        {
            ConnectToServicehost();
            foreach (string s in URLs)
                GetState(s);

            SendStatesToWorkerRole();
            proxy = null;
        }
Esempio n. 17
0
        // GET: TaoyuanWeathert
        public ActionResult Index()
        {
            //Initial Variables
            IWeather      repos  = DataFactory.WeatherRepository();
            List <string> wtList = new List <string> {
                "F-D0047-003", "F-D0047-007", "F-D0047-011", "F-D0047-015", "F-D0047-019", "F-D0047-023", "F-D0047-027"
                , "F-D0047-031", "F-D0047-035", "F-D0047-039", "F-D0047-043", "F-D0047-047", "F-D0047-051", "F-D0047-055", "F-D0047-059", "F-D0047-063"
                , "F-D0047-067", "F-D0047-071", "F-D0047-075", "F-D0047-079", "F-D0047-083", "F-D0047-087"
            };

            //Dictionary<int, string> wtD = new Dictionary<int, string>();
            //clear DataTable from DB
            repos.clearWTTable();
            int      rCount = 1;
            DateTime now    = DateTime.Now;

            //string targetURI = ConfigurationManager.AppSettings["WeatherInfoURL"].ToString() + "/?elementName=Wx,PoP,T,CI&sort=time";
            for (int i = 0; i <= wtList.Count - 1; i++)
            {
                string targetURI = ConfigurationManager.AppSettings["WeatherInfoURL"].ToString() + "/"
                                   + wtList[i].ToString() + "?elementName=WeatherDescription,Wx,PoP,T,Wind&sort=time";

                var           jsonResponse = "";
                StringBuilder jsonResultSB = new StringBuilder();


                //Get HTTPRequest RESPONSE Custom JSON FORMAT
                var webRequest = System.Net.WebRequest.Create(targetURI);
                if (webRequest != null)
                {
                    webRequest.Method      = "GET";
                    webRequest.Timeout     = 50000;
                    webRequest.ContentType = "application/json";
                    webRequest.Headers.Add("Authorization", "CWB-43A3A823-91B0-4D35-96E1-D66A1B5277AA");
                    using (System.IO.Stream s = webRequest.GetResponse().GetResponseStream())
                    {
                        using (System.IO.StreamReader sr = new System.IO.StreamReader(s))
                        {
                            jsonResponse = sr.ReadToEnd();
                            JObject o = (JObject)JsonConvert.DeserializeObject(jsonResponse);
                            jsonResultSB.Append(o.SelectToken("records").SelectToken("locations[0].location").ToString());
                        }
                    }
                }

                //Deserialize
                var collection = JsonConvert.DeserializeObject <IEnumerable <Weather3DayDeserialize> >(jsonResultSB.ToString());

                //Add Json Data to SQL
                rCount = repos.addWeatherInfo(collection, rCount);
            }
            DateTime afterNow  = DateTime.Now;
            string   spendTime = (afterNow - now).ToString();

            return(Content(spendTime));
        }
Esempio n. 18
0
        public MainPageViewModel(INavigationService navigationService, IPageDialogService pageDialogService, IConnectivity connectivity, IWeather weather)
            : base(navigationService, pageDialogService)
        {
            _weather      = weather;
            _connectivity = connectivity;

            NoInternet();

            GenerateRandomLocation = new DelegateCommand(async() => await GetWeatherConditions(true));
        }
Esempio n. 19
0
 /// <summary>Constructor.</summary>
 /// <param name="clockModel">The clock model.</param>
 /// <param name="weatherModel">The weather model.</param>
 /// <param name="zoneModel">The zone model.</param>
 public MicroClimateZone(Clock clockModel, IWeather weatherModel, Zone zoneModel)
 {
     clock                  = clockModel;
     weather                = weatherModel;
     Zone                   = zoneModel;
     canopyModels           = Apsim.ChildrenRecursively(Zone, typeof(ICanopy)).Cast <ICanopy>();
     modelsThatHaveCanopies = Apsim.ChildrenRecursively(Zone, typeof(IHaveCanopy)).Cast <IHaveCanopy>();
     soilWater              = Apsim.Find(Zone, typeof(ISoilWater)) as ISoilWater;
     surfaceOM              = Apsim.Find(Zone, typeof(ISurfaceOrganicMatter)) as ISurfaceOrganicMatter;
 }
Esempio n. 20
0
        /// <summary>
        /// Execute the freezing algorithme on a specific device
        /// </summary>
        /// <param name="device">Device telemetry with temperature in Celsius</param>
        /// <returns></returns>
        public async Task <FreezeForecast> Execute(IWeather device)
        {
            FreezeForecast freezeForecast = new FreezeForecast
            {
                FreezingStart = device.Date
            };

            freezeForecast.FreezingProbabilityList.Add(device.Date, GetProbabilityFreezing(device));
            return(freezeForecast);
        }
Esempio n. 21
0
        public WindGenerator Update(string city)
        {
            var        binding   = new NetTcpBinding();
            IPEndPoint ipAddress = RoleEnvironment.Roles["WeatherWorkerRole"].Instances[0].InstanceEndpoints["InternalRequest"].IPEndpoint;
            ChannelFactory <IWeather> factory = new ChannelFactory <IWeather>(binding, new EndpointAddress($"net.tcp://{ipAddress}/InternalRequest"));

            proxy = factory.CreateChannel();

            return(proxy.GetWindGenerator(city));
        }
Esempio n. 22
0
        public OpenWeatherMapService()
        {
            Weather = new Weather();

            _client = new HttpClient
            {
                BaseAddress =
                    new Uri("http://api.openweathermap.org")
            };
        }
        /// <summary>
        /// Tries to get weather information from each of its sources in order
        /// </summary>
        /// <param name="latitude"></param>
        /// <param name="longitude"></param>
        /// <returns></returns>
        public async Task <GenericWeather> GetGenericWeatherAsync(double latitude, double longitude)
        {
            // Read name of preferred weather provider from file if it exists (e.g. NWSWeather)
            if (_preferredSource == null)
            {
                _preferredSource = await FileUtil.ReadFileAsync("WeatherProvider.config") ?? DefaultSource;
            }

            // Try the preferred source first
            if (_preferredSource != DefaultSource)
            {
                LogService.Write($"Preferred source has been specified: {_preferredSource}");

                // Check if the preferred source matches an available source
                IWeather source = Sources.FirstOrDefault(x => x.GetType().Name == _preferredSource);
                if (source != null)
                {
                    try
                    {
                        LogService.Write($"Getting weather from: {source.Name}...");
                        var weather = await source.GetGenericWeatherAsync(latitude, longitude);

                        if (weather != null)
                        {
                            return(weather);
                        }
                    }
                    catch (Exception ex)
                    {
                        LogService.WriteException(ex);
                    }
                }
            }

            // Query each weather provider until we get a response or exhaust the list
            foreach (var source in Sources)
            {
                try
                {
                    LogService.Write($"Getting weather from: {source.Name}...");
                    var weather = await source.GetGenericWeatherAsync(latitude, longitude);

                    if (weather != null)
                    {
                        return(weather);
                    }
                }
                catch (Exception ex)
                {
                    LogService.WriteException(ex);
                }
            }

            return(null);
        }
Esempio n. 24
0
 public SimTempInput(IWeather weather)
 {
     _weather      = weather;
     _current_temp = new Temperature()
     {
         C = _weather.Temperature()
     };
     _last_time    = DateTime.MinValue;
     _running      = false;
     _thermal_rate = 1.0e-2;
 }
Esempio n. 25
0
    // Start is called before the first frame update
    void Start()
    {
        packageWeather = packageObject.GetComponent(typeof(IWeather)) as IWeather;
        stormWeather   = stormObject.GetComponent(typeof(IWeather)) as IWeather;
        calmWeather    = calmObject.GetComponent(typeof(IWeather)) as IWeather;
        fogWeather     = fogObject.GetComponent(typeof(IWeather)) as IWeather;

        parrot = FindObjectOfType <ParrotController>();

        StartCoroutine(WeatherSequence());
    }
Esempio n. 26
0
File: Program.cs Progetto: amq/oom
        public static void Main(string[] args)
        {
            Random rnd = new Random();

            var producer = new Subject <IWeather>();

            producer.Subscribe(x => Console.WriteLine($"Latest temparature in {x.Country}/{x.City}: {x.GetTemperature(Unit.Celsius):0.00}°C"));

            while (true)
            {
                Observable.Start(() =>
                {
                    var europe = new IWeather[]
                    {
                        new Forecast("Ukraine", "Kyiv", "Sunny", rnd.Next(15, 22) - rnd.NextDouble(), Unit.Celsius),
                        new Forecast("Austria", "Vienna", "Cloudy", rnd.Next(10, 20) - rnd.NextDouble(), Unit.Celsius)
                    };
                    foreach (var w in europe)
                    {
                        producer.OnNext(w);
                    }
                    Thread.Sleep(rnd.Next(4000, 8000));
                });

                Observable.Start(() =>
                {
                    var asia = new IWeather[]
                    {
                        new Forecast("Japan", "Tokyo", "Showers", rnd.Next(8, 14) - rnd.NextDouble(), Unit.Celsius),
                        new Forecast("China", "Beijing", "Sunny", rnd.Next(12, 18) - rnd.NextDouble(), Unit.Celsius)
                    };
                    foreach (var w in asia)
                    {
                        producer.OnNext(w);
                    }
                    Thread.Sleep(rnd.Next(4000, 8000));
                });

                Observable.Start(() =>
                {
                    var americas = new IWeather[]
                    {
                        new Forecast("USA", "Washington DC", "Cloudy", rnd.Next(50, 70) - rnd.NextDouble(), Unit.Fahrenheit),
                        new Forecast("Brazil", "Brasília", "Rainy", rnd.Next(8, 18) - rnd.NextDouble(), Unit.Celsius)
                    };
                    foreach (var w in americas)
                    {
                        producer.OnNext(w);
                    }
                    Thread.Sleep(rnd.Next(4000, 8000));
                });
            }
        }
Esempio n. 27
0
        public FileProcessing(Config config)
        {
            Logger.Log.Info($"FileProcessing ctor with {config}");

            if (!File.Exists(config.DataReaderAssembly))
            {
                throw new ArgumentException("Can't find assembly!");
            }
            if (config == null)
            {
                throw new ArgumentNullException("Config is null");
            }

            Assembly assembly   = null;
            Type     foundClass = null;

            try
            {
                assembly = Assembly.LoadFile(config.DataReaderAssembly);
                Logger.Log.Info($"assembly {assembly.FullName} loaded");
                foundClass = assembly.GetExportedTypes().FirstOrDefault(x => x.GetInterface("IDAL") != null);
                Logger.Log.Info($"class {foundClass.FullName} loaded");
            }
            catch (Exception ex)
            {
                Logger.Log.Error($"Can't create reader {ex}");
                throw new Exception("don't loaded assembly", ex);
            }
            if (foundClass == null)
            {
                throw new InvalidOperationException("Can't find class with IDAL interface");
            }


            reader = Activator.CreateInstance(assembly.FullName, foundClass.FullName).Unwrap() as IDAL;
            if (reader == null)
            {
                throw new InvalidOperationException("Can't create reader instance");
            }

            if (String.IsNullOrWhiteSpace(config.DataPath))
            {
                throw new ArgumentNullException("Config.DataPath is null!");
            }
            if (!File.Exists(config.DataPath))
            {
                throw new FileNotFoundException($"Can't find file {config.DataPath}");
            }

            pathFile = config.DataPath;

            weather = new Forecast();
        }
Esempio n. 28
0
File: Program.cs Progetto: amq/oom
        public static void Main(string[] args)
        {
            Random rnd = new Random();

            var producer = new Subject<IWeather>();

            producer.Subscribe(x => Console.WriteLine($"Latest temparature in {x.Country}/{x.City}: {x.GetTemperature(Unit.Celsius):0.00}°C"));

            while (true)
            {
                Observable.Start(() =>
                {
                    var europe = new IWeather[]
                    {
                    new Forecast("Ukraine", "Kyiv", "Sunny", rnd.Next(15, 22) - rnd.NextDouble(), Unit.Celsius),
                    new Forecast("Austria", "Vienna", "Cloudy", rnd.Next(10, 20) - rnd.NextDouble(), Unit.Celsius)
                    };
                    foreach (var w in europe)
                    {
                        producer.OnNext(w);
                    }
                    Thread.Sleep(rnd.Next(4000, 8000));
                });

                Observable.Start(() =>
                {
                    var asia = new IWeather[]
                    {
                    new Forecast("Japan", "Tokyo", "Showers", rnd.Next(8, 14) - rnd.NextDouble(), Unit.Celsius),
                    new Forecast("China", "Beijing", "Sunny", rnd.Next(12, 18) - rnd.NextDouble(), Unit.Celsius)
                    };
                    foreach (var w in asia)
                    {
                        producer.OnNext(w);
                    }
                    Thread.Sleep(rnd.Next(4000, 8000));
                });

                Observable.Start(() =>
                {
                    var americas = new IWeather[]
                    {
                    new Forecast("USA", "Washington DC", "Cloudy", rnd.Next(50, 70) - rnd.NextDouble(), Unit.Fahrenheit),
                    new Forecast("Brazil", "Brasília", "Rainy", rnd.Next(8, 18) - rnd.NextDouble(), Unit.Celsius)
                    };
                    foreach (var w in americas)
                    {
                        producer.OnNext(w);
                    }
                    Thread.Sleep(rnd.Next(4000, 8000));
                });
            }
        }
Esempio n. 29
0
        public string ShowWeather(IWeather weather, WeatherType type)
        {
            switch (type)
            {
            case WeatherType.Current:
                return(ShowCurrentWeather(weather as CurrentWeather));

            case WeatherType.Forecast:
                return(ShowWeatherForecast(weather as WeatherForecast));
            }

            return(null);
        }
Esempio n. 30
0
    private IEnumerator StartWeather(IWeather weather, float calmTime, float weatherTime, bool needParrot = true)
    {
        if (needParrot)
        {
            parrot.Alert();
        }
        yield return(new WaitForSeconds(calmTime));

        weather.StartWeather();
        yield return(new WaitForSeconds(weatherTime));

        weather.EndWeather();
    }
Esempio n. 31
0
        public virtual void GetWeatherAsync_ReturnsGoodValues()
        {
            // Arrange
            using (IWeather target = this.GetWeather())
            {
                // Act
                WeatherData result = target.GetWeatherAsync().Result;

                // Assert
                result.Humidity.Should().NotBe(0);
                result.Temperature.Should().NotBe(0);
            }
        }
Esempio n. 32
0
File: Program.cs Progetto: amq/oom
 public static void Main(string[] args)
 {
     var items = new IWeather[]
     {
         new Forecast("Austria", "Vienna", "Cloudy", 60.8, Unit.Fahrenheit),
         new Forecast("Ukraine", "Kyiv", "Sunny", 13.2, Unit.Celsius),
         new Forecast("Croatia", "Split", "Sunny", 20.1, Unit.Celsius),
         new History("Czech Republic", "Prague", DateTime.Now, "Sunny", 10.5, Unit.Celsius),
         new History("Greece", "Athens", DateTime.Now, "Sunny", 18.6, Unit.Celsius),
     };
     foreach (var w in items)
     {
         Console.WriteLine("{0}\n{1:0.00}°\n", w.Clouds, w.GetTemperature(Unit.Celsius));
     }
 }
Esempio n. 33
0
        public Clouds(D3DEngine engine, [Named("SkyBuffer")] StaggingBackBuffer skyBackBuffer, IClock worldclock, WorldFocusManager worldFocusManager, CameraManager <ICameraFocused> cameraManager, IWeather weather)
        {
            if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }
            _d3DEngine         = engine;
            _skyBackBuffer     = skyBackBuffer;
            _worldclock        = worldclock;
            _worldFocusManager = worldFocusManager;
            _cameraManager     = cameraManager;
            _weather           = weather;

            _skyBackBuffer.OnStaggingBackBufferChanged += _skyBackBuffer_OnStaggingBackBufferChanged;
        }
 public WeatherCommand(IWeather defaultWeather)
     : base("/weather")
 {
     this.defaultWeather = defaultWeather;
 }
Esempio n. 35
0
 internal ParentMeasure()
 {
     _data = new K780Weather();
 }
 public void AddWeatherAPI(string key, IWeather weather)
 {
     handlers.Add(key, weather);
 }
 public void RefreshWeatherData()
 {
     Weather = _weatherFactory.CreateCurrentWeather(Settings.ZipCode, true);
     NotifyOfPropertyChange(() => HasWeatherAlerts);
     NotifyOfPropertyChange(() => HighTemperatureForToday);
     NotifyOfPropertyChange(() => LowTemperatureForToday);
     NotifyOfPropertyChange(() => FeelsLike);
     NotifyOfPropertyChange(() => Humidity);
     NotifyOfPropertyChange(() => RainToday);
     NotifyOfPropertyChange(() => CurrentWeatherSummary);
     NotifyOfPropertyChange(() => CurrentTemperature);
 }
 public WeatherService(IWeather repository, IGeonames geonameAPIservice, IYrNo yrnoAPIservice)
 {
     _repository = repository;
     _geonameAPIservice = geonameAPIservice;
     _yrnoAPIservice = yrnoAPIservice;
 }