Beispiel #1
0
        /// <summary>
        /// Gets called when all subtitle processing is finished (or cancelled).
        /// </summary>
        private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (dialogProgress != null)
            {
                dialogProgress.Hide();
                dialogProgress = null;
            }

            if (e.Error != null)
            {
                UtilsMsg.showErrMsg(e.Error.Message);
                return;
            }

            if (e.Cancelled)
            {
                MessageBox.Show("Action cancelled.", UtilsAssembly.Title, MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }

            TimeSpan   workerTotalTime = DateTime.Now - workerStartTime;
            WorkerVars workerVars      = e.Result as WorkerVars;
            string     srsFormat       = getSrsFormatList();
            string     endMessage      = $"Processing completed in {workerTotalTime.TotalMinutes:0.00} minutes.\n\n{srsFormat}";

            UtilsMsg.showInfoMsg(endMessage);
        }
        /// <summary>
        /// Called when the audio extraction thread completes.
        /// </summary>
        private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (dialogProgress != null)
            {
                dialogProgress.Hide();
                dialogProgress = null;
            }

            if (e.Error != null)
            {
                UtilsMsg.showErrMsg(e.Error.Message);
                return;
            }

            if (e.Cancelled)
            {
                MessageBox.Show("Action cancelled.", UtilsAssembly.Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            TimeSpan workerTotalTime = DateTime.Now - this.workerStartTime;

            WorkerVars workerVars = e.Result as WorkerVars;
            string     endMessage = String.Format("Audio extraction completed in {0:0.00} minutes.",
                                                  workerTotalTime.TotalMinutes);

            UtilsMsg.showInfoMsg(endMessage);
        }
        /// <summary>
        /// Update the information related to Subs1 or Subs2.
        /// </summary>
        private void updateSubs(int subsNum)
        {
            TextBox textbox;
            string  file;

            // Get items that depend on whether it's subs1 or subs2
            if (subsNum == 1)
            {
                textbox = this.textBoxSubs1File;
                file    = this.textBoxSubs1File.Text.Trim();
            }
            else
            {
                textbox = this.textBoxSubs2File;
                file    = this.textBoxSubs2File.Text.Trim();
            }

            // If input file is an MKV, show the MKV track select dialog
            if (Path.GetExtension(file) == ".mkv")
            {
                List <MkvTrack> allSubTrackList = UtilsMkv.getSubtitleTrackList(file);
                List <MkvTrack> subTrackList    = new List <MkvTrack>();

                // Remove VOBSUB tracks
                foreach (MkvTrack subTrack in allSubTrackList)
                {
                    if (subTrack.Extension != "sub")
                    {
                        subTrackList.Add(subTrack);
                    }
                }

                if (subTrackList.Count == 0)
                {
                    UtilsMsg.showInfoMsg("This .mkv file does not contain any subtitle tracks.");
                    textbox.Text = "";
                }
                else
                {
                    DialogSelectMkvTrack mkvDlg = new DialogSelectMkvTrack(file, subsNum, subTrackList);
                    DialogResult         result = mkvDlg.ShowDialog();

                    if (result == DialogResult.OK)
                    {
                        textbox.Text = mkvDlg.ExtractedFile;
                    }
                    else
                    {
                        textbox.Text = "";
                    }
                }

                return; // Since textbox.Text was changed, this routine will be called again
            }
        }
Beispiel #4
0
        private void backgroundWorkerMain_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                // Don't care
            }
            else if (e.Error != null)
            {
                UtilsMsg.showErrMsg("Something went wrong: " + e.Error.Message);
            }
            else
            {
                UtilsMsg.showInfoMsg("Extraction complete.");
            }

            resetGuiToStartingState();
        }
        /// <summary>
        /// Called when the Dueling Subtitles creation thread completes.
        /// </summary>
        private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (dialogProgress != null)
            {
                dialogProgress.Hide();
                dialogProgress = null;
            }

            if (e.Error != null)
            {
                UtilsMsg.showErrMsg(e.Error.Message);
                return;
            }

            if (e.Cancelled)
            {
                MessageBox.Show("Action cancelled.", UtilsAssembly.Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            WorkerVars workerVars = e.Result as WorkerVars;

            UtilsMsg.showInfoMsg("Dueling subtitles have been created successfully.");
        }