Esempio n. 1
0
        // Event Handlers --------------------------------------------------------------------------------------------------------------------------
        #region events

        private async void Apply_Clicked(object sender, System.EventArgs e)
        {
            if (BaseViewModel.hasConnection())
            {
                if (playerSteamID != SteamIdEntry.Text)
                {
                    var steamProfileDatum = await playerViewModel.GetPlayerSteamProfile(SteamIdEntry.Text);

                    if (steamProfileDatum?.response.players.Count == 0)
                    {
                        await DisplayAlert("Could not find player profile!", "Invalid SteamID.", "OK");

                        return;
                    }
                }

                App.Current.Properties["steamid"] = SteamIdEntry.Text;
                App.Current.Properties["game"]    = EFilter_ToString.toString(game);
                App.Current.Properties["mode"]    = EFilter_ToString.toString(mode);
                await App.Current.SavePropertiesAsync();

                await Navigation.PopAsync();
            }
            else
            {
                await DisplayAlert("Could not connect to Steam!", "Please connect to the Internet.", "OK");
            }
        }
Esempio n. 2
0
        // UI -----------------------------------------------------------------------------------------------
        #region UI

        private async Task ChangePlayerInfo(EFilter_Game newGame, EFilter_Mode newMode, EFilter_PlayerType newPlayerType, string newPlayerValue)
        {
            if (newGame == game && newMode == mode && newPlayerValue == playerValue)
            {
                return;
            }

            var playerInfoDatum = await playerViewModel.GetPlayerInfo(newGame, newMode, newPlayerType, newPlayerValue);

            playerInfoData = playerInfoDatum?.data;
            if (playerInfoData is null || playerInfoData.basicInfo is null)
            {
                await DisplayAlert("Could not find player profile!", "Invalid SteamID or rank.", "OK");

                return;
            }

            playerType    = newPlayerType;
            playerValue   = newPlayerValue;
            game          = newGame;
            mode          = newMode;
            playerSteamId = playerInfoData.basicInfo.steamID;
            playerRank    = playerInfoData.SurfRank;

            string playerName = playerInfoData.basicInfo.name;

            if (playerName.Length > 18)
            {
                playerName = playerName.Substring(0, 13) + "...";
            }
            Title = playerName + " [" + EFilter_ToString.toString2(game) + ", " + EFilter_ToString.toString(mode) + "]";

            var PlayerSteamDatum = await playerViewModel.GetPlayerSteamProfile(playerSteamId);

            playerSteamProfile = PlayerSteamDatum?.response.players[0];

            wrsType = EFilter_PlayerWRsType.none;
            LayoutPlayerInfo();
            LayoutPlayerProfile();
        }