public ImageViewDisplay(Picture pict) { InitializeComponent(); editPlace = edit_place; editComments = edit_comments; editName = edit_title; pb = picture; buttonSave = button_saveInfo; this.pic = pict; resizeForm(); fillInformation(); this.FormClosing += new FormClosingEventHandler(ImageViewDisplay_FormClosing); this.Show(); }
private void button1_Click(object sender, EventArgs e) { this.openFileDialog1 = new OpenFileDialog(); if (this.openFileDialog1.ShowDialog() == DialogResult.OK) { tttt = new Picture(); tttt.fname = this.openFileDialog1.FileName; MessageBox.Show(tttt.fname); try { testFileNameCorrectness(tttt.fname); // Updating the pictureBox this.imagePreview.Image = Image.FromFile(tttt.fname); } catch (Exception z) { MessageBox.Show(z.ToString()); } } }
private bool removeTag(Picture pic, string removetag) { foreach (string tag in list_tags.Items) { if (pic != null && pic.tags.Contains(tag) == true) { pic.tags.Remove(removetag); return true; } } return false; }
void setcurrentPicture() { list_folders.SelectedNode = null; Picture pic = (Picture)getObjectSelected(); //on recupere l'image selectionnee if (pic != null) { currentPicture = pic; updateInformation(getAllDataPicture()); } else currentPicture = null; }
//trouve l'index d'une image par le chemin dans une list d'image // en parametre : la liste et l'image voulue private int findIndexPicture(List<Picture> list, Picture p) { return list.FindIndex(x => x.fname == p.fname && x.name==p.name); }
private void miniatureView_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); miniatureView.Focus(); if (files != null) { foreach (string file in files) { if (checkedFile(file)) { //ajout de tag par default List<string> tags = new List<string>(); tags.Add("vacances"); Picture pic = new Picture(); miniatureView.BeginUpdate(); pic.fname = file; pic.name = getNameOfImage(file, "\\") + getCopyNumber(getNameOfImage(file, "\\")); pic.tags = tags; currentAlbum.content.Add(pic); updateListView(currentAlbum); miniatureView.EndUpdate(); } else MessageBox.Show("l'application ne gère pas l'extension " + System.IO.Path.GetExtension(file)); } } }
private void deletePicturefromDefaultAlbum(Picture z) { Picture u = new Picture(); bool ret = false; foreach (Picture i in this.defaultAlbum.content) { if (z.fname == i.fname || z.name == i.name) { ret = true; u = i; break; } } this.defaultAlbum.content.Remove(u); }
private void deletePicture() { Album z = new Album(); bool pict_deletion = false; Picture temp = new Picture(); ListViewItem tmp = new ListViewItem(); // On regarde de quelle image il s'agit et de quel album ! foreach (Album u in this.album_list) { if (u.name == this.currentAlbum.name && u.name != "default") { foreach (Picture i in u.content) { foreach (ListViewItem a in this.miniatureView.SelectedItems) { if (a.Text == i.name || a.Text == i.fname) { temp = i; tmp = a; pict_deletion = true; break; } } if (pict_deletion) { // this.miniatureView.BeginUpdate(); // this.miniatureView.Items.Remove(tmp); // this.miniatureView.EndUpdate(); break; } } if (pict_deletion) { u.content.Remove(temp); break; } z = u; } } foreach (Album a in this.album_list) if (a.name == "default") { foreach (Picture b in a.content) { if (b.name == temp.name || b.fname == temp.fname) { temp = b; break; } } a.content.Remove(temp); break; } updateListView(z); }
private bool addTag(Picture pic, string addtag) { foreach (string tag in list_tags.Items) { if (pic != null && pic.tags.Contains(tag) == false) { pic.tags.Add(addtag); return true; } } return false; }
private void addPictureToSelectedAlbum(object sender, EventArgs e) { // We do know that if we arrive here it is because... The file is already validated ! Album u = new Album(); Album z = new Album(); Picture n = new Picture(); bool ret = false; if (newPicture.tttt != null) { n = this.newPicture.tttt; n.fname = newPicture.tttt.fname; n.name = newPicture.tttt.name = n.fname; // MessageBox.Show("New Picture Added \r\n " + n.fname + "\r\n" + n.name); foreach (Album y in this.album_list) { if (y.name == "default") { z = y; ret = true; break; } if (y.name == this.currentAlbum.name) { ret = true; u = y; break; } } if (ret) { u.content.Add(n); z.content.Add(n); } this.newPicture.Close(); // refresh ListView... updateListView(u); } }
//mettre a jour l'image courante private void updateCurrentPicture(int index) { currentPicture = currentAlbum.content[index]; }