async Task LoadData(bool isUserAction = false) { await LoadWorkspacesFromDb(); await LoadTasksFromDb(); await LoadUsersFromDb(); ApplicationCheckUpdateService.Check(AsanaConstants.AppId); if (NavigationEventArgs.IsBackOrReset()) { NotifyOfPropertyChange(() => Workspaces); NotifyOfPropertyChange(() => DueTodayTasks); NotifyOfPropertyChange(() => DueTomorrowTasks); NotifyOfPropertyChange(() => DueWeekendTasks); NotifyOfPropertyChange(() => MyTasks); NotifyOfPropertyChange(() => Users); } IsBusy = false; await OffineSyncTaskService.Execute(this, () => { DispatcherHelper.OnUi(async() => await LoadTasksFromDb()); }); //if (CheckInternetConnection(false)) //{ // AddOperation(); // Task.Factory.StartNew(async () => // { // Debug.WriteLine("sync" + Dispatcher.CheckAccess()); // await (new LoadDataService(false).SyncTasks()).ContinueWith(async response => // { // var result = await response; // RemoveOperation(); // if (result) // { // DispatcherHelper.OnUi(() => LoadTasksFromDb()); // } // }); // }); //} await LoadWorkspaces(isUserAction); await LoadUsers(isUserAction); if (NavigationEventArgs.NavigationMode != NavigationMode.Back || isUserAction) { LoadMyTasks(isUserAction); } }
public async void LoadData(bool isUserAction = false) { IsBusy = true; User = await new StorageService().Find <AsanaUser>(UserId); await LoadTasksFromDb(); IsBusy = false; if (NavigationEventArgs.IsBackOrReset()) { NotifyAll(); return; } if (CheckInternetConnection(false)) { AddOperation(); var tasks = new List <System.Threading.Tasks.Task>(); foreach (var w in User.GetAvailableWorkspaces()) { tasks.Add(LoadTasks(w, isUserAction)); } System.Threading.Tasks.Task.Factory.ContinueWhenAll(tasks.ToArray(), x => { User.TasksCount = ActiveTasks.Count; if (IsPinned) { PinService.CreateUpdateStartTileAsync(User.name, User.TasksCountText, PinService.GetUserDetailsUri(UserId), false); } RemoveOperation(); }); } await OffineSyncTaskService.Execute(this, () => { }); }
public async void LoadData(bool isUserAction = false) { IsBusy = true; await LoadTasksFromDb(); IsBusy = false; if (NavigationEventArgs.IsBackOrReset()) { NotifyAll(); return; } await DownloadTasks(isUserAction); await OffineSyncTaskService.Execute(this, () => { }); }
async Task LoadData(bool isUserAction = false) { IsBusy = true; await LoadProjectsFromDb(); await LoadTagsFromDb(); IsBusy = false; if (NavigationEventArgs.IsBackOrReset()) { NotifyOfPropertyChange(() => Tags); NotifyOfPropertyChange(() => Projects); return; } await LoadProjects(isUserAction); await LoadTags(isUserAction); await OffineSyncTaskService.Execute(this, () => { }); }
async Task LoadData(bool isUserAction = false) { await LoadWorkspacesFromDb(); await LoadTasksFromDb(); await LoadUsersFromDb(); // ApplicationCheckUpdateService.Check(AsanaConstants.AppId); //if (NavigationEventArgs.IsBackOrReset()) //{ // NotifyOfPropertyChange(() => Workspaces); // NotifyOfPropertyChange(() => DueTodayTasks); // NotifyOfPropertyChange(() => DueTomorrowTasks); // NotifyOfPropertyChange(() => DueWeekendTasks); // NotifyOfPropertyChange(() => MyTasks); // NotifyOfPropertyChange(() => Users); //} IsBusy = false; await OffineSyncTaskService.Execute(this, () => { Dispatcher.RunAsync(async() => await LoadTasksFromDb()); }); await LoadWorkspaces(isUserAction); await LoadUsers(isUserAction); if (NavigationEventArgs.NavigationMode != NavigationMode.Back || isUserAction) { LoadMyTasks(isUserAction); } }