public MessageViewModel(NavigationService navigationService, IRestApiService apiService) { _navigationService = navigationService ?? throw new NullReferenceException(); _apiService = apiService ?? throw new NullReferenceException(); SendMessageCommand = ReactiveCommand.CreateFromTask(async() => { if (String.IsNullOrWhiteSpace(MyMessage)) { return; } try { var cont = App.Container.Resolve <ApplicationDataContainer>(); await _apiService.SendMessage(_selectedMatchId, new MessageDto { Data = MyMessage }, cont.Values["AuthToken"] as string); MyMessage = String.Empty; await GetMessage(_selectedMatchId); } catch (Exception e) { await new MessageDialog(e.Message).ShowAsync(); } }); }
public AuthViewModel(NavigationService navigationService, IRestApiService apiService, FbAuthService authService) { _navigationService = navigationService ?? throw new NullReferenceException(); _apiService = apiService ?? throw new NullReferenceException(); _fbAuthService = authService ?? throw new NullReferenceException(); var container = App.Container.Resolve <ApplicationDataContainer>(); SelectedLang = container.Values["appLang"] as string; SignInWithFacebookCommand = ReactiveCommand.CreateFromTask(async() => { var res = await _fbAuthService.SignInWithFacebook(); if (res == true) { try { var aut = await _apiService.SignInWithFacebook(_fbAuthService.AccessToken); if (aut.Succeeded == true) { container.Values["AuthToken"] = "Bearer " + aut.AuthToken; _navigationService.Navigate_App(typeof(MainPageView)); return; } await new MessageDialog(aut.Error).ShowAsync(); } catch (Exception e) { await new MessageDialog(e.Message).ShowAsync(); } } await new MessageDialog("Error").ShowAsync(); }); }
public SignInViewModel(NavigationService navigationService, IRestApiService apiService) { _navigationService = navigationService ?? throw new NullReferenceException(); _apiService = apiService ?? throw new NullReferenceException(); var valid = this.WhenAnyValue(x => x.Email, x => x.Password, (email, password) => new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$").IsMatch(email) && new Regex(@"([a-zA-Z0-9]{6,})").IsMatch(password)); SignInCommand = ReactiveCommand.CreateFromTask(async() => { var dto = new SignInDto { Email = this.Email, Password = this.Password }; try { var res = await _apiService.SignIn(dto); if (res.Succeeded == true) { var container = App.Container.Resolve <ApplicationDataContainer>(); container.Values["AuthToken"] = "Bearer " + res.AuthToken; _navigationService.Navigate_App(typeof(MainPageView)); return; } await new MessageDialog($"Error: {res.Error}").ShowAsync(); } catch (Exception e) { await new MessageDialog(e.Message).ShowAsync(); } }, valid); }
public UserControllerTests() { accountService = Mock.Create <IAccountService>(); nomenclatureService = Mock.Create <INomenclatureService>(); restApiService = Mock.Create <IRestApiService>(); roleService = Mock.Create <IRoleService>(); userMailService = Mock.Create <IUserMailService>(); userService = Mock.Create <IUserService>(); groupService = Mock.Create <IGroupService>(); userController = new UserController( Logger, Mapper, ContextManager, ResourceManager, userService, userMailService, accountService, nomenclatureService, roleService, restApiService, groupService); InitContext(); }
public HomeControllerTests() { nomenclatureService = Mock.Create <INomenclatureService>(); publicationService = Mock.Create <IPublicationService>(); adminService = Mock.Create <IAdminService>(); cacheService = Mock.Create <ICacheService>(); faqService = Mock.Create <IFaqService>(); cmsService = Mock.Create <ICmsService>(); restApiService = Mock.Create <IRestApiService>(); providerService = Mock.Create <IProviderService>(); homeController = new HomeController( Logger, Mapper, ContextManager, nomenclatureService, publicationService, adminService, cacheService, faqService, cmsService, restApiService, providerService); InitContext(); }
public MusicBrainzMetadataUpdater(IRestApiService restApiService) { _restApiService = restApiService; _restApiService.SetHeader("Accept", "application/xml"); _restApiService.SetHeader("User-Agent", UserAgent); _restApiService.SetRateLimiter(1); }
public MatchViewModel(NavigationService navigationService, IRestApiService apiService) { _navigationService = navigationService ?? throw new NullReferenceException();; _apiService = apiService ?? throw new NullReferenceException(); var cont = App.Container.Resolve <ApplicationDataContainer>(); var valid = this.WhenAnyValue(x => x.Error404, (q) => q == true); LikeCommand = ReactiveCommand.CreateFromTask(async() => { try { await _apiService.Liked(_id, cont.Values["AuthToken"] as string); await GetNewPersone(); } catch (Exception e) { await new MessageDialog(e.Message).ShowAsync(); } }); PassCommand = ReactiveCommand.CreateFromTask(async() => { try { await _apiService.Liked(_id, cont.Values["AuthToken"] as string); await GetNewPersone(); } catch (Exception e) { await new MessageDialog(e.Message).ShowAsync(); } }); SaveSettingCommand = ReactiveCommand.CreateFromTask(async() => { try { await _apiService.SetSearchParameters(new SearchParameterDto { }, cont.Values["AuthToken"] as string); await GetNewPersone(); } catch (Exception e) { await new MessageDialog(e.Message).ShowAsync(); } }); LocationCommand = ReactiveCommand.CreateFromTask(async() => { try { var loc = App.Container.Resolve <LocationService>(); await loc.GetAccess(); } catch (Exception) { } }); }
public DashboardViewModel(IConnectionService connectionService, IDialogService dialogService, IPhotoService photoService, IProgressDialogService progressDialogService, IRestApiService restApiService) { _connectionService = connectionService; _dialogService = dialogService; _photoService = photoService; _progressDialogService = progressDialogService; _restApiService = restApiService; }
public RestApiDemo(IRestApiService service) { InitializeComponent(); this._service = service; VehiclesGrid.ItemsSource = this.List; this.List.CollectionChanged += List_CollectionChanged; }
public void SetUp() { var client = new HttpClient { BaseAddress = new Uri(ApiBaseAddress), Timeout = TimeSpan.FromMinutes(1), }; _apiService = RestService.For <IRestApiService>(client); }
public FetchService( ILogger <FetchService> logger, IRestApiService restApiService, IOptions <CubicWeightSettings> settings) { _logger = logger; _restApiService = restApiService; _settings = settings.Value; }
public void Init(string apiBaseAddress, string accessToken) { _apiService = RestService.For <IRestApiService>(new HttpClient(new HttpLoggingHandler()) { BaseAddress = new Uri(apiBaseAddress), Timeout = TimeSpan.FromMinutes(1) }); _accessToken = accessToken; }
public FetchService( ILogger <FetchService> logger, IExceptionFactory exceptionFactory, IRestApiService restApiService, IOptions <JsonConsumerSettings> settings) { _logger = logger; _exceptionFactory = exceptionFactory; _restApiService = restApiService; _settings = settings.Value; }
public GroupsViewController( ILogger logger, IMapper mapper, IDbContextManager contextManager, IGroupService groupService, IRestApiService restApiService) : base(logger, mapper, contextManager) { this.groupService = groupService; this.restApiService = restApiService; }
public GroupController( ILogger logger, IMapper mapper, IDbContextManager contextManager, IResourceManager resource, IRestApiService restApiService, IGroupService groupService) : base(logger, mapper, contextManager, resource, Resource.Organizations) { this.restApiService = restApiService; this.groupService = groupService; }
public static Task HandleHttpRequest(this IRestApiService restApiService, HttpContext context, string protocolName) { if (restApiService.TryGetHandlerProtocol <IHttpMessageProtocolInterface>( context.Request.Path, protocolName, out IHttpMessageProtocolInterface protocol)) { return(protocol.HandleRequest(context)); } context.Response.StatusCode = (int)HttpStatusCode.NotFound; return(Task.CompletedTask); }
public SettingViewModel(NavigationService navigationService, IRestApiService apiService) { _navigationService = navigationService ?? throw new NullReferenceException(); _apiService = apiService ?? throw new NullReferenceException(); var container = App.Container.Resolve <ApplicationDataContainer>(); LogoutCommand = ReactiveCommand.Create(() => { container.Values["AuthToken"] = null; _navigationService.Navigate_App(typeof(Auth)); }); }
public AuthenticationProvider( IMapper mapper, IDbContextManager contextManager, IAccountService accountService, IUserService userService, IRestApiService restApiService, ILogger logger) { this.mapper = mapper; this.contextManager = contextManager; this.accountService = accountService; this.userService = userService; this.restApiService = restApiService; this.logger = logger; }
public AuthorControllerBaseTest() { Mock <IUrlHelper> mockUrlHelper = SetUpMockUrlHelper(); ControllerContext controllerContext = SetUpControllerContext(); SetUpMapper(); _restApiService = restApiServiceMoq.Object; _authorsController = new AuthorsController(_restApiService, _mapper) { ControllerContext = controllerContext, Url = mockUrlHelper.Object }; }
public FileDeliveryJob( IDeliveryJobRepository deliveryJobRepository, IExtractFileService extractFileService, IRestApiService restApiService) { var jobInterval = ConfigurationManager.AppSettings["job:FileDeliveryJobInterval"]; if (string.IsNullOrEmpty(jobInterval)) { throw new ConfigurationErrorsException("Please add 'job:FileDeliveryJobInterval' settigns to .config file."); } JobInterval = int.Parse(jobInterval); _deliveryJobRepo = deliveryJobRepository; _extractFileService = extractFileService; _restApiService = restApiService; }
public AccountController( ILogger logger, IMapper mapper, IDbContextManager contextManager, IAccountService accountService, IAuthenticationProvider authenticationProvider, IUserService userService, IUserMailService userMailService, ICaptchaService captchaService, IRestApiService restApiService) : base(logger, mapper, contextManager) { this.accountService = accountService; this.authenticationProvider = authenticationProvider; this.userService = userService; this.userMailService = userMailService; this.captchaService = captchaService; this.restApiService = restApiService; }
public TemperatureMonitorViewModel( IRestApiService restApiService, ITemperatureSensorService temperatureSensorService, ITableStorageService tableStorageService) { _restApiService = restApiService; _temperatureSensorService = temperatureSensorService; _tableStorageService = tableStorageService; _cancellationTokenSource = new CancellationTokenSource(); IsLoading = true; Summary = new ObservableCollection <SensorData>(); Date = DateTime.Now; RefreshCommand = new Command(async() => await RefreshAsync()); NextDateCommand = new Command(async() => await NextDateAsync()); PreviousDateCommand = new Command(async() => await PreviousDateAsync()); }
public AccountControllerTests() { accountService = Mock.Create <IAccountService>(); authenticationProvider = Mock.Create <IAuthenticationProvider>(); captchaService = Mock.Create <ICaptchaService>(); restApiService = Mock.Create <IRestApiService>(); userMailService = Mock.Create <IUserMailService>(); userService = Mock.Create <IUserService>(); accountController = new AccountController( Logger, Mapper, ContextManager, accountService, authenticationProvider, userService, userMailService, captchaService, restApiService); InitContext(); }
public RegisterViewModel(NavigationService navigationService, IRestApiService apiService) { _navigationService = navigationService ?? throw new NullReferenceException(); _apiService = apiService ?? throw new NullReferenceException(); var valid = this.WhenAnyValue( x => x.Email, x => x.Password, x => x.Name, x => x.DateOfBirth, x => x.Gender, (email, password, name, date, gender) => new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$").IsMatch(email) && new Regex(@"([a-zA-Z0-9]{6,})").IsMatch(password) && new Regex(@"([a-z]{1,})").IsMatch(password) && new Regex(@"([A-Z]{1,})").IsMatch(password) && new Regex(@"([0-9]{1,})").IsMatch(password) && new Regex(@"([a-zA-Z]{2,})").IsMatch(name) && gender is Gender ); RegisterCommand = ReactiveCommand.CreateFromTask(async() => { var gender = this.Gender == SharedLibrary.Models.Gender.Male ? SharedLibrary.Models.Gender.Male : SharedLibrary.Models.Gender.Female; var dto = new RegisterDto { Email = this.Email, Name = this.Name, Password = this.Password, Gender = gender, DateOfBirth = this.DateOfBirth.DateTime }; try { var res = await _apiService.Register(dto); if (res.Succeeded == true) { var container = App.Container.Resolve <ApplicationDataContainer>(); container.Values["AuthToken"] = "Bearer " + res.AuthToken; _navigationService.Navigate_App(typeof(MainPageView)); return; } await new MessageDialog($"Error: {res.Error}").ShowAsync(); } catch (Exception e) { await new MessageDialog($"Error: {e.Message}").ShowAsync(); } }, valid); }
public UserController( ILogger logger, IMapper mapper, IDbContextManager contextManager, IResourceManager resource, IUserService userService, IUserMailService userMailService, IAccountService accountService, INomenclatureService nomenclatureService, IRoleService roleService, IRestApiService restApiService, IGroupService groupService) : base(logger, mapper, contextManager, resource, Resource.Users) { this.userService = userService; this.userMailService = userMailService; this.accountService = accountService; this.nomenclatureService = nomenclatureService; this.roleService = roleService; this.restApiService = restApiService; this.groupService = groupService; }
public HomeController( ILogger logger, IMapper mapper, IDbContextManager contextManager, INomenclatureService nomenclatureService, IPublicationService publicationService, IAdminService adminService, ICacheService cacheService, IFaqService faqService, ICmsService cmsService, IRestApiService restApiService, IProviderService providerService) : base(logger, mapper, contextManager) { this.nomenclatureService = nomenclatureService; this.publicationService = publicationService; this.adminService = adminService; this.cacheService = cacheService; this.faqService = faqService; this.cmsService = cmsService; this.restApiService = restApiService; this.providerService = providerService; }
public BusLocationManager(IRestApiService restApiService) { _restApiService = restApiService; }
public ThetvdbTvShowMetadataUpdater(IRestApiService restApiService) { _restApiService = restApiService; }
public PhotoProvider(SortModel sort) { _restService = Mvx.IoCProvider.Resolve <IRestApiService>(); _photoService = Mvx.IoCProvider.Resolve <IPhotoService>(); }
public MainPageViewModel(NavigationService navigationService, IRestApiService apiService) { _navigationService = navigationService ?? throw new NullReferenceException(); _apiService = apiService ?? throw new NullReferenceException(); }
/// <summary> /// Initializes a new instance of the <see cref="ImdbMovieSynopsisService"/> class. /// </summary> /// <param name="restApiService">IMDB API service.</param> public ImdbMovieSynopsisService(IRestApiService restApiService) { _restApiService = restApiService; }
public ProfileViewModel(NavigationService navigationService, IRestApiService apiService) { _navigationService = navigationService ?? throw new NullReferenceException(); _apiService = apiService ?? throw new NullReferenceException(); SaveCommand = ReactiveCommand.CreateFromTask(async() => { try { var cont = App.Container.Resolve <ApplicationDataContainer>(); var ret = await _apiService.SetProfileData(new UserDataSettingsDto { Description = this.Description, Job = this.Job, School = this.School }, cont.Values["AuthToken"] as string); Description = ret.Description; Job = ret.Job; School = ret.School; } catch (Exception e) { await new MessageDialog(e.Message).ShowAsync(); } }); DeleteCommand = ReactiveCommand.CreateFromTask(async() => { try { if (SelectedImage == null) { return; } var cont = App.Container.Resolve <ApplicationDataContainer>(); var ret = await _apiService.DeletePhoto(SelectedImage.Id, cont.Values["AuthToken"] as string); SelectedImage = null; var list = new SourceList <PhotoDto>(); list.AddRange(ret); Photos = list; SetMainImage(ret); } catch (Exception e) { await new MessageDialog(e.Message).ShowAsync(); } }); SetMainCommand = ReactiveCommand.CreateFromTask(async() => { try { if (SelectedImage == null) { return; } var cont = App.Container.Resolve <ApplicationDataContainer>(); var ret = await _apiService.SetMainPhoto(SelectedImage.Id, cont.Values["AuthToken"] as string); var list = new SourceList <PhotoDto>(); list.AddRange(ret); Photos = list; SetMainImage(ret); } catch (Exception e) { await new MessageDialog(e.Message).ShowAsync(); } }); }
public FanartTvMusicImageUpdater(IRestApiService restApiService) { _restApiService = restApiService; }
/// <summary> /// Initializes a new instance of the <see cref="ThemoviedbMovieMetadataUpdater"/> class. /// </summary> /// <param name="restApiService">The rest API service.</param> public ThemoviedbMovieMetadataUpdater(IRestApiService restApiService) { _restApiService = restApiService; }
public ImdbMovieSynopsisServiceTests() { _restApiService = Substitute.For<IRestApiService>(); _service = new ImdbMovieSynopsisService(_restApiService); }