public override void ViewDidLoad() { Title = "Edit Issue"; base.ViewDidLoad(); var status = new StringElement("Status", ViewModel.Status, UITableViewCellStyle.Value1); var delete = new StringElement("Delete", AtlassianIcon.Delete.ToImage()) { Accessory = UITableViewCellAccessory.None }; Root[0].Insert(1, UITableViewRowAnimation.None, status); Root.Insert(Root.Count, UITableViewRowAnimation.None, new Section { delete }); OnActivation(d => { d(ViewModel.Bind(x => x.Status, true).Subscribe(x => status.Value = x)); d(delete.Clicked.BindCommand(ViewModel.DeleteCommand)); d(status.Clicked.Subscribe(_ => { var ctrl = new IssueAttributesView(IssueModifyViewModel.Statuses, ViewModel.Status) { Title = "Status" }; ctrl.SelectedValue = x => ViewModel.Status = x.ToLower(); NavigationController.PushViewController(ctrl, true); })); }); }
public override void ViewDidLoad() { Title = "Edit Issue"; base.ViewDidLoad(); var status = new StyledStringElement("Status", ViewModel.Status, UITableViewCellStyle.Value1); status.Accessory = UITableViewCellAccessory.DisclosureIndicator; status.Tapped += () => { var ctrl = new IssueAttributesView(IssueModifyViewModel.Statuses, ViewModel.Status) { Title = "Status" }; ctrl.SelectedValue = x => ViewModel.Status = x.ToLower(); NavigationController.PushViewController(ctrl, true); }; var delete = new StyledStringElement("Delete", () => ViewModel.DeleteCommand.Execute(null), AtlassianIcon.Delete.ToImage()) { BackgroundColor = UIColor.FromRGB(1.0f, 0.7f, 0.7f) }; delete.Accessory = UITableViewCellAccessory.None; Root[0].Insert(1, UITableViewRowAnimation.None, status); Root.Insert(Root.Count, UITableViewRowAnimation.None, new Section { delete }); ViewModel.Bind(x => x.Status, x => { status.Value = x; Root.Reload(status, UITableViewRowAnimation.None); }, true); }
public override void ViewDidLoad() { base.ViewDidLoad(); _hud = this.CreateHud(); NavigationItem.RightBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.SaveButton, UIBarButtonItemStyle.Plain, (s, e) => { View.EndEditing(true); ViewModel.SaveCommand.Execute(null); }); var title = new InputElement("Title", string.Empty, string.Empty) { TextAlignment = UITextAlignment.Right }; title.Changed += (object sender, EventArgs e) => ViewModel.Title = title.Value; var assignedTo = new StyledStringElement("Responsible", "Unassigned", UITableViewCellStyle.Value1); assignedTo.Accessory = UITableViewCellAccessory.DisclosureIndicator; assignedTo.Tapped += () => ViewModel.GoToAssigneeCommand.Execute(null); var kind = new StyledStringElement("Issue Type", ViewModel.Kind, UITableViewCellStyle.Value1); kind.Accessory = UITableViewCellAccessory.DisclosureIndicator; kind.Tapped += () => { var ctrl = new IssueAttributesView(IssueModifyViewModel.Kinds, ViewModel.Kind) { Title = "Issue Type" }; ctrl.SelectedValue = x => ViewModel.Kind = x.ToLower(); NavigationController.PushViewController(ctrl, true); }; var priority = new StyledStringElement("Priority", ViewModel.Priority, UITableViewCellStyle.Value1); priority.Accessory = UITableViewCellAccessory.DisclosureIndicator; priority.Tapped += () => { var ctrl = new IssueAttributesView(IssueModifyViewModel.Priorities, ViewModel.Priority) { Title = "Priority" }; ctrl.SelectedValue = x => ViewModel.Priority = x.ToLower(); NavigationController.PushViewController(ctrl, true); }; var milestone = new StyledStringElement("Milestone", "None", UITableViewCellStyle.Value1); milestone.Accessory = UITableViewCellAccessory.DisclosureIndicator; milestone.Tapped += () => ViewModel.GoToMilestonesCommand.Execute(null); var component = new StyledStringElement("Component", "None", UITableViewCellStyle.Value1); component.Accessory = UITableViewCellAccessory.DisclosureIndicator; component.Tapped += () => ViewModel.GoToComponentsCommand.Execute(null); var version = new StyledStringElement("Version", "None", UITableViewCellStyle.Value1); version.Accessory = UITableViewCellAccessory.DisclosureIndicator; version.Tapped += () => ViewModel.GoToVersionsCommand.Execute(null); var content = new MultilinedElement("Description"); content.Tapped += () => { var composer = new Composer { Title = "Issue Description", Text = content.Value }; composer.NewComment(this, (text) => { ViewModel.Content = text; composer.CloseComposer(); }); }; ViewModel.Bind(x => x.IsSaving, x => { if (x) { _hud.Show("Saving..."); } else { _hud.Hide(); } }); Root = new RootElement(Title) { new Section { title, assignedTo, kind, priority }, new Section { milestone, component, version }, new Section { content } }; ViewModel.Bind(x => x.Title, x => { title.Value = x; Root.Reload(title, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.AssignedTo, x => { assignedTo.Value = x == null ? "Unassigned" : x.Username; Root.Reload(assignedTo, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.Kind, x => { kind.Value = x; Root.Reload(kind, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.Priority, x => { priority.Value = x; Root.Reload(priority, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.Milestone, x => { milestone.Value = x ?? "None"; Root.Reload(milestone, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.Component, x => { component.Value = x ?? "None"; Root.Reload(component, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.Version, x => { version.Value = x ?? "None"; Root.Reload(version, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.Content, x => { content.Value = x; Root.Reload(content, UITableViewRowAnimation.None); }, true); }
public override void ViewDidLoad() { base.ViewDidLoad(); _hud = this.CreateHud(); NavigationItem.RightBarButtonItem = new UIBarButtonItem(Theme.CurrentTheme.SaveButton, UIBarButtonItemStyle.Plain, (s, e) => { View.EndEditing(true); ViewModel.SaveCommand.Execute(null); }); var title = new InputElement("Title", string.Empty, string.Empty) { TextAlignment = UITextAlignment.Right }; title.Changed += (object sender, EventArgs e) => ViewModel.Title = title.Value; var assignedTo = new StyledStringElement("Responsible", "Unassigned", UITableViewCellStyle.Value1); assignedTo.Accessory = UITableViewCellAccessory.DisclosureIndicator; assignedTo.Tapped += () => ViewModel.GoToAssigneeCommand.Execute(null); var kind = new StyledStringElement("Issue Type", ViewModel.Kind, UITableViewCellStyle.Value1); kind.Accessory = UITableViewCellAccessory.DisclosureIndicator; kind.Tapped += () => { var ctrl = new IssueAttributesView(IssueModifyViewModel.Kinds, ViewModel.Kind) { Title = "Issue Type" }; ctrl.SelectedValue = x => ViewModel.Kind = x.ToLower(); NavigationController.PushViewController(ctrl, true); }; var priority = new StyledStringElement("Priority", ViewModel.Priority, UITableViewCellStyle.Value1); priority.Accessory = UITableViewCellAccessory.DisclosureIndicator; priority.Tapped += () => { var ctrl = new IssueAttributesView(IssueModifyViewModel.Priorities, ViewModel.Priority) { Title = "Priority" }; ctrl.SelectedValue = x => ViewModel.Priority = x.ToLower(); NavigationController.PushViewController(ctrl, true); }; var milestone = new StyledStringElement("Milestone", "None", UITableViewCellStyle.Value1); milestone.Accessory = UITableViewCellAccessory.DisclosureIndicator; milestone.Tapped += () => ViewModel.GoToMilestonesCommand.Execute(null); var component = new StyledStringElement("Component", "None", UITableViewCellStyle.Value1); component.Accessory = UITableViewCellAccessory.DisclosureIndicator; component.Tapped += () => ViewModel.GoToComponentsCommand.Execute(null); var version = new StyledStringElement("Version", "None", UITableViewCellStyle.Value1); version.Accessory = UITableViewCellAccessory.DisclosureIndicator; version.Tapped += () => ViewModel.GoToVersionsCommand.Execute(null); var content = new MultilinedElement("Description"); content.Tapped += () => { var composer = new Composer { Title = "Issue Description", Text = content.Value }; composer.NewComment(this, (text) => { ViewModel.Content = text; composer.CloseComposer(); }); }; ViewModel.Bind(x => x.IsSaving, x => { if (x) _hud.Show("Saving..."); else _hud.Hide(); }); Root = new RootElement(Title) { new Section { title, assignedTo, kind, priority }, new Section { milestone, component, version }, new Section { content } }; ViewModel.Bind(x => x.Title, x => { title.Value = x; Root.Reload(title, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.AssignedTo, x => { assignedTo.Value = x == null ? "Unassigned" : x.Username; Root.Reload(assignedTo, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.Kind, x => { kind.Value = x; Root.Reload(kind, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.Priority, x => { priority.Value = x; Root.Reload(priority, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.Milestone, x => { milestone.Value = x ?? "None"; Root.Reload(milestone, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.Component, x => { component.Value = x ?? "None"; Root.Reload(component, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.Version, x => { version.Value = x ?? "None"; Root.Reload(version, UITableViewRowAnimation.None); }, true); ViewModel.Bind(x => x.Content, x => { content.Value = x; Root.Reload(content, UITableViewRowAnimation.None); }, true); }
public override void ViewDidLoad() { base.ViewDidLoad(); var save = NavigationItem.RightBarButtonItem = new UIBarButtonItem { Image = Images.Buttons.Save }; var title = new EntryElement("Title", string.Empty, string.Empty) { TextAlignment = UITextAlignment.Right }; var assignedTo = new StringElement("Responsible", "Unassigned", UITableViewCellStyle.Value1); var kind = new StringElement("Issue Type", ViewModel.Kind, UITableViewCellStyle.Value1); var priority = new StringElement("Priority", ViewModel.Priority, UITableViewCellStyle.Value1); var milestone = new StringElement("Milestone", "None", UITableViewCellStyle.Value1); var component = new StringElement("Component", "None", UITableViewCellStyle.Value1); var version = new StringElement("Version", "None", UITableViewCellStyle.Value1); var content = new MultilinedElement("Description"); Root.Reset(new Section { title, assignedTo, kind, priority }, new Section { milestone, component, version }, new Section { content }); OnActivation(d => { d(ViewModel.Bind(x => x.IsSaving).SubscribeStatus("Saving...")); d(ViewModel.Bind(x => x.Title).Subscribe(x => title.Value = x)); d(ViewModel.Bind(x => x.AssignedTo).Subscribe(x => assignedTo.Value = x == null ? "Unassigned" : x.Username)); d(ViewModel.Bind(x => x.Kind, true).Subscribe(x => kind.Value = x)); d(ViewModel.Bind(x => x.Priority, true).Subscribe(x => priority.Value = x)); d(ViewModel.Bind(x => x.Milestone, true).Subscribe(x => milestone.Value = x ?? "None")); d(ViewModel.Bind(x => x.Component, true).Subscribe(x => component.Value = x ?? "None")); d(ViewModel.Bind(x => x.Version, true).Subscribe(x => version.Value = x ?? "None")); d(ViewModel.Bind(x => x.Content, true).Subscribe(x => version.Value = x)); d(title.Changed.Subscribe(x => ViewModel.Title = x)); d(version.Clicked.BindCommand(ViewModel.GoToVersionsCommand)); d(assignedTo.Clicked.BindCommand(ViewModel.GoToAssigneeCommand)); d(milestone.Clicked.BindCommand(ViewModel.GoToMilestonesCommand)); d(component.Clicked.BindCommand(ViewModel.GoToComponentsCommand)); d(save.GetClickedObservable().Subscribe(_ => { View.EndEditing(true); ViewModel.SaveCommand.Execute(null); })); d(content.Clicked.Subscribe(_ => { var composer = new Composer { Title = "Issue Description", Text = ViewModel.Content }; composer.NewComment(this, (text) => { ViewModel.Content = text; composer.CloseComposer(); }); })); d(priority.Clicked.Subscribe(_ => { var ctrl = new IssueAttributesView(IssueModifyViewModel.Priorities, ViewModel.Priority) { Title = "Priority" }; ctrl.SelectedValue = x => ViewModel.Priority = x.ToLower(); NavigationController.PushViewController(ctrl, true); })); d(kind.Clicked.Subscribe(_ => { var ctrl = new IssueAttributesView(IssueModifyViewModel.Kinds, ViewModel.Kind) { Title = "Issue Type" }; ctrl.SelectedValue = x => ViewModel.Kind = x.ToLower(); NavigationController.PushViewController(ctrl, true); })); }); }