Example #1
0
        private void FormEdit_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!bEscape)
            {
                songInfo = GetFields();

                SetChangeFlags();

                if (songInfo.FilePath.Length == 0)
                {
                    songInfo.FilePath     = saveSongInfo.FilePath;
                    songInfo.bFilepathTag = false; // clear "path changed" flag
                }

                if (songInfo.AnyMainFlags())
                {
                    this.DialogResult = MessageBox.Show("Save edited song-tag(s)?", "TunesFiX Editor",
                                                        MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);

                    // If the user plans to move, copy or rename files - be extra cautious!
                    if (this.DialogResult.HasFlag(DialogResult.Yes) && songInfo.bFilepathTag)
                    {
                        if (MessageBox.Show("Caution! File MOVE, COPY or RENAME command:\n\n" +
                                            "\"" + songInfo.FilePath + "\"\n\n" + "Are you sure?", "TunesFiX Editor",
                                            MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button2) == DialogResult.No)
                        {
                            songInfo.bFilepathTag = false;
                        }
                    }
                }
                else
                {
                    if (songInfo.bFilepathTag)
                    {
                        this.DialogResult = MessageBox.Show("File MOVE, COPY or RENAME command:\n\n" +
                                                            "\"" + songInfo.FilePath + "\"\n\n" + "Are you sure?", "TunesFiX Editor",
                                                            MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
                    }
                    else
                    {
                        this.DialogResult = MessageBox.Show("No changes were made. Add/Save tag(s) anyway?", "TunesFiX Editor",
                                                            MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
                    }
                }
            }
            else
            {
                this.DialogResult = DialogResult.No; // User hit escape key
            }
        }