예제 #1
0
        public void StoreUser(User CurrentUser)
        {
            DateTime ValidUntil = new DateTime();
            ValidUntil = DateTime.Now + (new TimeSpan(24, 0, 0));

            StoreValue("ValidUntil", ValidUntil);
            StoreValue("CachedUsername", CurrentUser.Username);
            StoreValue("CachedName", CurrentUser.Name);
            StoreValue("CachedLocation", CurrentUser.Location);
            StoreValue("CachedTitle", CurrentUser.Title);
            StoreValue("CachedCompany", CurrentUser.Company);
            StoreValue("CachedBadges", CurrentUser.Badges);
            StoreValue("CachedAccomplishments", CurrentUser.Accomplishments);
            StoreValue("CachedStats", CurrentUser.Stats);
            StoreValue("CachedEndorsements", CurrentUser.Endorsements);
            StoreValue("CachedThumbnail", CurrentUser.Thumbnail);
            StoreValue("CachedSpecialities", CurrentUser.Specialities);
        }
예제 #2
0
        private void ProcessUser(User ThisUser,bool Cached)
        {
            foreach (BadgeObject badge in ThisUser.Badges)
            {
                Uri BadgeUri = new Uri(badge.Badge, UriKind.Absolute);
                ImageSource BadgeSource;

                    BitmapImage BadgeBitmap = new BitmapImage(BadgeUri);
                    BadgeSource = BadgeBitmap;

                Badges.Add(
                    new BadgeViewModel()
                    {
                        BadgeName = badge.Name,
                        BadgeDescription = badge.Description,
                        Badge = BadgeSource
                    }
               );
            }

            foreach (string accomplishment in ThisUser.Accomplishments)
                Accomplishments.Add(accomplishment);

                if (Accomplishments.Count == 0)
                    Accomplishments.Add("You Have Not Entered Any Accomplishments");

                Summary = ThisUser.Title;

                if (ThisUser.Title != null && ThisUser.Company != null)
                    Summary += " at ";

                Summary += ThisUser.Company;

                if (Summary != "")
                    Summary += "\n";

                Summary += ThisUser.Location;

                Specialities = string.Join(", ", ThisUser.Specialities);

                Uri AvatarUri = new Uri(ThisUser.Thumbnail + "?s=200", UriKind.Absolute);
                BitmapImage AvatarBitmap = new BitmapImage(AvatarUri);
                Avatar = AvatarBitmap;

                PropertyChanged(this, new PropertyChangedEventArgs("CurrentUser"));
                PropertyChanged(this, new PropertyChangedEventArgs("Summary"));
                PropertyChanged(this, new PropertyChangedEventArgs("Specialities"));
                PropertyChanged(this, new PropertyChangedEventArgs("Avatar"));
                PropertyChanged(this, new PropertyChangedEventArgs("Badges"));
                PropertyChanged(this, new PropertyChangedEventArgs("Accomplishments"));
        }