public MyProfileEditViewModel(IDataStore store = null, IDataLoader loader = null, IDataUploader uploader = null)
 {
     DataStore    = store;
     DataLoader   = loader;
     DataUploader = uploader;
     Title        = "Edit My Profile";
 }
Пример #2
0
 public App(ILogger <App> logger, IS3Repository s3Repository, IDataConverter dataConverterService, IDataUploader dataUploader)
 {
     _logger               = logger ?? throw new ArgumentNullException(nameof(logger));
     _s3Repository         = s3Repository ?? throw new ArgumentNullException(nameof(s3Repository));
     _dataConverterService = dataConverterService ?? throw new ArgumentNullException(nameof(dataConverterService));
     _dataUploader         = dataUploader ?? throw new ArgumentNullException(nameof(dataUploader));
 }
        public async Task StartAsync()
        {
            _cts = new CancellationTokenSource();

            _taskId = UIApplication.SharedApplication.BeginBackgroundTask(OnExpiration);

            try
            {
                //if you don't run this method in an iOS "Background Task" and the user gets a phone call or does something which backgrounds the app,
                //iOS will give the app ~5 seconds (at the very most), to finish or iOS will terminate the app. BeginBackgroundTask allows the method to run for another
                //180 seconds. iOS fires off OnExpiration when the 180 is almost over and you need to cut the method off by cancelling it.

                IDataUploader dataUploader = Startup.ServiceProvider?.GetService(typeof(IDataUploader)) as IDataUploader;
                await dataUploader.StartQueuedUpdatesAsync(_cts.Token);

                //await UploadDataService.Instance.RunQueuedUpdatesAsync(_cts.Token);
            }
            catch (OperationCanceledException)
            {
            }
            finally
            {
                if (_cts.IsCancellationRequested)
                {
                    var message = new CancelledMessage();
                    Device.BeginInvokeOnMainThread(() => MessagingCenter.Send(message, "CancelledMessage"));
                }
            }

            UIApplication.SharedApplication.EndBackgroundTask(_taskId);
        }
 public DataTransferService(IContextFactoryFacade contextFactory,
                            IEqualityComparer <ContestCategoriesMapping> contestCategoryMappingComparer,
                            IEqualityComparer <ContestCategory> contestCategoriesComparer,
                            IEqualityComparer <Contest> contestComparer,
                            IEqualityComparer <ContestRange> contestRangeComparer,
                            IEqualityComparer <ContestRequest> contestRequestComparer,
                            IEqualityComparer <ContestType> contestTypeComparer,
                            IEqualityComparer <ContestTypePoints> contestTypePointsComparer,
                            IEqualityComparer <FightStructure> fightStructureComparer,
                            IEqualityComparer <Round> roundComparer,
                            IEqualityComparer <WeightAgeCategory> weightAgeCategoryComparer,
                            IEqualityComparer <ContestRing> contestRingComparer)
 {
     _contextFactory                  = contextFactory;
     _contestTypedUploader            = new ContestTypedUploader(contestTypeComparer);
     _contestRangesUploader           = new ContestRangesUploader(contestRangeComparer);
     _contestTypePointsUploader       = new ContestTypePointsUploader(contestTypePointsComparer);
     _roundsUploader                  = new RoundsUploader(roundComparer);
     _weightAgeCategoryUploader       = new WeightAgeCategoryUploader(weightAgeCategoryComparer);
     _fightStructureUploader          = new FightStructureUploader(fightStructureComparer);
     _contestCategoriesUploader       = new ContestCategoriesUploader(contestCategoriesComparer);
     _contestsUploader                = new ContestsUploader(contestComparer);
     _contestRingsUploader            = new ContestRingsUploader(contestRingComparer);
     _contestCategoryMappingsUploader = new ContestCategoryMappingsUploader(contestCategoryMappingComparer);
     _usersUploader              = new UsersUploader();
     _fightsUploader             = new FightsUploader();
     _fightJudgeMappingsUploader = new FightJudgeMappingsUploader();
     _fightPointsUploader        = new FightPointsUploader();
     _contestRequestsUploader    = new ContestRequestsUploader(contestRequestComparer);
 }
        public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
        {
            _cts = new CancellationTokenSource();

            Task.Run(async() =>
            {
                try
                {
                    IDataUploader dataUploader = Startup.ServiceProvider?.GetService(typeof(IDataUploader)) as IDataUploader;
                    await dataUploader.StartQueuedUpdatesAsync(_cts.Token);
                    //await App.Current.UploadDataService.Instance.RunQueuedUpdatesAsync(_cts.Token);
                }
                catch (System.OperationCanceledException)
                {
                    //you could log this, or not
                    Analytics.TrackEvent("System.OperationCanceledException in DroidRunQueuedUpdateService");
                }
                finally
                {
                    if (_cts.IsCancellationRequested)
                    {
                        var message = new CancelledMessage();
                        Device.BeginInvokeOnMainThread(
                            () => MessagingCenter.Send(message, "CancelledMessage")
                            );
                    }
                }
            }, _cts.Token);

            return(StartCommandResult.Sticky);
        }
 public MyFavoritesViewModel(IDataStore store = null, IDataLoader loader = null, IDataUploader uploader = null)
 {
     DataStore    = store;
     DataLoader   = loader;
     DataUploader = uploader;
     Title        = "My Favorites";
     Sessions     = new ObservableCollection <Session>();
 }
 public SessionsByTimeViewModel(IDataStore store = null, IDataLoader loader = null, IDataUploader uploader = null)
 {
     DataStore      = store;
     DataLoader     = loader;
     DataUploader   = uploader;
     Title          = "Sessions By Time";
     SessionsByTime = new ObservableCollection <Grouping <string, Session> >();
 }
 public FeedbackViewModel(IDataStore store = null, IDataLoader loader = null, IDataUploader uploader = null)
 {
     DataStore        = store;
     DataLoader       = loader;
     DataUploader     = uploader;
     Title            = "Feedback";
     FeedbackTypeList = new ObservableCollection <FeedbackType>();
 }
 public TestController(IDataUploader dataUploader, GarbageCollectorContext garbageCollectorContext)
 {
     _dataUploader = dataUploader;
     this.garbageCollectorContext = garbageCollectorContext;
 }
 public DataTrackVehicleService(IDataUploader uploader)
 {
     _uploader = uploader;
     appPath   = Startup._APPLICATION_PATH;
 }