Esempio n. 1
0
        protected bool CloseCurrentAlbum()
        {
            if (_albumChanged)
            {
                var msg = _album.FileName == null
                    ? "Do you want to save the current album?"
                    : String.Format("Do you want to save changes to {0}", _album.FileName);

                var result = MessageBox.Show(this, msg, "Save album?", MessageBoxButtons.YesNoCancel,
                                             MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    menuSave_Click(this, EventArgs.Empty);
                }
                else if (result == DialogResult.Cancel)
                {
                    return(false);
                }
            }

            if (_album != null)
            {
                _album.Dispose();
            }

            _album = new PhotoAlbum();
            SetTitle();
            _albumChanged = false;

            return(true);
        }
Esempio n. 2
0
 private void menuNew_Click(object sender, EventArgs e)
 {
     if (_album != null)
     {
         _album.Dispose();
     }
     _album = new PhotoAlbum();
     SetTitleBar();
     Invalidate();
 }