Exemple #1
0
        private async void ExecuteConnect()
        {
            ButtonVisibility  = Visibility.Collapsed;
            SpinnerVisibility = Visibility.Visible;
            ErrorMessage      = "";
            ErrorHint         = "";

            var steamClient = await SteamWebApi.GetInstance();

            var steamid = await steamClient.ISteamUser_ResolveVanityUrl(m_profileUri);

            if (!steamid.Success)
            {
                ButtonVisibility  = Visibility.Visible;
                SpinnerVisibility = Visibility.Collapsed;
                ErrorMessage      = "Invalid profile URL";
                ErrorHint         = "Did you make a typo?";
                return;
            }
            var games = await steamClient.IPlayerService_GetOwnedGames(steamid.Result);

            if (!games.Success)
            {
                ButtonVisibility  = Visibility.Visible;
                SpinnerVisibility = Visibility.Collapsed;
                ErrorMessage      = "Couldn't fetch game list";
                ErrorHint         = "Is your profile public?";
                return;
            }

            var nav = (App.Current as App).NavigationService;
            int key = TempDataStore.GetInstance().StoreObject(games.Result);

            nav.Navigate(typeof(SteamGameListPage), key.ToString());
        }
        public override async void OnNavigatedTo(string parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            JsonObject data = JsonObject.Parse(parameter);

            TileTitle  = data.GetNamedString("tile_title");
            PageHeader = data.GetNamedString("header");
            Action     = data.GetNamedString("action");
            m_id       = data.GetNamedString("id");
            if (mode == NavigationMode.Back)
            {
                int key = (int)state["key"];
                var d   = (JsonObject)TempDataStore.GetInstance().GetObject(key);
                SetImageData(d.GetNamedObject("logo"), m_logoImage);
                SetImageData(d.GetNamedObject("small"), m_smallImage);
                SetImageData(d.GetNamedObject("wide"), m_wideImage);
                SetImageData(d.GetNamedObject("large"), m_largeImage);
                UseDarkText = d.GetNamedBoolean("use_dark");
            }
            else
            {
                await WideImage.SetImageSource("");

                await SmallImage.SetImageSource("");

                await LogoImage.SetImageSource("");

                await LargeImage.SetImageSource("");

                string uri = "";
                if (data.ContainsKey("image_wide_url"))
                {
                    uri = data.GetNamedString("image_wide_url");
                    await WideImage.SetImageSource(uri);
                }
                if (uri != "")
                {
                    if (WideImage.ImageSource == null)
                    {
                        await WideImage.SetImageSource(uri);
                    }
                    if (LogoImage.ImageSource == null)
                    {
                        await LogoImage.SetImageSource(uri);
                    }
                    //if (String.IsNullOrEmpty(SmallImage.ImageSource))
                    //    await SmallImage.SetImageSource(uri);
                    //if (String.IsNullOrEmpty(LargeImage.ImageSource))
                    //    await LargeImage.SetImageSource(uri);
                }
            }
        }
        public override Task OnNavigatedFromAsync(IDictionary <string, object> state, bool suspending)
        {
            JsonObject data = new JsonObject();

            data.Add("logo", GetImageData(m_logoImage));
            data.Add("small", GetImageData(m_smallImage));
            data.Add("wide", GetImageData(m_wideImage));
            data.Add("large", GetImageData(m_largeImage));
            data.Add("use_dark", JsonValue.CreateBooleanValue(m_useDarkText));
            var key = TempDataStore.GetInstance().StoreObject(data);

            state["key"] = key;
            return(Task.FromResult <object>(null));
        }
Exemple #4
0
        public override void OnNavigatedTo(string parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            if (parameter == null)
            {
                return;
            }
            GameTiles.Clear();
            var games = (JsonArray)TempDataStore.GetInstance().GetObject(Int32.Parse(parameter));

            foreach (var game in games.OrderBy(v => v.GetObject().GetNamedString("name")))
            {
                var g  = game.GetObject();
                var gt = new SteamGameListPage_GameTileViewModel();
                gt.AppId    = (int)g.GetNamedNumber("appid");
                gt.GameName = g.GetNamedString("name");
                //gt.ImageSource = "http://media.steampowered.com/steamcommunity/public/images/apps/" + gt.AppId + "/" + g.GetNamedString("img_logo_url") + ".jpg";
                gt.ImageSource = "http://cdn.akamai.steamstatic.com/steam/apps/" + gt.AppId + "/header.jpg";
                GameTiles.Add(gt);
            }
        }