コード例 #1
0
ファイル: Profile.cs プロジェクト: cixonline/cixreader
        /// <summary>
        /// Retrieve the profile for the specified user. If the profile is cached in the database
        /// it returns the full details immediately. Otherwise it creates and returns an empty
        /// profile.
        /// </summary>
        /// <param name="username">The user whose profile is requested</param>
        /// <returns>A profile for the specified user. May be incomplete if the full profile
        /// is not cached in the database.</returns>
        public static Profile ProfileForUser(string username)
        {
            // Enforce lowercase usernames
            username = username.ToLower();

            ProfileCollection prc = CIX.ProfileCollection;
            Profile profile = prc.Get(username);
            if (profile == null)
            {
                profile = new Profile
                {
                    Username = username,
                };
                prc.Add(profile);
            }

            return profile;
        }
コード例 #2
0
ファイル: Account.cs プロジェクト: cixonline/cixreader
        /// <summary>
        /// Refresh the Account field from the server. The profile structure specifies
        /// the updated data. Note that some fields may legally be null in the case where
        /// no server side profile has been retrieved. The only field that is guaranteed
        /// not to be null is the username.
        /// </summary>
        /// <param name="profile">A Profile object with the account profile data</param>
        /// <param name="force">Whether to force refresh the mugshot</param>
        private void RefreshAccount(Profile profile, bool force)
        {
            actUsername.Text = CIX.Username;

            Mugshot mugshot = Mugshot.MugshotForUser(profile.Username, force);
            actMugshot.Image = mugshot.RealImage;

            if (force)
            {
                mugshot.Refresh();
            }

            actEmail.Text = profile.EMailAddress;
            actFullname.Text = profile.FullName;
            actLocation.Text = profile.Location;

            string sexCode = "u";
            if (!string.IsNullOrEmpty(profile.Sex))
            {
                sexCode = profile.Sex.ToLower();
            }
            actSexDontSay.Checked = sexCode == "" || sexCode == "u";
            actSexFemale.Checked = sexCode == "f";
            actSexMale.Checked = sexCode == "m";

            actAbout.Text = profile.About;

            actNotifyPM.Checked = profile.Flags.HasFlag(Profile.NotificationFlags.PMNotification);
            actNotifyTag.Checked = profile.Flags.HasFlag(Profile.NotificationFlags.TagNotification);

            actSave.Enabled = false;
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: cixonline/cixreader
        /// <summary>
        /// Display the profile for the specified user in the pop-up profile viewer
        /// window.
        /// </summary>
        /// <param name="profile">Profile to be displayed</param>
        private void ShowProfile(Profile profile)
        {
            if (_profileViewer == null)
            {
                _profileViewer = new ProfileView(this);
            }
            _profileViewer.Profile = profile;
            _profileViewer.Show();

            profile.Refresh();
        }