public ServiceController(UserService svc) : base(UITableViewStyle.Grouped) { try { Title = svc.Name; Service = svc; _queries = new DialogSection ("Queries"); _feeds = new List<DialogSection> (); _feeds.Add (new DialogSection ("Feeds")); _loadingSection = new DialogSection (); _loadingElement = new LoadingElement (); _loadingElement.Start (); _loadingSection.Add (_loadingElement); Sections.AddRange (_feeds); Sections.Add (_loadingSection); NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Add, HandleAddButton); } catch (Exception error) { Log.Error (error); } }
public void DeleteService(UserService service) { _db.RunInTransaction (delegate { _db.Execute ("delete from UserFeed where ServiceId = ?", service.Id); _db.Execute ("delete from UserQuery where ServiceId = ?", service.Id); _db.Execute ("delete from UserService where Id = ?", service.Id); }); }
public void Add(UserService service) { _db.Insert (service); }
public void UpdateMetadataDocuments(List<UserMetadataDocument> metaDocs, UserService service) { _db.RunInTransaction (delegate { foreach (var f in metaDocs) { f.ServiceId = service.Id; var o = FindMetadataDocument (f.BaseUrl, service.Id); if (o != null) { f.Id = o.Id; _db.Update (f); } else { _db.Insert (f); } } }); }
public void UpdateFeeds(List<UserFeed> feeds, UserService service) { _db.RunInTransaction (delegate { foreach (var f in feeds) { f.ServiceId = service.Id; var o = FindFeed (f.Name, service.Id); if (o != null) { f.Id = o.Id; _db.Update (f); } else { _db.Insert (f); } } }); }
public void Save(UserService service) { _db.Update (service); }
public List<UserQuery> GetQueries(UserService service) { var q = from qu in _db.Table<UserQuery> () where qu.ServiceId == service.Id orderby qu.Name select qu; return q.ToList (); }
public List<UserFeed> GetFeeds(UserService service) { var q = from f in _db.Table<UserFeed> () where f.ServiceId == service.Id orderby f.Name select f; return q.ToList (); }
public QueryController(UserService service, UserQuery query) : base(UITableViewStyle.Grouped) { try { QueryId = query.Id; Title = query.Name; if (query.Name.Length == 0) { Title = "Add Query"; } _nameElement = new TextFieldElement ("Name", "Display Name", 70); _nameElement.Value = query.Name; _nameElement.TextField.AutocapitalizationType = UITextAutocapitalizationType.Words; _nameElement.TextField.AllEditingEvents += HandleNameElementTextFieldAllEditingEvents; using (var repo = new Repo ()) { _feedElement = new QueryFeedElement (service, repo.GetFeed (query.FeedId)); } _filterElement = new TextViewElement ("Filter", 44 * 2); _filterElement.TextView.Font = UIFont.FromName ("Courier-Bold", 16); _filterElement.TextView.AutocorrectionType = UITextAutocorrectionType.No; _filterElement.TextView.ContentInset = new UIEdgeInsets (0, 0, 0, 0); _filterElement.TextView.Changed += delegate { try { if (_filterElement.TextView.Text.Contains ("\n")) { _filterElement.TextView.Text = _filterElement.TextView.Text.Replace ("\n", " ").Trim (); _filterElement.TextView.ResignFirstResponder (); } } catch (Exception err) { Log.Error (err); } }; _filterElement.Value = query.Filter; _orderbyElement = new TextFieldElement ("Order", "Orderby Expression", 70); _orderbyElement.Value = query.OrderBy; var sec = new DialogSection (); sec.Add (_nameElement); sec.Add (_feedElement); sec.Add (_filterElement); sec.Add (_orderbyElement); Sections.Add (sec); _helpElement = new ActionElement ("Query Help", delegate { var b = new BrowserController ("Query Help", System.IO.File.ReadAllText ("QueryHelp.html")); NavigationController.PushViewController (b, true); }); _helpSec = new DialogSection (); _helpSec.Add (_helpElement); Sections.Add (_helpSec); _propsSec = new DialogSection ("Properties"); if (QueryId > 0) { var delElement = new ActionElement ("Delete Query", delegate { _deleteAlert = new UIAlertView ("", "Are you sure you wish to delete the query " + Name + "?", null, "Cancel", "Delete"); _deleteAlert.Clicked += Handle_deleteAlertClicked; _deleteAlert.Show (); }); var csec = new DialogSection (); csec.Add (delElement); Sections.Add (csec); } NavigationItem.LeftBarButtonItem = new UIBarButtonItem ("Cancel", UIBarButtonItemStyle.Bordered, HandleCancelButton); NavigationItem.RightBarButtonItem = new UIBarButtonItem ("Done", UIBarButtonItemStyle.Done, HandleDoneButton); } catch (Exception error) { Log.Error (error); } }
public QueryFeedElement(UserService service, UserFeed feed) : base("Feed") { Service = service; Value = feed; CellStyle = UITableViewCellStyle.Value1; }
void HandleDoneButton(object sender, EventArgs e) { try { var service = new UserService { Name = _nameElement.Value.Trim (), ServiceRootUri = _urlElement.Value.Trim () }; if (service.Name.Length > 0 && service.ServiceRootUri.Length > 0) { using (var repo = new Repo ()) { repo.Add (service); } DismissModalViewControllerAnimated (true); _doneAction (); } else { _noAlert = new UIAlertView ("", "Please completely fill in the form to add the service.", null, "OK"); _noAlert.Show (); } } catch (Exception error) { Log.Error (error); } }
public FeedElement(UserService service, UserFeed feed, UITableViewCellAccessory acc) : base(feed.Name) { Accessory = acc; Service = service; Feed = feed; }
public void Add(UserService service) { _db.Insert(service); }
public void Save(UserService service) { _db.Update(service); }