Esempio n. 1
0
 public void GetBothDisplayAndRawNames_DisplayNameAndRawName_DisplaysBoth()
 {
     var personSetting = new PersonSetting
         {
             RawName = "dev\\lrichard",
             DisplayName = "Lee Richardson"
         };
     Assert.AreEqual("Lee Richardson (dev\\lrichard)", personSetting.GetBothDisplayAndRawNames());
 }
Esempio n. 2
0
 public void GetBothDisplayAndRawNames_RawNameNoDisplayName_OnlyShowsRawName()
 {
     var personSetting = new PersonSetting
         {
             RawName = "dev\\lrichard",
             DisplayName = "dev\\lrichard"
         };
     Assert.AreEqual("dev\\lrichard", personSetting.GetBothDisplayAndRawNames());
 }
Esempio n. 3
0
        private void SetUser(PersonSetting personSetting)
        {
            _userName.Text = personSetting.GetBothDisplayAndRawNames();
            _reputation.Text = personSetting.GetReputation().ToString(CultureInfo.InvariantCulture);
            _achievementCount.Text = personSetting.Achievements.Count.ToString(CultureInfo.InvariantCulture);
            _achievementsText.Text = personSetting.Achievements.Count == 1 ? "Achievement" : "Achievements";

            int achievementIndex = 0;
            foreach (var achievementLookup in AchievementSetting.AchievementLookups)
            {
                bool hasUserAchieved = personSetting.Achievements.Any(i => i.AchievementId == (int) achievementLookup.Id);
                var cloneFrom = hasUserAchieved ? _obtainedTemplate : _unobtainedTemplate;
                Control control = flowLayoutPanel1.Controls[achievementIndex];
                Debug.Assert(control != null);
                control.BackColor = cloneFrom.BackColor;
                control.ForeColor = cloneFrom.ForeColor;
                achievementIndex++;
            }
        }