void BeginDownloadFeeds() { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; App.RunInBackground(delegate { Exception netError = null; using (var repo = new Repo()) { try { var doc = new ServiceDocument(Service.ServiceRootUri); var fs = doc.Feeds; var feeds = new List <UserFeed> (); foreach (var f in fs) { feeds.Add(new UserFeed(f)); } var metaDocs = new List <UserMetadataDocument> (); foreach (var m in doc.Metadata) { metaDocs.Add(new UserMetadataDocument(m)); } repo.UpdateFeeds(feeds, Service); repo.UpdateMetadataDocuments(metaDocs, Service); Service.LastFeedUpdateTime = DateTime.UtcNow; repo.Save(Service); } catch (Exception ex) { netError = ex; } } if (netError != null) { App.RunInForeground(delegate { RemoveLoading(); _netError.ShowError(netError); }); } else { App.RunInForeground(delegate { RemoveLoading(); LoadData(false); }); } }); }
void HandleEdit(object sender, EventArgs e) { try { UserService service = null; using (var repo = new Repo()) { service = repo.GetService(Query.ServiceId); } var editC = new QueryController(service, Query); var navC = new UINavigationController(editC); editC.Done += delegate { editC.DismissModalViewControllerAnimated(true); Query.Filter = editC.Filter; Query.FeedId = editC.Feed.Id; Query.Name = editC.Name; Query.OrderBy = editC.OrderBy; using (var repo = new Repo()) { repo.Save(Query); } _numGets = 0; _index = 0; Sections.Clear(); _loadSection = new DialogSection(); _loadSection.Add(_loadElement); _loadElement.Start(); Sections.Add(_loadSection); GetMore(); }; NavigationController.PresentModalViewController(navC, true); } catch (Exception error) { Log.Error(error); } }
void HandleEdit(object sender, EventArgs e) { try { UserService service = null; using (var repo = new Repo()) { service = repo.GetService(Query.ServiceId); } var editC = new QueryController (service, Query); var navC = new UINavigationController (editC); editC.Done += delegate { editC.DismissModalViewControllerAnimated (true); Query.Filter = editC.Filter; Query.FeedId = editC.Feed.Id; Query.Name = editC.Name; Query.OrderBy = editC.OrderBy; using (var repo = new Repo ()) { repo.Save (Query); } _numGets = 0; _index = 0; Sections.Clear (); _loadSection = new DialogSection (); _loadSection.Add (_loadElement); _loadElement.Start (); Sections.Add (_loadSection); GetMore (); }; NavigationController.PresentModalViewController (navC, true); } catch (Exception error) { Log.Error (error); } }
void BeginDownloadFeeds() { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; App.RunInBackground (delegate { Exception netError = null; using (var repo = new Repo ()) { try { var doc = new ServiceDocument (Service.ServiceRootUri); var fs = doc.Feeds; var feeds = new List<UserFeed> (); foreach (var f in fs) { feeds.Add (new UserFeed (f)); } var metaDocs = new List<UserMetadataDocument> (); foreach (var m in doc.Metadata) { metaDocs.Add (new UserMetadataDocument (m)); } repo.UpdateFeeds (feeds, Service); repo.UpdateMetadataDocuments (metaDocs, Service); Service.LastFeedUpdateTime = DateTime.UtcNow; repo.Save (Service); } catch (Exception ex) { netError = ex; } } if (netError != null) { App.RunInForeground (delegate { RemoveLoading (); _netError.ShowError (netError); }); } else { App.RunInForeground (delegate { RemoveLoading (); LoadData (false); }); } }); }