private async Task ChecksConnection() { var current = Connectivity.NetworkAccess; if (current == NetworkAccess.Internet) { Title = "Saan muudatused..."; activityIndicator = new ActivityIndicator { IsRunning = true, Margin = 175, Color = Color.FromHex("#A22538") }; if (ChangesListView == null) { Content = activityIndicator; } await Task.Run(() => { LoadChanges(ChangeCollection.GetChangeList()); }); if (ChangesListView == null) { activityIndicator.IsRunning = false; activityIndicator.IsVisible = false; InitializeComponent(); string group = Preferences.Get("group", "none"); if (group != "none") { ChangesPageSearchBar.Placeholder = group; } } else { Title = "Tunniplaani muudatused"; string group = Preferences.Get("group", "none"); if (group != "none") { ChangesPageSearchBar.Placeholder = group; Content = ChangesListView; } } ChangesListView.IsRefreshing = false; ChangesListView.RefreshControlColor = Color.FromHex("#A22538"); } else { Title = "Saan muudatused..."; activityIndicator = new ActivityIndicator { IsRunning = true, Margin = 175, Color = Color.FromHex("#A22538") }; if (ChangesListView == null) { Content = activityIndicator; } await GetChangesFromDatabase(); if (ChangesListView == null) { activityIndicator.IsRunning = false; activityIndicator.IsEnabled = false; InitializeComponent(); ChangesListView.IsRefreshing = false; string group = Preferences.Get("group", "none"); if (group != "none") { ChangesPageSearchBar.Placeholder = group; } } else { ChangesListView.IsRefreshing = false; Content = ChangesListView; } DependencyService.Get <IMessage>().ShortAlert("Teil puudub ühendus."); } }
private IEnumerable<Change> GetChangesFromInternet() { return ChangeCollection.GetChangeList(); }