async void LoadMyTasks(bool isUserAction = false) { if (!SettingsService.CurrentUserId.HasValue) { return; } if (!await CheckInternetConnection(false)) { return; } // AddOperation(); var user = await new StorageService().Find <AsanaUser>(SettingsService.CurrentUserId.Value); if (user != null) { var dataService = new LoadDataService(false, 0); foreach (var availableWorkspace in user.GetAvailableWorkspaces()) { await dataService.LoadUserTasks(user.id, availableWorkspace); } await LoadTasksFromDb(true); // RemoveOperation(); } else { //TODO: how to handle? } }
public void GetCinemaTest_return_cinema_if_provided_correct_id() { //given var loadMoviesService = new LoadDataService(); var sut = new CinemaService(loadMoviesService); //when var result = sut.GetCinema(3); //then Assert.IsNotNull(result); }
public void GetCinemasTest_return_collection_of_cinema() { //given var loadMoviesService = new LoadDataService(); var sut = new CinemaService(loadMoviesService); //when var result = sut.GetCinemas(); //then Assert.IsNotNull(result); }
async Task LoadProjects(bool isUserAction = false) { if (!await CheckInternetConnection(false)) { return; } // AddOperation(); await new LoadDataService(isUserAction).LoadWorkspaceProjects(Id, false); await LoadProjectsFromDb(); //RemoveOperation(); if (NavigationEventArgs.NavigationMode != NavigationMode.Back || isUserAction) { var projects = Projects; var dataService = new LoadDataService(isUserAction); foreach (var asanaProject in projects) { await dataService.LoadProjectTasks(Id, asanaProject.id, false); var id = asanaProject.id; var project = Projects.FirstOrDefault(x => x.id == id); if (project != null) { var tasksCount = await SetProjectInfo(project); Dispatcher.RunAsync(() => { project.TasksCount = tasksCount.Item1; project.OverdueTasksCount = tasksCount.Item2; }); } } } }
/// <summary> /// Agent that runs a scheduled task /// </summary> /// <param name="task"> /// The invoked task /// </param> /// <remarks> /// This method is called when a periodic or resource intensive task is invoked /// </remarks> protected override async void OnInvoke(ScheduledTask task) { Debug.WriteLine("OnInvoke"); if (!AsanaStateService.IsSetAuthToken && !AsanaStateService.IsSetApiKey) { Debug.WriteLine("Complete - no auth"); NotifyComplete(); return; } var response = await new AsanaRespository().GetWorkspaces(); if (!AsanaClient.ProcessResponse(response, true)) { Debug.WriteLine("Complete - no connection"); NotifyComplete(); return; } var service = new LoadDataService(false); service.IsBackgroundAgent = true; var projects = await new StorageService().GetProjectsForRefresh(); foreach (var project in projects) { await service.LoadProjectTasks(project.workspaceid, project.id, false); } TileService.UpdateMainTile(); Debug.WriteLine("Complete - OK"); NotifyComplete(); }
async void LoadDataOnFirstLoad() { IsBlockingProgress = true; IsBusy = false; // PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; var loadService = new LoadDataService(); await loadService.Execute(); Dispatcher.RunAsync(async() => { //PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled; IsBlockingProgress = false; IsBusy = true; await LoadWorkspacesFromDb(); await LoadUsersFromDb(); await LoadTasksFromDb(); IsBusy = false; TileService.UpdateMainTile(); }); }
public Startup(IConfiguration configuration) { Configuration = configuration; LoadDataService.LoadData(); }