public DaemonTask(StravaService stravaService, AthleteRepository athleteRepository, SlackService slackService, MessageFactory messageFactory, ILogger <TimedBackgroundWorker> logger) { _stravaService = stravaService; _athleteRepository = athleteRepository; _slackService = slackService; _messageFactory = messageFactory; _logger = logger; }
protected async override Task OnInitializedAsync() { await EnsureAuthenticatedAsync(); Console.WriteLine($"{DateTime.Now} Initialized Activities"); UserActivities = (await StravaService.GetAllActivities(StartDate, EndDate)).ToList(); CalculateStatistics(); InitializeCharts(); }
public MainViewModel(StravaService stravaService) { _stravaService = stravaService; _cachingService = _activities.CachingService = new CachingService(_stravaService); var loader = _activities.CachedItems.Connect() .Sort(_comparer) .ObserveOnDispatcher() .Bind(_activities) .Subscribe(); }
public MainPage() { this.InitializeComponent(); _stravaService = new StravaService(); _loginService = new LoginService(_stravaService); DataContext = new MainViewModel(_stravaService); var storageHelper = new LocalObjectStorageHelper(); if (storageHelper.KeyExists(StorageKeys.ACCESSTOKEN)) { _stravaService.AccessToken = storageHelper.Read <string>(StorageKeys.ACCESSTOKEN); } }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected async override void OnLaunched(LaunchActivatedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } var storageHelper = new LocalObjectStorageHelper(); if (!storageHelper.KeyExists(StorageKeys.ACCESSTOKEN)) { var stravaService = new StravaService(); var loginService = new LoginService(stravaService); await loginService.Login(); } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); } }
public void OnDateRangeSelect(DateRange dateRange) { Task.Run(async() => { UserActivities = (await StravaService.GetAllActivities(StartDate, EndDate)).ToList(); CalculateStatistics(); var activityGroupsByType = UserActivities.GroupBy(a => a.Type); Dictionary <string, int> activityTypesWithCount = activityGroupsByType.ToDictionary(group => group.Key.ToString(), group => group.Count()); Dictionary <string, float> activityTypesWithDistances = activityGroupsByType.ToDictionary(group => group.Key.ToString(), group => group.Sum(a => a.Distance)); Dictionary <string, float> activityTypesWithDuration = activityGroupsByType.ToDictionary(group => group.Key.ToString(), group => group.Sum(a => a.MovingTime)); ChartService.UpdatePieChartData(_countChart, _countChartConfig, new SortedDictionary <string, int>(activityTypesWithCount)); ChartService.UpdatePieChartData(_distanceChart, _distanceChartConfig, new SortedDictionary <string, float>(activityTypesWithDistances)); ChartService.UpdatePieChartData(_durationChart, _durationChartConfig, new SortedDictionary <string, float>(activityTypesWithDuration)); StateHasChanged(); }); }
public HomeController(StravaService stravaService, SlackSettings slackSettings) { _stravaService = stravaService; _slackSettings = slackSettings; }
public CachingService(StravaService stravaService) { _stravaService = stravaService; }
public StravaController(StravaService stravaService) { _stravaService = stravaService; }
public LoginService(StravaService stravaService) { _stravaService = stravaService; }