private void OpenAlbum(string path) { string password = null; if (path != null && path.Length > 0 && AlbumController.CheckAlbumPassword(path, ref password)) { if (CloseAlbum()) { return; // cancel open } try { Manager = new AlbumManager( path, password); } catch (AlbumStorageException) { Manager = null; } } DisplayAlbum(); UpdateTabs(); EnablePhotoButtons(); }
public AlbumManager GetManager(bool interactive) { if (_manager == null) { string path = AlbumPath; string pwd = null; try { if (AlbumStorage.IsEncrypted(path)) { DialogResult result = DialogResult.None; if (interactive) { result = MessageBox.Show("The album " + path + " is encrypted. " + "Do you wish to open this album?", "Encrypted Album", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); } if (result != DialogResult.Yes || !AlbumController.CheckAlbumPassword(path, ref pwd)) { return(null); // cancelled } } _manager = new AlbumManager(path, pwd); this.ImageKey = "Album"; this.SelectedImageKey = "AlbumSelect"; } catch (AlbumStorageException ex) { if (interactive) { MessageBox.Show("The album could not " + "be opened [" + ex.Message + "]"); } this.ImageKey = "AlbumError"; this.SelectedImageKey = "AlbumError"; _manager = null; } } return(_manager); }