示例#1
0
 public PhotoManager(Photo photo)
 {
     InitializeComponent();
     _activePhoto = photo;
     LoadCategories();
     PhotoPreview.SizeMode      = PictureBoxSizeMode.StretchImage;
     PhotoPreview.Image         = ImageFromByteArray(photo.PhotoData);
     PhotoDescTextBox.Text      = photo.Desc;
     PhotoDescriptionLabel.Text = photo.Desc;
     ResolutionLabel.Text      += photo.Resolution;
     DBRequests.MakeRequest(DBRequests.GetAlbumName(photo.Album), (connection, command) =>
     {
         using (var reader = command.ExecuteReader())
         {
             if (reader.HasRows)
             {
                 while (reader.Read())
                 {
                     AlbumLabel.Text += reader.GetString(0);
                 }
             }
         }
     });
     DBRequests.MakeRequest(DBRequests.GetCategoryName(photo.Category), (connection, command) =>
     {
         using (var reader = command.ExecuteReader())
         {
             if (reader.HasRows)
             {
                 while (reader.Read())
                 {
                     CategoryLabel.Text += reader.GetString(0);
                 }
             }
         }
     });
     FormatLabel.Text       += photo.Format;
     SizeLabel.Text         += GetBytesReadable(photo.Size);
     CreationDateLabel.Text += photo.CreationDate;
     NameLabel.Text         += photo.Name;
     TagsLabel.Text          = photo.Tags.Replace(",", ", ");
 }