public async Task <GameCreateResponseModel> PostPuzzle() { GameCreateResponseModel result; try { result = await Game.CreateGame(new GameModel { CreatorUid = AppInfo.AppUser.UserId, CreateGameType = "A", Language = LogicHelper.GetLangString(puzzle.Language), Word = puzzle.Word, Photo = this.Photo }); if (result.Status == GameCreateStatus.Ok) { AppInfo.AppUser.TotalCreatedPuzzles++; wordEntered = false; NeedDisplayFinalyControl = true; OnPropertyChanged(nameof(NeedDisplayScrambledWordControl)); OnPropertyChanged(nameof(NeedDisplayFinalyControl)); } } catch { result = new GameCreateResponseModel(); result.Status = GameCreateStatus.PostError; result.GameId = String.Empty; } return(result); }
public async Task UpdatePuzzlesList() { allPuzzles.Clear(); if (await LogicHelper.IsInternet()) { puzzlesDownloaded = false; OnPropertyChanged(nameof(PuzzlesDownloading)); GameTypes gamesType; if (selectedCategory == CategoryEnum.MyFriends) { gamesType = GameTypes.PuzzleListFromFriends; } else if (selectedCategory == CategoryEnum.Challenges) { gamesType = GameTypes.ChallengeListAllCahllenges; } else { gamesType = GameTypes.AllPuzzles; } var result = await Game.GetGameList(LogicHelper.GetLangString(selectedLanguage), GameSort.CreatedDesc, gamesType); foreach (var puzzle in result) { allPuzzles.Add(puzzle); } } puzzlesDownloaded = true; OnPropertyChanged(nameof(PuzzlesDownloading)); OnPropertyChanged(nameof(ShowNoPuzzlesMessage)); LoadImage(); }