/// <summary> /// Displays the dialog asking for a name to the queue snapshot. /// </summary> /// <param name="albumName">Name of the album to be used as a suggestion for a name for the snapshot.</param> /// <param name="overrideName">if set to <c>true</c> the name will contain the <paramref name="albumName"/> value.</param> /// <returns>A <see cref="string"/> the user gave for the dialog if the user accepted and the album name wasn't the temporary album; otherwise <see cref="string.Empty"/>.</returns> public static string Execute(string albumName, bool overrideName = false) { if (albumName == "tmp") { MessageBox.Show( DBLangEngine.GetStatMessage("msgTmpAlbumError", "The current album is temporary album.{0}Please create an album with a name before continuing.|Album is a temporary one i.e. you clicked a music file and the program started. Can't save a anything against a temporary album.", Environment.NewLine), DBLangEngine.GetStatMessage("msgError", "Error|A common error that should be defined in another message"), MessageBoxButtons.OK, MessageBoxIcon.Error); return(string.Empty); } FormQueueSnapshotName queueName = new FormQueueSnapshotName(); string namePart = DBLangEngine.GetStatMessage("msgQueue", "Queue|As in a queue snapshot"); if (overrideName) { queueName.tbQueueName.Text = albumName; } else { queueName.tbQueueName.Text = namePart + @": " + albumName + @" - " + DateTime.Now.ToLongDateString() + @" (" + DateTime.Now.ToShortTimeString() + @")"; } if (queueName.ShowDialog() == DialogResult.OK) { return(queueName.tbQueueName.Text); } if (overrideName) { return(albumName); } return(string.Empty); }
// the user wants to import a saved queue from a file.. private void tsbImportQueue_Click(object sender, EventArgs e) { if (odExportQueue.ShowDialog() == DialogResult.OK) { FormMain wnd = Application.OpenForms[0] as FormMain; string queueName = Database.GetQueueSnapshotName(odExportQueue.FileName); queueName = FormQueueSnapshotName.Execute(queueName, true); if (wnd != null && Database.RestoreQueueSnapshotFromFile(wnd.PlayList, conn, wnd.CurrentAlbum, odExportQueue.FileName, queueName)) { RefreshList(); } } }