public void GetBothDisplayAndRawNames_DisplayNameAndRawName_DisplaysBoth()
        {
            var personSetting = new PersonSetting
            {
                RawName     = "dev\\lrichard",
                DisplayName = "Lee Richardson"
            };

            Assert.AreEqual("Lee Richardson (dev\\lrichard)", personSetting.GetBothDisplayAndRawNames());
        }
        public void GetBothDisplayAndRawNames_NullDisplayName_OnlyShowsRawName()
        {
            var personSetting = new PersonSetting
            {
                RawName     = "dev\\lrichard",
                DisplayName = null
            };

            Assert.AreEqual("dev\\lrichard", personSetting.GetBothDisplayAndRawNames());
        }
Exemple #3
0
        private void SaveDisplayName()
        {
            string newDisplayName = _displayNameTextbox.Text;

            _personSetting.DisplayName = newDisplayName;
            _settings.Save();
            InvokeOnUserDisplayNameChanged(new UserDisplayNameChangedArgs
            {
                RawUserName = _personSetting.RawName, NewDisplayName = newDisplayName
            });
            MakeUserNameEditable(false);
            _userName.Text = _personSetting.GetBothDisplayAndRawNames();
        }
Exemple #4
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++;
            }
        }