Пример #1
0
 public HomeViewModel(IWeatherApi api, IDatabase database)
 {
     this.api              = api;
     this.database         = database;
     this.UpdateCommand    = new AsyncRelayCommand(ExecuteUpdateCommand);
     this.SelectDayCommand = new RelayCommand <DayItemViewModel>(ExecuteSelectDayCommand);
 }
 public NotificationEventOperations(IMainGenericDb <NotificationEvent> repo, IExistElement existElement, IAgroSearch search, ICommonQueries commonQueries, IEmail email, IUploadImage uploadImage, IWeatherApi weather, ICommonDbOperations <NotificationEvent> commonDb, IValidator validators) : base(repo, existElement, search, commonDb, validators)
 {
     this.commonQueries = commonQueries;
     this.email         = email;
     this.uploadImage   = uploadImage;
     this.weather       = weather;
 }
 public NotificationEventOperations(IMainGenericDb <NotificationEvent> repo, IAgroSearch <T> search, ICommonAgroQueries commonQueries, IEmail email, IUploadImage uploadImage, IWeatherApi weather, ICommonDbOperations <NotificationEvent> commonDb, IValidatorAttributes <NotificationEventInput> validator) : base(repo, search, commonDb, validator)
 {
     this.commonQueries = commonQueries;
     this.email         = email;
     this.uploadImage   = uploadImage;
     this.weather       = weather;
 }
Пример #4
0
 public HomeController(ILogger <HomeController> logger, INewsApi _newsApi, IWeatherApi _weatherApi, IHttpContextAccessor httpContextAccessor, IUser _user, IChallenge _challenge)
 {
     _logger                   = logger;
     this._newsApi             = _newsApi;
     this._weatherApi          = _weatherApi;
     this._httpContextAccessor = httpContextAccessor;
     this._user                = _user;
     this._challenge           = _challenge;
 }
Пример #5
0
        public WeatherApiService(ILogger <WeatherApiService> logger, RatelimitService ratelimiter, IConfiguration config, HttpClient http)
        {
            _logger      = logger;
            _ratelimiter = ratelimiter;
            _config      = config;
            _api         = RestClient.For <IWeatherApi>(ApiUrl);

            _apiKey = _config["tokens:openweather"];
        }
Пример #6
0
 public AgroManager(AgroDbArguments arguments, IEmail email, IUploadImage uploadImage, IWeatherApi weatherApi, IAgroSearch searchServiceInstance, string ObjectIdAAD, bool _isBatch)
 {
     Arguments              = arguments;
     _email                 = email;
     _uploadImage           = uploadImage;
     _weatherApi            = weatherApi;
     _searchServiceInstance = searchServiceInstance;
     UserId                 = CommonQueries.GetUserIdFromAAD(ObjectIdAAD).Result;
     isBatch                = _isBatch;
 }
Пример #7
0
 public AgroManager(IDbAgroConnect dbConnect, IEmail email, IUploadImage uploadImage, IWeatherApi weatherApi, IAgroSearch <T> searchServiceInstance, string ObjectIdAAD)
 {
     this.dbConnect = dbConnect;
     _email         = email;
     _uploadImage   = uploadImage;
     _weatherApi    = weatherApi;
     Search         = searchServiceInstance;
     if (!string.IsNullOrWhiteSpace(ObjectIdAAD))
     {
         UserId = CommonQueries.GetUserIdFromAAD(ObjectIdAAD).Result;
     }
 }
        public DetailsViewModel(IDialogService dialogService, IRoutingService navigationService, IWeatherApi api)
            : base(dialogService, navigationService)
        {
            this._api = api;

            WeatherIconBasePath = ApiConstants.iconPath;

            DailyWeatherList  = new ObservableCollection <DailyWeatherData>();
            HourlyWeatherList = new ObservableCollection <HourlyWeatherData>();

            LoadDataCommand = new RelayCommand(async() => await LoadData());
        }
Пример #9
0
        protected virtual void UserLocationFound(GpsWatcherResponseMessage gpsWatcherResponseMessage)
        {
            if (gpsWatcherResponseMessage.Reason == GpsWatcherResponseMessageReason.Error)
            {
                DeregisterWatcher();

                this.ShowPopup(CustomPopupMessageType.Error, AppResources.CustomPopupGenericGpsFailureMessage, AppResources.CustomPopupGenericOkMessage, null);

                return;
            }

            if (SentCoordinateRequest || gpsWatcherResponseMessage.IsUsingLastKnown)
            {
                DeregisterWatcher();

                if (user != null && !gpsWatcherResponseMessage.IsUsingLastKnown)
                {
                    user.UpdateLocation(gpsWatcherResponseMessage.Coordinate);
                    UnitOfWork.UserRepository.Update(user);
                    UnitOfWork.Save();
                }

                if (InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.ShowWeather).Value)
                {
                    if (weather == null || weather.LastRefreshedDate < DateTime.Now.AddHours(-1))
                    {
                        Action getWeather = async() =>
                        {
                            try
                            {
                                IWeatherApi weatherApi = SimpleIoc.Default.GetInstance <IWeatherApi>();

                                if (weatherApi != null)
                                {
                                    weather = await weatherApi.GetDataWeather(gpsWatcherResponseMessage.Coordinate);

                                    UnitOfWork.WeatherRepository.DeleteAll();
                                    UnitOfWork.WeatherRepository.Insert(weather);
                                    UnitOfWork.Save();
                                }
                            }
                            catch (Exception)
                            {
                            }
                        };

                        DispatcherHelper.CheckBeginInvokeOnUI(getWeather);
                    }
                }
            }
        }
Пример #10
0
        public IWeatherApi GetWeatherApi(string externalWeatherApiName, WeatherApiRequest weatherApiRequest)
        {
            if (weatherApiRequest == null)
            {
                throw new ArgumentNullException("weatherApiRequest", "weatherApiRequest is a required parameter.");
            }

            switch (externalWeatherApiName)
            {
            case "OpenWeatherMap":
                _weatherApi = new OpenWeatherMapApi(weatherApiRequest);
                break;

            default:
                throw new Exception(string.Format("External Weather API {0} is not supported.", externalWeatherApiName));
            }
            return(_weatherApi);
        }
Пример #11
0
        protected WeatherService()
        {
            var httpClient = new HttpClient(new HttpClientDiagnosticsHandler(new HttpClientHandler()))
            {
                BaseAddress = new Uri(BaseUrl)
            };
            var refitSettings = new RefitSettings
            {
                JsonSerializerSettings = new JsonSerializerSettings
                {
                    ContractResolver = new DefaultContractResolver
                    {
                        NamingStrategy = new CamelCaseNamingStrategy()
                    }
                }
            };

            WeatherApi = RestService.For <IWeatherApi>(httpClient, refitSettings);
        }
 public HomeViewModel(IRoutingService navigationService, IDialogService dialogService, IWeatherApi api)
     : base(dialogService, navigationService)
 {
     this._api     = api;
     SearchCommand = new RelayCommand(async() => await PerformSearch(), CanSearch);
 }
 public DailyClientInfoService(IClientJokeService companyJokeService, IClientsApi clientsApi, IWeatherApi weatherApi)
 {
     _companyJokeService = companyJokeService;
     _clientsApi         = clientsApi;
     _weatherApi         = weatherApi;
 }
Пример #14
0
 public HomeController(IHttpClientFactory httpClientFactory, IWeatherApi weatherApi)
 {
     HttpClientFactory = httpClientFactory;
     WeatherApi        = weatherApi;
 }
Пример #15
0
 public WeatherService(IWeatherApi api)
 {
     _api = api;
 }
Пример #16
0
 public WeatherController(IConfiguration configuration, ILog logger)
 {
     _appsettingsManager = new AppSettingsManager(configuration);
     _logger             = logger;
     _weatherApi         = GetWeatherApi();
 }
 public WeatherWidgetViewModel(IGeolocationService geolocationService, IWeatherApi weatherApi)
 {
     this.geolocationService = geolocationService;
     this.weatherApi         = weatherApi;
 }
 public WeatherRepository(IWeatherApi api, IMapper <WeatherData, WeatherEntity> mapper)
 {
     _api    = api ?? throw new ArgumentNullException(nameof(api));
     _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
Пример #19
0
 public Race(ILaptimeFeed laptimeFeed, IWeatherApi weatherApi)
 {
     this.laptimeFeed = laptimeFeed ?? throw new ArgumentNullException(nameof(laptimeFeed));
     this.weatherApi  = weatherApi ?? throw new ArgumentNullException(nameof(weatherApi));
 }
Пример #20
0
 public DayViewModel(IWeatherApi api, IDatabase database)
 {
     this.api           = api;
     this.database      = database;
     this.UpdateCommand = new AsyncRelayCommand <string>(ExecuteUpdateCommand);
 }
 public LocationSearchController(ILogger <LocationSearchController> logger, IWeatherApi apiClient, ILocationLogger locationLogger)
 {
     _logger         = logger;
     _apiClient      = apiClient;
     _locationLogger = locationLogger;
 }
Пример #22
0
 public WeatherService(IWeatherApi weatherApi)
 {
     WeatherAPI = weatherApi;
 }
Пример #23
0
 public FetchManager(IWeatherApi weatherApi, IWeatherRepository repository, OpenWeatherSettings openWeatherSettings)
 {
     _weatherApi          = weatherApi;
     _repository          = repository;
     _openWeatherSettings = openWeatherSettings;
 }
Пример #24
0
 public WeatherController(IWeatherApi weatherApi)
 {
     _weatherApi = weatherApi;
 }
Пример #25
0
 public PlaylistApplication(IUserApplication userApplication, IWeatherApi openWeatherService, IMusicApi playlistService)
 {
     this._userApplication    = userApplication;
     this._openWeatherService = openWeatherService;
     this._spotifyService     = playlistService;
 }
Пример #26
0
 public WeatherService(ICityRepository cityRepository, IWeatherApi weatherApi)
 {
     _cityRepository = cityRepository;
     _weatherApi     = weatherApi;
 }