private void btnAdd_Click(object sender, EventArgs e) { Album newAlbum = new Album(this.txtTitle.Text, this.txtDescription.Text, this.txtAuthor.Text); newAlbum.MainImage = this.pbMainPhoto.Image; Photo newPhoto = new Photo(this.pbMainPhoto.Image); newAlbum.AddPhoto(newPhoto); parentGallery.GalleryObject.AddAlbum(newAlbum); parentGallery.GalleryObject = this.parentGallery.GalleryObject; this.Close(); }
private void btnAdd_Click(object sender, EventArgs e) { if (this.txtTitle.Text != string.Empty) { Photo newPhoto = new Photo(this.pbPhoto.Image); newPhoto.vtitle = this.txtTitle.Text; newPhoto.vauthor = this.txtAuthor.Text; newPhoto.vdescription = this.txtDescription.Text; newPhoto.vimagepath = this.pathToPhoto; newPhoto.valbumid = parentGallery.GetSelectedAlbumIcon().AlbumObject.vid; parentGallery.GetSelectedAlbumIcon().AlbumObject.AddPhoto(newPhoto); parentGallery.RefreshPhotosView(); this.Close(); } else { MessageBox.Show("Podaj tytuł zdjęcia!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public bool SavePhotoToAlbum(Album album, Photo photo) { throw new System.Exception("Not implemented"); }
public Photo SavePhoto(Photo photo) { throw new System.Exception("Not implemented"); }
/// <summary> /// Method to delete the photo /// </summary> /// <param name="item">Photo object to delete</param> public void DeletePhoto(Photo item) { if (this.Photos != null) { this.Photos.Remove(item); } }
/// <summary> /// Method to add the photo to the album /// </summary> /// <param name="item">Photo object to add</param> public void AddPhoto(Photo item) { if (this.Photos == null) { this.listPhotos = new List<Photo>(); } this.Photos.Add(item); }
/// <summary> /// Dodaje zdjêcie do danego albumu i zapisuje na dysku /// </summary> public bool SavePhotoToAlbum(Album album, Photo photo) { FileAdapter<Album> adapter = new FileAdapter<Album>(); return true; }
/// <summary> /// Zapisuje plik z danymi danego zdjêcia /// </summary> public Photo SavePhoto(Photo photo) { FileAdapter<Photo> adapter = new FileAdapter<Photo>(); return new Photo("."); }
public void AddPhoto(Photo item) { this.listPhotos.Add(item); }
public void DeletePhoto(Photo item) { this.listPhotos.Remove(item); }
/// <summary> /// Static method to zoom out Photo object /// </summary> /// <param name="photo">Photo object to zoom out</param> /// <param name="percent">Percent by which zoom out the photo</param> /// <returns></returns> public static Photo ZoomInOut(Photo photo, int percent) { int orginalWidth = photo.vimageobject.Width; int orginalHeight = photo.vimageobject.Height; int resizedWidth = orginalWidth - (int)(orginalWidth * percent / 100); int resizedHeight = orginalHeight - (int)(orginalHeight * percent / 100); Bitmap bmp = new Bitmap(resizedWidth, resizedHeight); Graphics graphic = Graphics.FromImage((Image)bmp); graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; graphic.DrawImage(photo.m_oPhoto, 0, 0, resizedWidth, resizedHeight); return photo; }
/// <summary> /// Static method to resize Photo object /// </summary> /// <param name="photo">Photo object to resize</param> /// <param name="width">New photo's width</param> /// <param name="height">New photo's height</param> /// <returns></returns> public static Photo ResizeTo(Photo photo, int width, int height) { int orginalWidth = photo.vimageobject.Width; int orginalHeight = photo.vimageobject.Height; Bitmap bmp = new Bitmap(width, height); Graphics graphic = Graphics.FromImage((Image)bmp); graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; graphic.DrawImage(photo.m_oPhoto, 0, 0, width, height); return photo; }