public void DownloadCSV_ReturnsTrue_GivenSuccessfulDownload() { _downloaderService = new FileDownloadService(); var result = _downloaderService.DownloadCSV(); Assert.IsTrue(result); }
private async void Init() { try { _helper = DependencyService.Get <IHelper>(); _fileDownloadService = DependencyService.Get <IFileDownloadService>(); await App.Configuration.InitialAsync(this); NavigationPage.SetHasNavigationBar(this, false); BindingContext = _model; if (await _model.LoadPageAsync()) { var fullPath = _helper.GetFilePath(_model.FileUri, FileType.Document); if (await _fileDownloadService.DownloadFileAsync(fullPath, _model.FileUri)) { stackLayoutContent.Children.Add(new CustomWebView() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Uri = _model.FileUri }); await RemoveFile(); } } } catch (Exception) { } }
/// <summary> /// Initializes a new instance of the <see cref="BaseDrugApp{T}"/> class. /// </summary> /// <param name="logger">The logger.</param> /// <param name="parser">The file parser.</param> /// <param name="downloadService">The download utility.</param> /// <param name="configuration">The IConfiguration to use.</param> /// <param name="drugDBContext">The database context to interact with./</param> public BaseDrugApp(ILogger logger, T parser, IFileDownloadService downloadService, IConfiguration configuration, GatewayDbContext drugDBContext) { this.logger = logger; this.parser = parser; this.downloadService = downloadService; this.configuration = configuration; this.drugDbContext = drugDBContext; }
/// <summary> /// Initializes a new instance of the <see cref="BaseDrugApp{T}"/> class. /// </summary> /// <param name="logger">The logger.</param> /// <param name="parser">The file parser.</param> /// <param name="downloadService">The download utility.</param> /// <param name="configuration">The IConfiguration to use.</param> /// <param name="drugDBContext">The database context to interact with.</param> protected BaseDrugApp(ILogger logger, T parser, IFileDownloadService downloadService, IConfiguration configuration, GatewayDbContext drugDBContext) { this.Logger = logger; this.Parser = parser; this.DownloadService = downloadService; this.Configuration = configuration; this.DrugDbContext = drugDBContext; }
public EpisodeViewModel(Episode episode) { this.fileDownloadService = ServiceLocator.Current.GetInstance<IFileDownloadService>(); this.messageDialogService = ServiceLocator.Current.GetInstance<IMessageDialogService>(); this.DownloadCommand = new RelayCommand(() => DownloadEpisodeAsync(), CanDownloadEpisode); this.PlayCommand = new RelayCommand(PlayEpisode, CanPlayEpisode); this.Episode = episode; }
public DocumentsService( IDeletableEntityRepository <Document> documentRepository, IFileDownloadService fileDownloadService, Cloudinary cloudinary) { this.documentRepository = documentRepository; this.fileDownloadService = fileDownloadService; this.cloudinary = cloudinary; }
public BookProvider(ISessionAwareConnection awareConnection, IDataCacheService dataCacheService, IFileCacheService fileCacheService, IDeviceInfoService deviceInfoService, IFileDownloadService fileDownloadService, ISessionEstablisherService sessionEstablisherService) { _fileCacheService = fileCacheService; _dataCacheService = dataCacheService; _awareConnection = awareConnection; _deviceInfoService = deviceInfoService; _fileDownloadService = fileDownloadService; _sessionEstablisherService = sessionEstablisherService; }
public FileUploadService(IRepository <File> fileRepository, IRepository <FileBinary> fileBinaryRepository, IAppFileProvider fileProvider, IFileDownloadService downloadService, IHttpContextAccessor httpContextAccessor, ISettingsService iSettingsService) { _fileRepository = fileRepository; _fileBinaryRepository = fileBinaryRepository; _fileProvider = fileProvider; _downloadService = downloadService; _httpContextAccessor = httpContextAccessor; _iSettingsService = iSettingsService; }
public PictureService(IFileDownloadService downloadService, IHttpContextAccessor httpContextAccessor, IAppFileProvider fileProvider, IRepository <Picture> pictureRepository, IRepository <FileBinary> pictureBinaryRepository, ISettingsService settingService) { _downloadService = downloadService; _httpContextAccessor = httpContextAccessor; _fileProvider = fileProvider; _pictureRepository = pictureRepository; _pictureBinaryRepository = pictureBinaryRepository; _settingService = settingService; }
public PreviewInvoice() { ObjectFactory.Initialize(fac => { fac.UseDefaultStructureMapConfigFile = false; fac.AddRegistry <RequestRegistry>(); }); _downloadService = ObjectFactory.GetInstance <IFileDownloadService>(); }
public EpisodeViewModel(Episode episode) { this.fileDownloadService = ServiceLocator.Current.GetInstance <IFileDownloadService>(); this.messageDialogService = ServiceLocator.Current.GetInstance <IMessageDialogService>(); this.DownloadCommand = new RelayCommand(async() => await DownloadEpisodeAsync(), CanDownloadEpisode); this.PlayCommand = new RelayCommand(PlayEpisode, CanPlayEpisode); this.Episode = episode; }
public MainModel(ILogger <HomeController> logger, INewsService newsService, IFileDownloadService downloadService, IFileUploadService uploadService, ISettingsService settingsService, IMenuService menuService) { _logger = logger; _newsService = newsService; _downloadService = downloadService; _uploadService = uploadService; _settingsService = settingsService; _menuService = menuService; }
public MainPageViewModel(INavigationService navigationService, IFileDownloadService fileAccessService, IImageService detectService) : base(navigationService) { this.Title = "View Jpeg2000"; this._FileDownloadService = fileAccessService; this._ImageService = detectService; this._ShowImageCommand = new Lazy <DelegateCommand>(this.ShowImageCommandFactory); this.Url = "https://github.com/takuya-takeuchi/OpenJpegDotNet/blob/main/test/OpenJpegDotNet.Tests/TestImages/Bretagne1_0.j2k?raw=true"; }
private async Task CreateFileDownloadServiceAndPerformAction( Func <IFileDownloadService, Task> fileDownloadServiceAction) { IFileDownloadService fileDownloadService = null; try { fileDownloadService = WindsorContainer.Instance.Resolve <IFileDownloadService>(); Task task = fileDownloadServiceAction?.Invoke(fileDownloadService) ?? Task.CompletedTask; await task; } finally { WindsorContainer.Instance.Release(fileDownloadService); } }
public MainModel( INewsService newsService, IFileDownloadService downloadService, ISettingsService settingsService, IMenuService menuService, IUsersService usersService, PinNewsService pinNewsService, IAppFileProvider fileProvider, IPermissionService permissionService, IPictureService pictureService) { _newsService = newsService; _downloadService = downloadService; _settingsService = settingsService; _menuService = menuService; _usersService = usersService; _pinNewsService = pinNewsService; _fileProvider = fileProvider; _permissionService = permissionService; _pictureService = pictureService; }
public sealed override async void Init(object obj = null) { _helper = DependencyService.Get <IHelper>(); _fileDownloadService = DependencyService.Get <IFileDownloadService>(); App.Configuration.Initial(this); NavigationPage.SetHasNavigationBar(this, false); BindingContext = model; if (await model.LoadPageAsync()) { var fullPath = _helper.GetFilePath(model.FileUri, FileType.Document); if (await _fileDownloadService.DownloadFileAsync(fullPath, model.FileUri)) { stackLayoutContent.Children.Add(new CustomWebView() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Uri = model.FileUri }); await RemoveFile(); } } }
public static async Task Main(string[] args) { IFileDownloadService service = null; try { DependencyRegistration.Register(); service = WindsorContainer.Instance.Resolve <IFileDownloadService>(); FileDownloadResult results = await service.DownloadStatsFile(); Environment.Exit(results.Success ? 0 : -1); } catch (Exception ex) { TryLogException(ex); Environment.Exit(-1); } finally { WindsorContainer.Instance.Release(service); WindsorContainer.Dispose(); LogManager.Shutdown(); } }
public InstallerHelper(IFileDownloadService fileDownloadService) { _fileDownloadService = fileDownloadService; }
public DMA10AnalyzerService(IWatchListRepository watchListRepository, IFileDownloadService fileDownloadService, IStockPriceDataRepository stockPriceDataRepository) { this.watchListRepository = watchListRepository; this.fileDownloadService = fileDownloadService; this.stockPriceDataRepository = stockPriceDataRepository; }
public DMA10AnalyzerService() { this.watchListRepository = new WatchListRepository(); this.fileDownloadService = new FileDownloadService(); this.stockPriceDataRepository = new StockPriceDataRepository(); }
public PreviewInvoice(IFileDownloadService fileDownloadService) { _downloadService = fileDownloadService; }
public PodcastService(IFeedParaseService feedParser, IPodcastStore<Podcast> storageService, IFileDownloadService fileDownloadManager) { this.feedParser = feedParser; this.storageService = storageService; this.fileDownloadManager = fileDownloadManager; }
public PLController(IProfitLossService profitLossService, IEmailService emailService, IFileDownloadService fileDownloadService) { this._profitLossService = profitLossService; this._emailService = emailService; this._fileDownloadService = fileDownloadService; }
private DocumentsService GetMockedService(IDeletableEntityRepository <Document> documentsRepository, IFileDownloadService fileDownloadService = null, Cloudinary cloudinary = null) { var mockFileDownload = fileDownloadService ?? new Mock <IFileDownloadService>().Object; var mockCloudinary = cloudinary ?? new Mock <Cloudinary>(new Account("cloudName", "key", "secret")).Object; return(new DocumentsService(documentsRepository, mockFileDownload, mockCloudinary)); }
public PlanCalendarFactory(IFileDownloadService downloadService, IAppFileProvider appFileProvider) { _downloadService = downloadService; _fileProvider = appFileProvider; }
/// <inheritdoc/> public BCPProvDrugDBApp(ILogger <BCPProvDrugDBApp> logger, IPharmaCareDrugParser parser, IFileDownloadService downloadService, IConfiguration configuration, GatewayDbContext drugDBContext) : base(logger, parser, downloadService, configuration, drugDBContext) { }
public BirthdayFactory(IFileDownloadService downloadService, IAppFileProvider appFileProvider) { _downloadService = downloadService; _fileProvider = appFileProvider; }
public PodcastService(IFeedParaseService feedParser, ILocalStorageService <Podcast> storageService, IFileDownloadService fileDownloadManager) { this.feedParser = feedParser; this.storageService = storageService; this.fileDownloadManager = fileDownloadManager; }
public CatalogProvider(ICatalitClient client, IFileDownloadService fileDownloadService, IProfileProvider profileProvider, IBookProvider bookProvider, IDataCacheService dataCacheService, INetworkAvailabilityService networkAvailabilityService, IDeviceInfoService deviceInfoService) { _client = client; _dataCacheService = dataCacheService; _fileDownloadService = fileDownloadService; _bookProvider = bookProvider; _networkAvailabilityService = networkAvailabilityService; _myBooksIds = new List<int>(); _myHistoryBooksIds = new List<int>(); _profileProvider = profileProvider; _deviceInfoService = deviceInfoService; //_expirationGuardian = expirationGuardian; }
private void Register_RegisterClicked(object sender, RoutedEventArgs e) { NetTcpBinding serviceBinding = new NetTcpBinding(SecurityMode.None); serviceBinding.ReceiveTimeout = TimeSpan.MaxValue; serviceBinding.SendTimeout = TimeSpan.MaxValue; proxy = DuplexChannelFactory<ITableService>.CreateChannel(this, serviceBinding, new EndpointAddress(Properties.Settings.Default.ServerAddress)); TcpTransportBindingElement transport = new TcpTransportBindingElement(); transport.MaxReceivedMessageSize = long.MaxValue; transport.MaxBufferSize = int.MaxValue; transport.MaxBufferPoolSize = long.MaxValue; transport.TransferMode = TransferMode.Streamed; BinaryMessageEncodingBindingElement encoder = new BinaryMessageEncodingBindingElement(); CustomBinding fileBinding = new CustomBinding(encoder, transport); fileBinding.ReceiveTimeout = TimeSpan.MaxValue; fileBinding.SendTimeout = TimeSpan.MaxValue; fileProxy = ChannelFactory<IFileDownloadService>.CreateChannel(fileBinding, new EndpointAddress(Properties.Settings.Default.FileServerAddress)); try { DateTime serverTime = proxy.GetTime(); OffsetDateTime.Difference = serverTime - DateTime.UtcNow; proxy.Register(currentUser); } catch (FaultException ex) { MessageBox.Show(ex.Message); } catch (EndpointNotFoundException) { MessageBox.Show("Could not connect to the table"); } finally { Register r = (Register)sender; r.RegisterButton.Visibility = Visibility.Visible; r.Spinner.Visibility = Visibility.Collapsed; } }
/// <summary> /// Initializes a new instance of the <see cref="FedDrugDBApp"/> class. /// </summary> /// <param name="logger">The logger to use.</param> /// <param name="parser">The parser to use.</param> /// <param name="downloadService">The Download Service Utility.</param> /// <param name="configuration">The Configuration.</param> /// <param name="drugDBContext">The database context.</param> public FedDrugDBApp(ILogger <FedDrugDBApp> logger, IDrugProductParser parser, IFileDownloadService downloadService, IConfiguration configuration, GatewayDbContext drugDBContext) : base(logger, parser, downloadService, configuration, drugDBContext) { }
public FilesOperationService(IContextService contextService, IFileDownloadService fileDownloadService) { _contextService = contextService; _fileDownloadService = fileDownloadService; }