/// <summary> /// Resets form /// </summary> private void Reset() { Name = string.Empty; Description = string.Empty; Cost = 0; GameVariants.ForEach(x => x.IsSelected = false); GameTypes.ForEach(x => x.IsSelected = false); TableTypes.ForEach(x => x.IsSelected = false); Images.Clear(); }
// retrieve leaderboard for selected format public static async Task <LeaderboardPlayer[]> GetPlayersOfLeaderboard(GameVariants gameType) { var leaderBoards = await GetLeaderboardsAsync().ConfigureAwait(false); switch (gameType) { case GameVariants.Bullet: return(leaderBoards.Bullet); case GameVariants.Blitz: return(leaderBoards.Blitz); case GameVariants.Blitz960: return(leaderBoards.Blitz960); case GameVariants.Rapid: return(leaderBoards.Rapid); case GameVariants.Daily: return(leaderBoards.Daily); case GameVariants.Daily960: return(leaderBoards.Daily960); case GameVariants.Bughouse: return(leaderBoards.Bughouse); case GameVariants.ThreeCheck: return(leaderBoards.ThreeCheck); case GameVariants.Crazyhouse: return(leaderBoards.Crazyhouse); case GameVariants.KingOfTheHill: return(leaderBoards.KingOfTheHill); case GameVariants.Lessons: return(leaderBoards.Lessons); case GameVariants.Tactics: return(leaderBoards.Tactics); //case GameTypes.PuzzleRush: // return leaderBoards.PuzzleRush; default: return(null); } }
private void Upload() { BusyStatus = HudUploadToStoreBusyStatus.Submitting; StartAsyncOperation(() => { var licenseService = ServiceLocator.Current.GetInstance <ILicenseService>(); var license = licenseService.GetHudStoreLicenseInfo(false); if (license == null) { throw new DHBusinessException(new NonLocalizableString("Couldn't find license to upload HUD to the store.")); } // update layout name in xml hudLayout.Name = Name; var serializedLayout = SerializationHelper.SerializeObject(hudLayout); var uploadInfo = new HudStoreUploadInfo { Name = Name, Description = Description, GameVariants = GameVariants.Where(x => x.IsSelected && !x.IsAll).Select(x => x.Item).ToArray(), GameTypes = GameTypes.Where(x => x.IsSelected && !x.IsAll).Select(x => x.Item).ToArray(), TableTypes = TableTypes.Where(x => x.IsSelected && !x.IsAll).Select(x => x.Item).ToArray(), Cost = Cost, Images = Images.Select(x => new HudStoreUploadImageInfo { Caption = x.Caption, Path = x.Path }).ToArray(), Serial = license.Serial, HudLayout = serializedLayout }; Model.Upload(uploadInfo); }, ex => { if (ex != null) { LogProvider.Log.Error(this, "Failed to upload HUD on the HUD store.", ex); IsSubmitButtonVisible = false; IsResetButtonVisible = false; IsRetryButtonVisible = true; IsBackButtonVisible = true; IsCancelButtonVisible = true; IsCloseButtonVisible = false; Message = LocalizableString.ToString("Common_HudUploadToStoreView_UploadingFailed", ex.Message); return; } IsSubmitButtonVisible = false; IsResetButtonVisible = false; IsRetryButtonVisible = false; IsBackButtonVisible = false; IsCancelButtonVisible = false; IsCloseButtonVisible = true; Message = CommonResourceManager.Instance.GetResourceString("Common_HudUploadToStoreView_UploadingSucceed"); }); }