Пример #1
0
        // why doesn't badges code handle this?
        public virtual async void TokenReceived(object sender, EventArgs e)
        {
            //coreProfile.usernameLabel.Text = GlobalStatusSingleton.username;
            string jsonQuery = "";
            string result    = "fail";

            while (result.Equals("fail"))
            {
                result = await GlobalSingletonHelpers.requestFromServerAsync(HttpMethod.Get, BADGES, jsonQuery);

                if (result.Equals("fail"))
                {
                    await Task.Delay(10000);
                }
            }
            if (!result.Equals("fail"))
            {
                BadgesResponseJSON badges = JsonConvert.DeserializeObject <BadgesResponseJSON>(result);
                if (badges != null)
                {
                    coreProfile.SetBadgesData(badges);
                    badgesPage.SetBadgesData(badges);
                }
            }
            else
            {
                Debug.WriteLine("DHB:CameraCategorySelectionView:OnEventsLoadRequest event apicall failed!");
            }
        }
Пример #2
0
        public void SetBadgesData(BadgesResponseJSON badges)
        {
            Assembly assembly = this.GetType().GetTypeInfo().Assembly;

            if (badges.firstphoto == true)
            {
                upload1 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedal_01.png", assembly));
            }
            else
            {
                upload1 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedals_inactive.png", assembly));
            }
            if (badges.upload7 == true)
            {
                upload7 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedal_02.png", assembly));
            }
            else
            {
                upload7 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedals_inactive.png", assembly));
            }
            if (badges.upload30 == true)
            {
                upload30 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedal_03.png", assembly));
            }
            else
            {
                upload30 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedals_inactive.png", assembly));
            }
            if (badges.upload100 == true)
            {
                upload100 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedal_04.png", assembly));
            }
            else
            {
                upload100 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.uploadMedals_inactive.png", assembly));
            }

            if (badges.vote30 == true)
            {
                vote30 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.voteMedal_01.png", assembly));
            }
            else
            {
                vote30 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.voteMedal_inactive.png", assembly));
            }
            if (badges.vote100 == true)
            {
                vote100 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.voteMedal_01.png", assembly));
            }
            else
            {
                vote100 = new iiBitmapView(GlobalSingletonHelpers.loadSKBitmapFromResourceName("ImageImprov.IconImages.Medals.voteMedal_inactive.png", assembly));
            }
            Device.BeginInvokeOnMainThread(() => {
                buildUI();
            });
        }
Пример #3
0
        public async void SetBadgesData(BadgesResponseJSON badges)
        {
            Assembly assembly  = this.GetType().GetTypeInfo().Assembly;
            int      ampersand = GlobalStatusSingleton.username.IndexOf("@");

            usernameLabel.Text     = GlobalStatusSingleton.username.Substring(0, ampersand);
            lightbulbCount.Text    = badges.totalBulbs.ToString();
            mostBulbsInOneDay.Text = MOST_BULBS + badges.maxDailyBulbs.ToString();

            if (badges.pid != -1)
            {
                profilePicBitmap = await GlobalSingletonHelpers.loadBitmapAsync(assembly, badges.pid);

                profilePic.Bitmap = profilePicBitmap;
            }
        }