private void LoadForks(Section section) { section.Clear(); if (Model == null || Model.Forks == null) { return; } foreach (var fork in Model.Forks) { try { var sse = new SubcaptionElement(fork.User.Login, fork.CreatedAt.ToDaysAgo()) { Accessory = MonoTouch.UIKit.UITableViewCellAccessory.DisclosureIndicator, LineBreakMode = MonoTouch.UIKit.UILineBreakMode.TailTruncation, Lines = 1, }; sse.Image = Images.Misc.Anonymous; sse.ImageUri = new Uri(fork.User.AvatarUrl); var id = fork.Url.Substring(fork.Url.LastIndexOf('/') + 1); sse.Tapped += () => NavigationController.PushViewController(new GistInfoController(id), true); section.Add(sse); } catch (Exception e) { Utilities.LogException("Unable to load forks!", e); } } }
private void LoadFiles(Section section) { section.Clear(); if (Model == null || Model.Files == null) { return; } foreach (var file in Model.Files.Keys.OrderBy(x => x)) { try { var sse = new SubcaptionElement(file, Model.Files[file].Size + " bytes") { Accessory = MonoTouch.UIKit.UITableViewCellAccessory.DisclosureIndicator, LineBreakMode = MonoTouch.UIKit.UILineBreakMode.TailTruncation, Lines = 1 }; var fileSaved = file; sse.Tapped += () => NavigationController.PushViewController(new GistFileController(Model.Files[fileSaved]), true); section.Add(sse); } catch (Exception e) { Utilities.LogException("Unable to load files!", e); } } }
protected override void OnRender() { var model = (ChangesetModel)Model; var sec = new Section(); _header.Subtitle = "Commited " + (model.Utctimestamp).ToDaysAgo(); var d = new MultilinedElement(model.Author, model.Message); sec.Add(d); if (Repo != null) { var repo = new StyledElement(Repo.Name, Images.Repo) { Accessory = MonoTouch.UIKit.UITableViewCellAccessory.DisclosureIndicator, Lines = 1, Font = StyledElement.DefaultDetailFont, TextColor = StyledElement.DefaultDetailColor, }; repo.Tapped += () => NavigationController.PushViewController(new RepositoryInfoController(Repo), true); sec.Add(repo); } var sec2 = new Section(); model.Files.ForEach(x => { var file = x.File.Substring(x.File.LastIndexOf('/') + 1); var sse = new SubcaptionElement(file, x.Type) { Accessory = MonoTouch.UIKit.UITableViewCellAccessory.DisclosureIndicator, LineBreakMode = MonoTouch.UIKit.UILineBreakMode.TailTruncation, Lines = 1 }; sse.Tapped += () => { string parent = null; if (model.Parents != null && model.Parents.Count > 0) parent = model.Parents[0]; var type = x.Type.Trim().ToLower(); NavigationController.PushViewController(new ChangesetDiffController(User, Slug, model.Node, parent, x.File) { Removed = type.Equals("removed"), Added = type.Equals("added") }, true); }; sec2.Add(sse); }); _header.SetNeedsDisplay(); var root = new RootElement(Title) { UnevenRows = Root.UnevenRows }; root.Add(new [] { new Section(_header), sec, sec2 }); Root = root; }