public override void OnSelected(DialogViewController sender, NSIndexPath indexPath) { UserFeed feed = null; using (var repo = new Repo()) { feed = repo.GetFeed(Query.FeedId); } var c = new DataViewController(Query, feed.Url); sender.NavigationController.PushViewController(c, true); }
public DataViewController(UserQuery query, string url) : base(UITableViewStyle.Grouped) { try { Query = query; Url = url; Title = Query.Name; PagingEnabled = true; NumEntitiesPerRequest = 20; _index = 0; _loadSection = new DialogSection (); _loadElement = new LoadingElement (); _loadSection.Add (_loadElement); _loadElement.Start (); Sections.Add (_loadSection); _moreSection = new DialogSection (); _moreSection.Add (new ActionElement ("More", GetMore)); if (PagingEnabled) { Sections.Add (_moreSection); } using (var repo = new Repo ()) { Feed = repo.GetFeed (query.FeedId); } if (Query.Id > 0) { NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Edit, HandleEdit); } GetMore (); } catch (Exception error) { Log.Error (error); } }
public DataViewController(UserQuery query, string url) : base(UITableViewStyle.Grouped) { try { Query = query; Url = url; Title = Query.Name; PagingEnabled = true; NumEntitiesPerRequest = 20; _index = 0; _loadSection = new DialogSection(); _loadElement = new LoadingElement(); _loadSection.Add(_loadElement); _loadElement.Start(); Sections.Add(_loadSection); _moreSection = new DialogSection(); _moreSection.Add(new ActionElement("More", GetMore)); if (PagingEnabled) { Sections.Add(_moreSection); } using (var repo = new Repo()) { Feed = repo.GetFeed(query.FeedId); } if (Query.Id > 0) { NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Edit, HandleEdit); } GetMore(); } catch (Exception error) { Log.Error(error); } }
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 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); } }