private async void RefreshReports() { if (IsBusy || !IsLoaded) { return; } IsBusy = true; RefreshCommand.ChangeCanExecute(); try { Reports = null; var reports = await _reportStorage.GetReports(); Reports = new List <Report>(reports); } catch (Exception) { // ignored } finally { IsBusy = false; RefreshCommand.ChangeCanExecute(); } }
private async void RefreshRules() { if (IsBusy) { return; } IsBusy = true; RefreshCommand.ChangeCanExecute(); try { var rules = await _ruleStorage.GetRules(); Rules = new ObservableCollection <Rule>(rules); } catch (Exception) { // ignored } finally { IsBusy = false; RefreshCommand.ChangeCanExecute(); } }
private async Task UpdateNextRowsCommand() { if (IsBusy) { return; } pageId++; IsBusy = true; RefreshCommand.ChangeCanExecute(); string url = Url + "&page=" + pageId; ObservableCollection <RowData> rows = await WebManager.LoadItemsAsync(url); Rows.RemoveAt(Rows.Count - 1); foreach (RowData rowData in rows) { Rows.Add(rowData); } Rows = RemoveDuplicateRows(Rows); Rows.Add(GetMoreRowData()); IsBusy = false; RefreshCommand.ChangeCanExecute(); }
private async void RefreshSightings() { if (IsBusy || !IsLoaded) { return; } IsBusy = true; RefreshCommand.ChangeCanExecute(); try { Sightings = null; var sightings = await _sightingStorage.Match(DaysFilter, RuleId); Sightings = new List <Sighting>(sightings); } catch (Exception) { // ignored } finally { IsBusy = false; RefreshCommand.ChangeCanExecute(); } }
private async void RefreshSites() { if (IsBusy) { return; } IsBusy = true; RefreshCommand.ChangeCanExecute(); var lastSearch = SearchText; try { var sites = await _siteService.GetSites(lastSearch); Sites = new ObservableCollection <Site>(sites); } finally { IsBusy = false; RefreshCommand.ChangeCanExecute(); } if (lastSearch != SearchText) { RefreshSites(); } }
public async void Refresh() { if (IsBusy) { return; } IsBusy = true; RefreshCommand.ChangeCanExecute(); if (RefreshDataAction != null) { RefreshDataAction(); } IsBusy = false; RefreshCommand.ChangeCanExecute(); }
// Load the courses from data store. private async Task ExecuteLoadCoursesCommand() { if (IsBusy) { return; } //string[] values = new string[] { "Group1", "Group2", "Group3" }; //var result = values.AsQueryable().Where("it in (\"Group2\")").ToArray(); IsBusy = true; RefreshCommand.ChangeCanExecute(); //DoStuff Courses = await azureService.GetCourses(); Title = $"Courses ({Courses.Count})"; IsBusy = false; RefreshCommand.ChangeCanExecute(); }