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)
            {
            }
        }
예제 #3
0
 /// <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;
 }
예제 #4
0
 /// <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;
 }
예제 #5
0
        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;
        }
예제 #6
0
 public DocumentsService(
     IDeletableEntityRepository <Document> documentRepository,
     IFileDownloadService fileDownloadService,
     Cloudinary cloudinary)
 {
     this.documentRepository  = documentRepository;
     this.fileDownloadService = fileDownloadService;
     this.cloudinary          = cloudinary;
 }
예제 #7
0
 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;
 }
예제 #8
0
 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;
 }
예제 #9
0
 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;
 }
예제 #10
0
 public PreviewInvoice()
 {
     ObjectFactory.Initialize(fac =>
     {
         fac.UseDefaultStructureMapConfigFile = false;
         fac.AddRegistry <RequestRegistry>();
     });
     _downloadService = ObjectFactory.GetInstance <IFileDownloadService>();
 }
예제 #11
0
        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;
        }
예제 #12
0
 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;
 }
예제 #13
0
        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";
        }
예제 #14
0
        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);
            }
        }
예제 #15
0
 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();
            }
        }
예제 #18
0
 public InstallerHelper(IFileDownloadService fileDownloadService)
 {
     _fileDownloadService = fileDownloadService;
 }
예제 #19
0
 public DMA10AnalyzerService(IWatchListRepository watchListRepository, IFileDownloadService fileDownloadService, IStockPriceDataRepository stockPriceDataRepository)
 {
     this.watchListRepository      = watchListRepository;
     this.fileDownloadService      = fileDownloadService;
     this.stockPriceDataRepository = stockPriceDataRepository;
 }
예제 #20
0
 public DMA10AnalyzerService()
 {
     this.watchListRepository      = new WatchListRepository();
     this.fileDownloadService      = new FileDownloadService();
     this.stockPriceDataRepository = new StockPriceDataRepository();
 }
예제 #21
0
 public PreviewInvoice(IFileDownloadService fileDownloadService)
 {
     _downloadService = fileDownloadService;
 }
예제 #22
0
 public PodcastService(IFeedParaseService feedParser, IPodcastStore<Podcast> storageService, IFileDownloadService fileDownloadManager)
 {
     this.feedParser = feedParser;
     this.storageService = storageService;
     this.fileDownloadManager = fileDownloadManager;
 }
예제 #23
0
 public PLController(IProfitLossService profitLossService, IEmailService emailService, IFileDownloadService fileDownloadService)
 {
     this._profitLossService   = profitLossService;
     this._emailService        = emailService;
     this._fileDownloadService = fileDownloadService;
 }
예제 #24
0
 public DMA10AnalyzerService()
 {
     this.watchListRepository = new WatchListRepository();
     this.fileDownloadService = new FileDownloadService();
     this.stockPriceDataRepository = new StockPriceDataRepository();
 }
예제 #25
0
 public DMA10AnalyzerService(IWatchListRepository watchListRepository, IFileDownloadService fileDownloadService, IStockPriceDataRepository stockPriceDataRepository)
 {
     this.watchListRepository = watchListRepository;
     this.fileDownloadService = fileDownloadService;
     this.stockPriceDataRepository = stockPriceDataRepository;
 }
예제 #26
0
        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));
        }
예제 #27
0
 public PlanCalendarFactory(IFileDownloadService downloadService, IAppFileProvider appFileProvider)
 {
     _downloadService = downloadService;
     _fileProvider    = appFileProvider;
 }
예제 #28
0
 /// <inheritdoc/>
 public BCPProvDrugDBApp(ILogger <BCPProvDrugDBApp> logger, IPharmaCareDrugParser parser, IFileDownloadService downloadService, IConfiguration configuration, GatewayDbContext drugDBContext)
     : base(logger, parser, downloadService, configuration, drugDBContext)
 {
 }
예제 #29
0
 public BirthdayFactory(IFileDownloadService downloadService, IAppFileProvider appFileProvider)
 {
     _downloadService = downloadService;
     _fileProvider    = appFileProvider;
 }
예제 #30
0
 public PodcastService(IFeedParaseService feedParser, ILocalStorageService <Podcast> storageService, IFileDownloadService fileDownloadManager)
 {
     this.feedParser          = feedParser;
     this.storageService      = storageService;
     this.fileDownloadManager = fileDownloadManager;
 }
예제 #31
0
        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;
		}
예제 #32
0
        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;
            }
        }
예제 #33
0
 /// <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)
 {
 }
예제 #34
0
 public FilesOperationService(IContextService contextService, IFileDownloadService fileDownloadService)
 {
     _contextService = contextService;
     _fileDownloadService = fileDownloadService;
 }