private void writeProfileButton_Click(object sender, System.EventArgs e) { if (this.identity != null) { if (this.profile != null) { this.profileForm.Profile.FirstName = this.profile.FirstName; this.profileForm.Profile.LastName = this.profile.LastName; this.profileForm.Profile.Theme = this.profile.Theme; } DialogResult result = this.profileForm.ShowDialog(); if (result == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; this.profile = this.profileForm.Profile; // Write the profile to the configured ASP.NET Profile provider ProfileBase userProfile = ProfileBase.Create(this.identity.Name); userProfile["FirstName"] = this.profile.FirstName; userProfile["LastName"] = this.profile.LastName; userProfile["Theme"] = this.profile.Theme; userProfile.Save(); this.DisplayProfileResults(string.Format(Properties.Resources.ProfileUpdatedMessage, this.identity.Name)); this.Cursor = Cursors.Arrow; } } else { this.DisplayProfileResults(Properties.Resources.NullIdentityMessage); } }
public ProfileForm() { // // Required for Windows Form Designer support // InitializeComponent(); this.profile = new ProfileInformation(); }
private void readProfileButton_Click(object sender, System.EventArgs e) { if (this.identity != null) { // Read the profile from the configured ASP.NET Profile provider ProfileBase userProfile = ProfileBase.Create(this.identity.Name); profile = new ProfileInformation(); profile.FirstName = (string)userProfile["FirstName"]; profile.LastName = (string)userProfile["LastName"]; profile.Theme = (ProfileTheme)userProfile["Theme"]; if (profile != null) { System.Drawing.Color backColor = System.Drawing.Color.White; switch (profile.Theme) { case ProfileTheme.Spring: backColor = System.Drawing.Color.YellowGreen; break; case ProfileTheme.Summer: backColor = System.Drawing.Color.Yellow; break; case ProfileTheme.Fall: backColor = System.Drawing.Color.Goldenrod; break; case ProfileTheme.Winter: backColor = System.Drawing.Color.GhostWhite; break; } this.groupBox1.BackColor = backColor; this.DisplayProfileResults(string.Format(Properties.Resources.UserProfileMessage, this.identity.Name, profile.ToString())); } else { this.DisplayProfileResults(Properties.Resources.ProfileNotFoundMessage); } } else { this.DisplayProfileResults(Properties.Resources.NullIdentityMessage); } }