private static string GetGistTitle(Gist gist) { var title = (gist.Owner == null) ? "Anonymous" : gist.Owner.Login; if (gist.Files.Count > 0) title = gist.Files.First().Key; return title; }
private GistItemViewModel CreateGistItemViewModel(Gist gist) { var title = GetGistTitle(gist); var description = string.IsNullOrEmpty(gist.Description) ? "Gist " + gist.Id : gist.Description; var imageUrl = (gist.Owner == null) ? null : gist.Owner.AvatarUrl; return new GistItemViewModel(title, imageUrl, description, gist.UpdatedAt, _ => { var vm = this.CreateViewModel<GistViewModel>(); vm.Init(gist.Id, gist); NavigateTo(vm); }); }
private GistItemViewModel CreateGistItemViewModel(Gist gist) { var title = (gist.Owner == null) ? "Anonymous" : gist.Owner.Login; var description = string.IsNullOrEmpty(gist.Description) ? "Gist " + gist.Id : gist.Description; var imageUrl = (gist.Owner == null) ? null : gist.Owner.AvatarUrl; if (gist.Files.Count > 0) title = gist.Files.First().Key; return new GistItemViewModel(title, imageUrl, description, gist.UpdatedAt, _ => { var vm = this.CreateViewModel<GistViewModel>(); vm.Init(gist.Id, gist); NavigateTo(vm); }); }
public GistViewModel Init(string id, Gist gist = null) { Id = id; Gist = gist; return this; }