示例#1
0
 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;
 }
示例#2
0
        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);
            });
        }
示例#3
0
        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);
            });
        }
示例#4
0
 public GistViewModel Init(string id, Gist gist = null)
 {
     Id = id;
     Gist = gist;
     return this;
 }