コード例 #1
0
        private void RunBackgroundThread(StatsFetchingService fetchingService)
        {
            this.cancellationTokenSource = new CancellationTokenSource();

            this.backgroundThread = Task.Factory
                                    .StartNew(
                () => FetchFortniteStats(fetchingService, this.cancellationTokenSource.Token),
                this.cancellationTokenSource.Token
                );
        }
コード例 #2
0
        private void FetchFortniteStats(StatsFetchingService fetchingService, CancellationToken cancellationToken)
        {
            while (true)
            {
                cancellationToken.ThrowIfCancellationRequested();

                var stats = fetchingService.GetStats();

                this.OnStatsUpdated(stats);
            }
        }
コード例 #3
0
 public void Start(StatsFetchingService fetchingService)
 {
     this.RunBackgroundThread(fetchingService);
 }