public AddController(Action doneAction) : base(UITableViewStyle.Grouped) { try { Title = "Add Service"; _doneAction = doneAction; _nameElement = new TextFieldElement ("Name", "Display Name", 70); _nameElement.TextField.AutocapitalizationType = UITextAutocapitalizationType.Words; _urlElement = new TextFieldElement ("URL", "http://", 70); _urlElement.TextField.AutocapitalizationType = UITextAutocapitalizationType.None; _urlElement.TextField.KeyboardType = UIKeyboardType.Url; _urlElement.TextField.AutocorrectionType = UITextAutocorrectionType.No; var sec = new DialogSection (); sec.Add (_nameElement); sec.Add (_urlElement); Sections.Add (sec); NavigationItem.LeftBarButtonItem = new UIBarButtonItem ("Cancel", UIBarButtonItemStyle.Bordered, HandleCancelButton); NavigationItem.RightBarButtonItem = new UIBarButtonItem ("Done", UIBarButtonItemStyle.Done, HandleDoneButton); } catch (Exception error) { Log.Error (error); } }
public AddController(Action doneAction) : base(UITableViewStyle.Grouped) { try { Title = "Add Service"; _doneAction = doneAction; _nameElement = new TextFieldElement("Name", "Display Name", 70); _nameElement.TextField.AutocapitalizationType = UITextAutocapitalizationType.Words; _urlElement = new TextFieldElement("URL", "http://", 70); _urlElement.TextField.AutocapitalizationType = UITextAutocapitalizationType.None; _urlElement.TextField.KeyboardType = UIKeyboardType.Url; _urlElement.TextField.AutocorrectionType = UITextAutocorrectionType.No; var sec = new DialogSection(); sec.Add(_nameElement); sec.Add(_urlElement); Sections.Add(sec); 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); } }
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); } }