Beispiel #1
0
        private void BtUpdateFileLocation_Click(object sender, EventArgs e)
        {
            FormProgressBackground.Execute(this,
                                           DatabaseDataMigrate.UpdateSongLocations(fbdDirectory, Connection),
                                           DBLangEngine.GetMessage("msgDatabaseUpdate", "Database update|A message describing that the software is updating it's database."),
                                           DBLangEngine.GetMessage("msgProgressPercentage",
                                                                   "Progress: {0} %|A message describing some operation progress in percentage."));

            // indicate to the user that a software restart is required..
            tbRestartRequired.Visible = true;

            // indicate that the application should be restarted after the operation..
            FormMain.RestartRequired = true;
        }
Beispiel #2
0
        private void BtDeleteNonExistingSongs_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(
                    DBLangEngine.GetMessage("msgQueryUserDeleteNonExistingSongs",
                                            "Really delete non-existing files from the database?|A message requesting for user confirmation to delete non-existing files from the database."),
                    DBLangEngine.GetMessage("msgConfirmation",
                                            "Confirm|Used in a dialog title to ask for a confirmation to do something"),
                    MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) ==
                DialogResult.Yes)
            {
                // indicate to the user that a software restart is required..
                tbRestartRequired.Visible = true;

                FormProgressBackground.Execute(this,
                                               DatabaseDataMigrate.DeleteNonExistingSongs(Connection),
                                               DBLangEngine.GetMessage("msgDatabaseUpdate", "Database update|A message describing that the software is updating it's database."),
                                               DBLangEngine.GetMessage("msgProgressPercentage",
                                                                       "Progress: {0} %|A message describing some operation progress in percentage."));

                // indicate that the application should be restarted after the operation..
                FormMain.RestartRequired = true;
            }
        }
Beispiel #3
0
    /// <summary>
    /// Copies the queue files into a given directory and optionally converts the files to MP3 format.
    /// </summary>
    /// <param name="queueIdentifier">The database ID number for the queue.</param>
    /// <param name="toFolder">The folder to copy the files to.</param>
    /// <param name="connection">A reference to a <see cref="SQLiteConnection"/> class instance.</param>
    /// <param name="convertToMp3">A value indicating whether to convert the file to a MP3 format.</param>
    /// <param name="staticStatusText">A text to be shown as a static title describing the process.</param>
    /// <param name="statusLabelText">A text to display the progress percentage in the status label of the form. One place holder for the progress percentage must be reserved (i.e. {0}).</param>
    /// <param name="outputBitRate">A bit rate for an MP3 file if a file is requested to be converted into a MP3 format.</param>
    /// <param name="parentForm">the parent form to which the progress dialog should be aligned to the center of.</param>
    public static void RunWithDialog(Form parentForm, int queueIdentifier, string toFolder,
                                     SQLiteConnection connection, bool convertToMp3, string staticStatusText, string statusLabelText,
                                     int outputBitRate = 256000)
    {
        worker = new BackgroundWorker {
            WorkerReportsProgress = true, WorkerSupportsCancellation = true
        };
        queueIndex     = queueIdentifier;
        toPath         = toFolder;
        conn           = connection;
        toMp3          = convertToMp3;
        bitRate        = outputBitRate;
        form           = parentForm;
        worker.DoWork += Worker_DoWork;
        FormProgressBackground.Execute(form, worker, staticStatusText, statusLabelText);

        worker.DoWork -= Worker_DoWork;

        using (worker)
        {
            worker = null;
        }
    }