private void AssignSelectDropDown() { ToolStripDropDown drop = new ToolStripDropDown(); PhotoAlbum.PhotoAlbum a = Manager.Album; for (int i = 0; i < a.Count; i++) { PictureBox box = new PictureBox(); box.SizeMode = PictureBoxSizeMode.Zoom; box.Image = a[i].Image; box.Dock = DockStyle.Fill; ToolStripControlHost host = new ToolStripControlHost(box); host.AutoSize = false; host.Size = new Size(tssSelect.Width, tssSelect.Width); host.Tag = i; host.Click += delegate(object o, EventArgs e) { int x = (int)(o as ToolStripItem).Tag; Manager.Index = x; drop.Close(); DisplayAlbum(); }; drop.Items.Add(host); } if (drop.Items.Count > 0) { tssSelect.DropDown = drop; tssSelect.DefaultItem = drop.Items[0]; } }
protected override void ResetDialog() { PhotoAlbum.PhotoAlbum album = Manager.Album; // Assign text boxes txtAlbumFile.Text = Manager.FullName; txtTitle.Text = album.Title; // Assign radio button switch (album.PhotoDescriptor) { case PhotoAlbum.PhotoAlbum.DescriptorOption.Caption: rbtnCaption.Checked = true; break; case PhotoAlbum.PhotoAlbum.DescriptorOption.DateTaken: rbtnDateTaken.Checked = true; break; case PhotoAlbum.PhotoAlbum.DescriptorOption.FileName: rbtnFileName.Checked = true; break; } // Assign check box string pwd = Manager.Password; cbxPassword.Checked = (pwd != null && pwd.Length > 0); txtPassword.Text = pwd; txtConfirm.Text = pwd; }
private void SaveSettings() { PhotoAlbum.PhotoAlbum album = Manager.Album; if (album != null) { album.Title = txtTitle.Text; if (rbtnCaption.Checked) { album.PhotoDescriptor = PhotoAlbum.PhotoAlbum.DescriptorOption.Caption; } else if (rbtnDateTaken.Checked) { album.PhotoDescriptor = PhotoAlbum.PhotoAlbum.DescriptorOption.DateTaken; } else if (rbtnFileName.Checked) { album.PhotoDescriptor = PhotoAlbum.PhotoAlbum.DescriptorOption.FileName; } if (cbxPassword.Checked && ValidPassword()) { Manager.Password = txtPassword.Text; } else { Manager.Password = null; } } }
public static string addItem(PhotoAlbum parent) { AddItem item = new AddItem(parent); if (item.ShowDialog(parent) == DialogResult.OK) { return item.result; } return null; }
static void Main(string[] args) { //try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); PhotoAlbum main = new PhotoAlbum(args); if (!main.exitApplication) { Application.Run(main); } } //catch (Exception e) //{ //MessageBox.Show(e.ToString(), "An unknown or unhandled error occured"); //Application.Exit(); //} }
private void AssignSubItems(ListViewItem item, string path, AlbumManager mgr) { item.SubItems.Clear(); item.Text = Path.GetFileNameWithoutExtension(path); ListViewItem.ListViewSubItem subitem; if (mgr == null) { item.Tag = path; item.SubItems.Add(""); subitem = item.SubItems.Add("?"); subitem.Tag = 999; } else { PhotoAlbum.PhotoAlbum album = mgr.Album; int count = album.Count; item.Tag = mgr; item.SubItems.Add(album.Title); subitem = item.SubItems.Add(count.ToString()); subitem.Tag = count; } }
public AlbumManager() { album = new PhotoAlbum(); }
static public void WriteAlbum(PhotoAlbum album, string path) { WriteAlbum(album, path, null); }
static public PhotoAlbum ReadAlbum(string path, string password) { StreamReader sr = null; try { string version; if (password == null || password.Length == 0) { sr = new StreamReader(path); version = sr.ReadLine(); if (version.EndsWith("e")) { throw new AlbumStorageException("A password is required to open the album"); } } else { // Create CryptoReader to use as StreamReader CryptoReader cr = new CryptoReader(path, password); version = cr.ReadUnencryptedLine(); if (!version.EndsWith("e")) { // Decryption not required cr.Close(); sr = new StreamReader(path); version = sr.ReadLine(); } else { string checkLine = cr.ReadLine(); if (checkLine != password) { throw new AlbumStorageException("The given password is not valid"); } sr = cr; } } PhotoAlbum album = new PhotoAlbum(); switch (version) { case "63": ReadAlbumV63(sr, album); break; case "91": case "91e": ReadAlbumV91(sr, album); break; default: throw new AlbumStorageException("Unrecognized album version"); } album.HasChanged = false; return(album); } catch (System.Security.Cryptography.CryptographicException cex) { throw new AlbumStorageException("Unable to decrypt album " + path, cex); } catch (FileNotFoundException fnx) { throw new AlbumStorageException("Unable to read album " + path, fnx); } finally { if (sr != null) { sr.Close(); } } }
public Options(PhotoAlbum parent) { InitializeComponent(); this.parent = parent; initializeOptions(); }
/// <summary> /// Stops the timer that performs automatic insertions. /// </summary> public void StopAutomaticInsertions() { albumForAutomaticInsertions = null; automaticInsertionTimer?.Stop(); automaticInsertionTimer = null; }
/// <summary> /// Adds a photo to the album. /// </summary> public void Add(Photo photo, PhotoAlbum toAlbum) { var albumIndex = Albums.IndexOf(toAlbum); Albums[albumIndex].Photos.Insert(0, photo); }
private AddItem(PhotoAlbum parent) { InitializeComponent(); this.parent = parent; }
/// <summary> /// Configures the cell to display the album. /// </summary> public void Configure(PhotoAlbum album) { Accessory = UITableViewCellAccessory.DisclosureIndicator; TextLabel.Text = album.Title; ImageView.Image = album?.Thumbnail; }
public AlbumManager(string name, string pwd) : this() { this.name = name; album = AlbumStorage.ReadAlbum(name, pwd); Password = pwd; }
public void DragSessionDidEnd(UICollectionView collectionView, IUIDragSession session) { ReloadAlbumFromPhotoLibrary(); DeleteItems(collectionView); albumBeforeDrag = null; }
public void DragSessionWillBegin(UICollectionView collectionView, IUIDragSession session) { albumBeforeDrag = album; }
/// <summary> /// Inserts the photo at a specific index in the album. /// </summary> public void Insert(Photo photo, PhotoAlbum inAlbum, int index) { var albumIndex = Albums.IndexOf(inAlbum); Albums[albumIndex].Photos.Insert(index, photo); }
public bool Equals(PhotoAlbum p) { return(p.Identifier == Identifier); }
public AlbumTest(BigPhotoAlbum bigPhoto, PhotoAlbum photoAlbum, PhotoAlbum photoAlbum1) { _BigPhotoAlbum = bigPhoto; _photoAlbum = photoAlbum; _photoAlbum1 = photoAlbum1; }