public S3FileProducer(IConfigurationRoot config, ILogger <S3FileProducer> logger, IRemoteEndpointService s3Service, ILocalCacheService localCacheService)
 {
     _config            = config;
     _logger            = logger;
     _s3Service         = s3Service;
     _localCacheService = localCacheService;
 }
 public DeltaFileConsumer(IConfigurationRoot config, ILogger <DeltaFileConsumer> logger,
                          IDatabaseService dbService, ILocalCacheService localCacheService)
 {
     _config              = config;
     _logger              = logger;
     _dbService           = dbService;
     _localCacheService   = localCacheService;
     _databaseMappingList = _config.GetSection("DatabaseMapping").Get <DatabaseMappingObject[]>().ToList();
 }
 public FullLoadFileConsumer(IConfigurationRoot config, ILogger <FullLoadFileConsumer> logger,
                             IDatabaseService dbService, ILocalCacheService localCacheService)
 {
     _config = config;
     _logger = logger;
     _parallelFullLoadStreams = _config.GetValue <int>("ParallelFullLoadStreams");
     _dbService           = dbService;
     _localCacheService   = localCacheService;
     _databaseMappingList = _config.GetSection("DatabaseMapping").Get <DatabaseMappingObject[]>().ToList();
 }
예제 #4
0
 public WindowsRemoteManagerGeneral(
     ICommunicator communicator,
     ILocalLogger logger,
     ILocalCacheService cacheService
     )
 {
     this.Communicator      = communicator;
     this.LocalCacheService = cacheService;
     this.Logger            = logger;
 }
예제 #5
0
파일: App.xaml.cs 프로젝트: DL444/ucqu-ng
        public async Task SignOutAsync()
        {
            if (Window.Current.Content is Frame rootFrame)
            {
                ICredentialService credentialService = Services.GetService <ICredentialService>();
                ILocalCacheService cacheService      = Services.GetService <ILocalCacheService>();
                credentialService.ClearCredential();
                await cacheService.ClearCacheAsync();

                rootFrame.Navigate(typeof(Pages.SignInPage), null, new DrillInNavigationTransitionInfo());
                Analytics.TrackEvent("User signed out");
            }
        }
예제 #6
0
        public MainPage()
        {
            this.InitializeComponent();
            Analytics.TrackEvent("Initialize main page");
            IDataService       localDataService  = Application.Current.GetService <IDataService>(x => x.DataSource == DataSource.LocalCache);
            IDataService       remoteDataService = Application.Current.GetService <IDataService>(x => x.DataSource == DataSource.Online);
            ILocalCacheService cacheService      = Application.Current.GetService <ILocalCacheService>();

            NavigationView.SelectedItem = NavigationView.MenuItems.First();

            StudentInfoViewModel = new DataViewModel <StudentInfo, StudentInfoViewModel>(
                defaultValue: new StudentInfoViewModel(),
                viewModelTransform: x => new StudentInfoViewModel(x),
                localFetchFunc: () => localDataService.GetStudentInfoAsync(),
                remoteFetchFunc: () => remoteDataService.GetStudentInfoAsync(),
                cacheUpdateFunc: x => cacheService.SetStudentInfoAsync(x)
                );

            WellknownDataViewModel = new DataViewModel <WellknownData, WellknownDataViewModel>(
                defaultValue: new WellknownDataViewModel(new WellknownData()
            {
                TermStartDate = DateTimeOffset.UtcNow.Date,
                TermEndDate   = DateTimeOffset.UtcNow.Date.AddDays(1)
            }),
                viewModelTransform: x => new WellknownDataViewModel(x),
                localFetchFunc: () => localDataService.GetWellknownDataAsync(),
                remoteFetchFunc: () => remoteDataService.GetWellknownDataAsync(),
                cacheUpdateFunc: x => cacheService.SetWellknownDataAsync(x),
                shouldFetchRemote: x => DateTimeOffset.UtcNow > x.TermEndDate,
                remoteRequiresAuth: false
                );

            ExamsViewModel = new DataViewModel <ExamSchedule, ExamScheduleViewModel>(
                defaultValue: new ExamScheduleViewModel(),
                viewModelTransform: x => new ExamScheduleViewModel(x, WellknownDataViewModel.Value.Model),
                localFetchFunc: () => localDataService.GetExamsAsync(),
                remoteFetchFunc: () => remoteDataService.GetExamsAsync(),
                cacheUpdateFunc: x => cacheService.SetExamsAsync(x),
                shouldFetchRemote: _ => DateTimeOffset.UtcNow < WellknownDataViewModel.Value.Model.TermEndDate
                );

            ScheduleViewModel = new DataViewModel <Schedule, ScheduleViewModel>(
                new ScheduleViewModel(),
                x => new ScheduleViewModel(x, WellknownDataViewModel.Value.Model),
                () => localDataService.GetScheduleAsync(),
                () => remoteDataService.GetScheduleAsync(),
                x => cacheService.SetScheduleAsync(x),
                _ => DateTimeOffset.UtcNow < WellknownDataViewModel.Value.Model.TermEndDate
                );
        }
예제 #7
0
파일: App.xaml.cs 프로젝트: DL444/ucqu-ng
        private async Task PerformAppMaintenanceAsync()
        {
            IDataService       backendService = this.GetService <IDataService>(x => x.DataSource == DataSource.Online);
            ILocalCacheService cacheService   = Services.GetService <ILocalCacheService>();
            Task <DataRequestResult <WellknownData> > wellknownTask = backendService.GetWellknownDataAsync();

            try
            {
                DataRequestResult <StudentInfo> studentInfo = await backendService.GetStudentInfoAsync();

                await cacheService.SetStudentInfoAsync(studentInfo.Resource);
            }
            catch (BackendRequestFailedException ex)
            {
                Crashes.TrackError(ex);
                return;
            }
            catch (LocalCacheRequestFailedException ex)
            {
                Crashes.TrackError(ex);
            }

            Task <DataRequestResult <Schedule> >     scheduleTask         = backendService.GetScheduleAsync();
            Task <DataRequestResult <ExamSchedule> > examsTask            = backendService.GetExamsAsync();
            Task <DataRequestResult <ScoreSet> >     majorScoreTask       = backendService.GetScoreAsync(false);
            Task <DataRequestResult <ScoreSet> >     secondMajorScoreTask = backendService.GetScoreAsync(true);

            try
            {
                DataRequestResult <WellknownData> wellknown = await wellknownTask;
                await cacheService.SetWellknownDataAsync(wellknown.Resource);
            }
            catch (Exception ex) when(ex is BackendRequestFailedException || ex is LocalCacheRequestFailedException)
            {
                Crashes.TrackError(ex);
            }

            try
            {
                DataRequestResult <Schedule> schedule = await scheduleTask;
                await cacheService.SetScheduleAsync(schedule.Resource);
            }
            catch (Exception ex) when(ex is BackendRequestFailedException || ex is LocalCacheRequestFailedException)
            {
                Crashes.TrackError(ex);
            }

            try
            {
                DataRequestResult <ExamSchedule> exams = await examsTask;
                await cacheService.SetExamsAsync(exams.Resource);
            }
            catch (Exception ex) when(ex is BackendRequestFailedException || ex is LocalCacheRequestFailedException)
            {
                Crashes.TrackError(ex);
            }

            try
            {
                DataRequestResult <ScoreSet> majorScore = await majorScoreTask;
                await cacheService.SetScoreAsync(majorScore.Resource);
            }
            catch (Exception ex) when(ex is BackendRequestFailedException || ex is LocalCacheRequestFailedException)
            {
                Crashes.TrackError(ex);
            }

            try
            {
                DataRequestResult <ScoreSet> secondMajorScore = await secondMajorScoreTask;
                await cacheService.SetScoreAsync(secondMajorScore.Resource);
            }
            catch (Exception ex) when(ex is BackendRequestFailedException || ex is LocalCacheRequestFailedException)
            {
                Crashes.TrackError(ex);
            }
        }
예제 #8
0
 public RemoteManagerMaster(ICommunicator communicator, ILocalLogger logger, ILocalCacheService cacheService)
     : base(communicator, logger, cacheService)
 {
     //this.UserInteractor = userInteractor;
 }
예제 #9
0
 public WindowsRemoteManagerExecutive(string id, string baseFolder, ICommunicator communicator, ILocalLogger logger, ILocalCacheService cacheService)
     : base(communicator, logger, cacheService)
 {
     this.ID         = id;
     this.BaseFolder = baseFolder;
 }
예제 #10
0
 public ImageService(ILocalCacheService localCacheService)
 {
     _localCacheService = localCacheService ??
                          throw new ArgumentNullException(nameof(localCacheService));
 }