public void HideGreetings() { GreetingLabel.Hide(); GreetingLabel.Text = string.Empty; profilePicPictureBox.Hide(); LogoutButton.Hide(); }
void ReleaseDesignerOutlets() { if (GreetingLabel != null) { GreetingLabel.Dispose(); GreetingLabel = null; } if (Text1 != null) { Text1.Dispose(); Text1 = null; } if (Button1 != null) { Button1.Dispose(); Button1 = null; } if (FooterLabel != null) { FooterLabel.Dispose(); FooterLabel = null; } }
//Utilities public void ShowGreetings() { GreetingLabel.Show(); GreetingLabel.ForeColor = Color.White; GreetingLabel.Text = string.Format(Constants.GreetingsMessage, AuthenticationManager.GetCurrentUser().Username); //Show Image User currentUser = AuthenticationManager.GetCurrentUser(); byte[] imageBytes = imageService.GetProfilePicture(currentUser.Username); if (imageBytes != null) { System.Drawing.Image image = imageService.byteArrayToImage(imageBytes); profilePicPictureBox.Image = imageService.ScaleImage(image, 55, 54); profilePicPictureBox.Size = new Size(profilePicPictureBox.Image.Width, profilePicPictureBox.Image.Height); } else { Image image = Image.FromFile(@"../../Utilities/Images/default.jpg"); byte[] imageToBytes = imageService.imageToByteArray(image); Models.Image newImage = new Models.Image() { Content = imageToBytes }; currentUser.ProfilePicture = newImage; profilePicPictureBox.Image = imageService.ScaleImage(image, 55, 54); } profilePicPictureBox.Location = new Point(590, profilePicPictureBox.Location.Y); profilePicPictureBox.Show(); LogoutButton.Show(); }