public override void ViewDidLoad() { Title = "Profile"; base.ViewDidLoad(); var header = new HeaderView(); var set = this.CreateBindingSet<ProfileView, ProfileViewModel>(); set.Bind(header).For(x => x.Title).To(x => x.Username).OneWay(); set.Bind(header).For(x => x.Subtitle).To(x => x.User.Name).OneWay(); set.Bind(header).For(x => x.ImageUri).To(x => x.User.AvatarUrl).OneWay(); set.Apply(); var followers = new StyledStringElement("Followers".t(), () => ViewModel.GoToFollowersCommand.Execute(null), Images.Heart); var following = new StyledStringElement("Following".t(), () => ViewModel.GoToFollowingCommand.Execute(null), Images.Following); var events = new StyledStringElement("Events".t(), () => ViewModel.GoToEventsCommand.Execute(null), Images.Event); var organizations = new StyledStringElement("Organizations".t(), () => ViewModel.GoToOrganizationsCommand.Execute(null), Images.Group); var repos = new StyledStringElement("Repositories".t(), () => ViewModel.GoToRepositoriesCommand.Execute(null), Images.Repo); var gists = new StyledStringElement("Gists", () => ViewModel.GoToGistsCommand.Execute(null), Images.Script); Root.Add(new [] { new Section(header), new Section { events, organizations, followers, following }, new Section { repos, gists } }); if (!ViewModel.IsLoggedInUser) NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Action, (s, e) => ShowExtraMenu()); }
public PullRequestView() { Root.UnevenRows = true; _header = new HeaderView() { ShadowImage = false }; _split1 = new SplitElement(new SplitElement.Row { Image1 = Images.Cog, Image2 = Images.Merge }); _split2 = new SplitElement(new SplitElement.Row { Image1 = Images.User, Image2 = Images.Create }); }
public override void ViewDidLoad() { base.ViewDidLoad(); _header = new HeaderView(); var content = System.IO.File.ReadAllText("WebCell/body.html", System.Text.Encoding.UTF8); _descriptionElement = new WebElement(content, "description_webview", false); _descriptionElement.UrlRequested = ViewModel.GoToUrlCommand.Execute; var content2 = System.IO.File.ReadAllText("WebCell/comments.html", System.Text.Encoding.UTF8); _commentsElement = new WebElement(content2, "body_webview", true); _commentsElement.UrlRequested = ViewModel.GoToUrlCommand.Execute; NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Compose, (s, e) => ViewModel.GoToEditCommand.Execute(null)); NavigationItem.RightBarButtonItem.Enabled = false; ViewModel.Bind(x => x.Issue, RenderIssue); ViewModel.BindCollection(x => x.Comments, (e) => RenderComments()); }
public override void ViewDidLoad() { base.ViewDidLoad(); var vm = (OrganizationViewModel) ViewModel; _header = new HeaderView() { Title = vm.Name }; vm.Bind(x => x.Organization, model => { _header.Subtitle = string.IsNullOrEmpty(model.Name) ? model.Login : model.Name; _header.ImageUri = model.AvatarUrl; }); var members = new StyledStringElement("Members".t(), () => vm.GoToMembersCommand.Execute(null), Images.Following); var teams = new StyledStringElement("Teams".t(), () => vm.GoToTeamsCommand.Execute(null), Images.Team); var followers = new StyledStringElement("Followers".t(), () => vm.GoToFollowersCommand.Execute(null), Images.Heart); var events = new StyledStringElement("Events".t(), () => vm.GoToEventsCommand.Execute(null), Images.Event); var repos = new StyledStringElement("Repositories".t(), () => vm.GoToRepositoriesCommand.Execute(null), Images.Repo); var gists = new StyledStringElement("Gists", () => vm.GoToGistsCommand.Execute(null), Images.Script); Root = new RootElement(vm.Name) { new Section(_header), new Section { members, teams }, new Section { events, followers }, new Section { repos, gists } }; }
public PullRequestView() { Root.UnevenRows = true; _header = new HeaderView() { ShadowImage = false }; _split1 = new SplitElement(new SplitElement.Row { Image1 = Images.Cog, Image2 = Images.Merge }) { BackgroundColor = UIColor.White }; }
public override void ViewDidLoad() { base.ViewDidLoad(); _header = new HeaderView(); _hud = this.CreateHud(); var content = System.IO.File.ReadAllText("WebCell/body.html", System.Text.Encoding.UTF8); _descriptionElement = new WebElement(content, "body", false); _descriptionElement.UrlRequested = ViewModel.GoToUrlCommand.Execute; //_descriptionElement.HeightChanged = x => Render(); var content2 = System.IO.File.ReadAllText("WebCell/comments.html", System.Text.Encoding.UTF8); _commentsElement = new WebElement(content2, "comments", true); _commentsElement.UrlRequested = ViewModel.GoToUrlCommand.Execute; //_commentsElement.HeightChanged = x => Render(); _milestoneElement = new StyledStringElement("Milestone", "No Milestone", UITableViewCellStyle.Value1) {Image = Images.Milestone, Accessory = UITableViewCellAccessory.DisclosureIndicator}; _milestoneElement.Tapped += () => ViewModel.GoToMilestoneCommand.Execute(null); _assigneeElement = new StyledStringElement("Assigned", "Unassigned".t(), UITableViewCellStyle.Value1) {Image = Images.Person, Accessory = UITableViewCellAccessory.DisclosureIndicator }; _assigneeElement.Tapped += () => ViewModel.GoToAssigneeCommand.Execute(null); _labelsElement = new StyledStringElement("Labels", "None", UITableViewCellStyle.Value1) {Image = Images.Tag, Accessory = UITableViewCellAccessory.DisclosureIndicator}; _labelsElement.Tapped += () => ViewModel.GoToLabelsCommand.Execute(null); _addCommentElement = new StyledStringElement("Add Comment") { Image = Images.Pencil }; _addCommentElement.Tapped += AddCommentTapped; NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Action, (s, e) => ShowExtraMenu()); NavigationItem.RightBarButtonItem.Enabled = false; ViewModel.Bind(x => x.IsLoading, x => { if (!x) { NavigationItem.RightBarButtonItem.Enabled = ViewModel.Issue != null; } }); ViewModel.Bind(x => x.IsModifying, x => { if (x) _hud.Show("Loading..."); else _hud.Hide(); }); ViewModel.Bind(x => x.Issue, x => { _assigneeElement.Value = x.Assignee != null ? x.Assignee.Login : "******".t(); _milestoneElement.Value = x.Milestone != null ? x.Milestone.Title : "No Milestone"; _labelsElement.Value = x.Labels.Count == 0 ? "None" : string.Join(", ", x.Labels.Select(i => i.Name)); _descriptionElement.Value = ViewModel.MarkdownDescription; _header.Title = x.Title; _header.Subtitle = "Updated " + x.UpdatedAt.ToDaysAgo(); Render(); }); ViewModel.BindCollection(x => x.Comments, (e) => RenderComments()); ViewModel.BindCollection(x => x.Events, (e) => RenderComments()); }
public IssueView() { Root.UnevenRows = true; _header = new HeaderView() { ShadowImage = false }; }
public override void ViewDidLoad() { Root.UnevenRows = true; base.ViewDidLoad(); _header = new HeaderView(); _hud = this.CreateHud(); var content = System.IO.File.ReadAllText("WebCell/body.html", System.Text.Encoding.UTF8); _descriptionElement = new WebElement(content, "body", false); _descriptionElement.UrlRequested = ViewModel.GoToUrlCommand.Execute; var content2 = System.IO.File.ReadAllText("WebCell/comments.html", System.Text.Encoding.UTF8); _commentsElement = new WebElement(content2, "comments", true); _commentsElement.UrlRequested = ViewModel.GoToUrlCommand.Execute; _milestoneElement = new StyledStringElement("Milestone", "No Milestone", UITableViewCellStyle.Value1) { Image = Images.Milestone }; _milestoneElement.Tapped += () => ViewModel.GoToMilestoneCommand.Execute(null); _assigneeElement = new StyledStringElement("Assigned", "Unassigned".t(), UITableViewCellStyle.Value1) { Image = Images.Person }; _assigneeElement.Tapped += () => ViewModel.GoToAssigneeCommand.Execute(null); _labelsElement = new StyledStringElement("Labels", "None", UITableViewCellStyle.Value1) { Image = Images.Tag }; _labelsElement.Tapped += () => ViewModel.GoToLabelsCommand.Execute(null); _addCommentElement = new StyledStringElement("Add Comment") { Image = Images.Pencil }; _addCommentElement.Tapped += AddCommentTapped; _split1 = new SplitElement(new SplitElement.Row { Image1 = Images.Cog, Image2 = Images.Merge }); _split2 = new SplitElement(new SplitElement.Row { Image1 = Images.Person, Image2 = Images.Create }); ViewModel.Bind(x => x.PullRequest, x => { var merged = (x.Merged != null && x.Merged.Value); _split1.Value.Text1 = x.State; _split1.Value.Text2 = merged ? "Merged" : "Not Merged"; _split2.Value.Text1 = x.User.Login; _split2.Value.Text2 = x.CreatedAt.ToString("MM/dd/yy"); _descriptionElement.Value = ViewModel.MarkdownDescription; _header.Title = x.Title; _header.Subtitle = "Updated " + x.UpdatedAt.ToDaysAgo(); Render(); }); NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Action, (s, e) => ShowExtraMenu()); NavigationItem.RightBarButtonItem.Enabled = false; ViewModel.Bind(x => x.IsLoading, x => { if (!x) { NavigationItem.RightBarButtonItem.Enabled = ViewModel.PullRequest != null; } }); ViewModel.Bind(x => x.IsModifying, x => { if (x) _hud.Show("Loading..."); else _hud.Hide(); }); ViewModel.Bind(x => x.Issue, x => { _assigneeElement.Value = x.Assignee != null ? x.Assignee.Login : "******".t(); _milestoneElement.Value = x.Milestone != null ? x.Milestone.Title : "No Milestone"; _labelsElement.Value = x.Labels.Count == 0 ? "None" : string.Join(", ", x.Labels.Select(i => i.Name)); Render(); }); ViewModel.GoToLabelsCommand.CanExecuteChanged += (sender, e) => { var before = _labelsElement.Accessory; _labelsElement.Accessory = ViewModel.GoToLabelsCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None; if (_labelsElement.Accessory != before && _labelsElement.GetImmediateRootElement() != null) Root.Reload(_labelsElement, UITableViewRowAnimation.Fade); }; ViewModel.GoToAssigneeCommand.CanExecuteChanged += (sender, e) => { var before = _assigneeElement.Accessory; _assigneeElement.Accessory = ViewModel.GoToAssigneeCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None; if (_assigneeElement.Accessory != before && _assigneeElement.GetImmediateRootElement() != null) Root.Reload(_assigneeElement, UITableViewRowAnimation.Fade); }; ViewModel.GoToMilestoneCommand.CanExecuteChanged += (sender, e) => { var before = _milestoneElement.Accessory; _milestoneElement.Accessory = ViewModel.GoToMilestoneCommand.CanExecute(null) ? UITableViewCellAccessory.DisclosureIndicator : UITableViewCellAccessory.None; if (_milestoneElement.Accessory != before && _milestoneElement.GetImmediateRootElement() != null) Root.Reload(_milestoneElement, UITableViewRowAnimation.Fade); }; ViewModel.BindCollection(x => x.Comments, e => RenderComments()); ViewModel.BindCollection(x => x.Events, e => RenderComments()); }