コード例 #1
0
ファイル: ConvertMediaDlg.cs プロジェクト: vkarthim/saymore
        /// ------------------------------------------------------------------------------------
        public static string Show(string inputFile, string initialConversionName)
        {
            var viewModel = new ConvertMediaDlgViewModel(inputFile, initialConversionName);

            using (var dlg = new ConvertMediaDlg(viewModel))
                return(dlg.ShowDialog() == DialogResult.Cancel ? null : viewModel.OutputFileCreated);
        }
コード例 #2
0
        public static void Show(string inputFile, string initialConversionName, string outputFile)
        {
            var viewModel = new ConvertMediaDlgViewModel(inputFile, initialConversionName, outputFile);

            using (var dlg = new ConvertMediaDlg(viewModel, true))
                dlg.ShowDialog();
        }
コード例 #3
0
ファイル: ConvertMediaDlg.cs プロジェクト: vkarthim/saymore
        /// ------------------------------------------------------------------------------------
        public ConvertMediaDlg(ConvertMediaDlgViewModel viewModel) : this()
        {
            Logger.WriteEvent("ConvertMediaDlg constructor. file = {0}", viewModel.InputFile);
            _viewModel = viewModel;

            _showOutput = Settings.Default.ShowFFmpegDetailsWhenConvertingMedia;

            if (Settings.Default.ConvertMediaDlg == null)
            {
                StartPosition = FormStartPosition.CenterScreen;
                Settings.Default.ConvertMediaDlg = FormSettings.Create(this);
            }

            InitializeFonts();
            _labelFileToConvertValue.Text = Path.GetFileName(_viewModel.InputFile);
            if (_viewModel.MediaInfo == null)
            {
                _labelStatus.Text = LocalizationManager.GetString("DialogBoxes.ConvertMediaDlg.InvalidMediaFile",
                                                                  "File does not appear to be a valid media file.");
                _labelStatus.ForeColor = Color.Red;
            }
            else
            {
                _labelOutputFileValue.Text = _viewModel.GetNewOutputFileName(true);
                _comboAvailableConversions.Items.AddRange(_viewModel.AvailableConversions);
                _comboAvailableConversions.SelectedItem              = _viewModel.SelectedConversion;
                _comboAvailableConversions.SelectionChangeCommitted += delegate
                {
                    _viewModel.SelectedConversion = _comboAvailableConversions.SelectedItem as FFmpegConversionInfo;
                    _labelOutputFileValue.Text    = _viewModel.GetNewOutputFileName(true);
                    UpdateDisplay();
                };

                _buttonBeginConversion.Click += HandleBeginConversionClick;
                _buttonCancel.Click          += delegate { _viewModel.Cancel(); };

                _buttonCancel.MouseMove += delegate
                {
                    // Not sure why both of these are necessary, but it seems to be the case.
                    _buttonCancel.UseWaitCursor = false;
                    _buttonCancel.Cursor        = Cursors.Default;
                };
            }

            _buttonDownload.Click += delegate
            {
                using (var dlg = new FFmpegDownloadDlg())
                    dlg.ShowDialog(this);
                _viewModel.SetConversionStateBasedOnPresenceOfFfmpegForSayMore();
                UpdateDisplay();
            };

            _buttonShowOutput.Click += delegate
            {
                _showOutput = true;
                UpdateDisplay();
            };

            _buttonHideOutput.Click += delegate
            {
                _showOutput = false;
                UpdateDisplay();
            };

            _labelDownloadNeeded.Tag          = _labelDownloadNeeded.Text;
            LocalizeItemDlg.StringsLocalized += HandleStringsLocalized;

            Program.SuspendBackgroundProcesses();
        }