public static FriendSourceViewModel CreateModel(string title, string description, int resource, string resourceName, FriendSourceId sourceId) { var model = new FriendSourceViewModel(); model.SourceTitle = title; model.SourceDescription = description; model.IconResource = resource; model.IconResourceName = resourceName; model.SourceId = sourceId; return(model); }
public Task <bool> InitializeAsync() { this.FriendSources.Add(FriendSourceViewModel.CreateModel("Select Facebook Friend", "Facebook", 0, "facebook_icon.png", FriendSourceId.FACEBOOK)); this.FriendSources.Add(FriendSourceViewModel.CreateModel("Play A Random Person", "Random", 0, "randomUserIcon.png", FriendSourceId.RANDOM)); int num = 0; return(repository.GetRecentOpponentsAsync().ContinueWith(t => { if (!t.IsFaulted) { this.RecentFriends = t.Result.TakeWhile(((Buddy.User arg) => num++ < 3)).Select((Buddy.User user, int arg2) => { FriendViewModel model = new FriendViewModel(user); return model; }).ToList(); return this.IsInitialized = true; } else { return this.IsInitialized = false; } })); }