Пример #1
0
        /// ------------------------------------------------------------------------------------
        private bool InstallDownloadedFile(string downloadedZipFile)
        {
            var errorMsg = string.Format(LocalizationManager.GetString(
                                             "DialogBoxes.FFmpegDownloadDlg.InstallingDownloadedFileErrorMsg",
                                             "The file '{0}'\r\n\r\neither does not contain ffmpeg or is not a valid zip file."),
                                         downloadedZipFile);

            if (!FFmpegDownloadHelper.GetIsValidFFmpegForSayMoreFile(downloadedZipFile, errorMsg))
            {
                _state = ProgressState.DownloadCanceled;
                return(false);
            }

            _progressControl.SetStatusMessage(LocalizationManager.GetString(
                                                  "DialogBoxes.FFmpegDownloadDlg.InstallingDownloadedFileMsg", "Installing..."));

            Application.DoEvents();

            errorMsg = string.Format(LocalizationManager.GetString(
                                         "DialogBoxes.FFmpegDownloadDlg.InstallingDownloadedFileErrorMsg",
                                         "There was an error installing the downloaded file:\r\n\r\n{0}"),
                                     downloadedZipFile);

            return(FFmpegDownloadHelper.ExtractDownloadedZipFile(downloadedZipFile, errorMsg));
        }
Пример #2
0
        /// ------------------------------------------------------------------------------------
        private void HandleManualDownloadLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (_state != ProgressState.NotStarted && _state != ProgressState.DownloadCanceled)
            {
                return;
            }

            var prs = new Process();

            prs.StartInfo.FileName = FFmpegDownloadHelper.GetFFmpegForSayMoreUrl(false);
            prs.Start();
        }
Пример #3
0
        /// ------------------------------------------------------------------------------------
        private void HandleDownloadAndInstallClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (_state != ProgressState.NotStarted && _state != ProgressState.DownloadCanceled)
            {
                return;
            }

            UseWaitCursor               = true;
            _downloadHelper             = new FFmpegDownloadHelper();
            _downloadHelper.OnFinished += HandleDownloadProgressFinished;
            _progressControl.Initialize(_downloadHelper);

            _state = ProgressState.DownloadStarted;
            UpdateDisplay();
            _downloadHelper.Start();
        }
Пример #4
0
        /// ------------------------------------------------------------------------------------
        private void HandleDownloadProgressFinished(object sender, ProgressFinishedArgs e)
        {
            _buttonAbort.Visible = false;

            if (e.ProgressCanceled)
            {
                _state = ProgressState.DownloadCanceled;
            }
            else if (InstallDownloadedFile(_downloadHelper.DownloadedZipFilePath))
            {
                MessageBox.Show(this, LocalizationManager.GetString(
                                    "DialogBoxes.FFmpegDownloadDlg.DownloadCompleteMsg",
                                    "Downloading and Installing Completed Successfully."), Text);
                Close();
                return;
            }

            _downloadHelper = null;
            UpdateDisplay();
            UseWaitCursor = false;
        }