Beispiel #1
0
        private void OnConvertClick(object sender, RoutedEventArgs e)
        {
            Debug.Assert(_parentFrame != null);
            if (_parentFrame == null)
            {
                return;
            }

            _isConverting        = true;
            _isConversionError   = false;
            btnConvert.IsEnabled = false;

            if (_converterOutput == null)
            {
                _converterOutput = new FileListConverterOutput();
            }
            _converterOutput.Options = _options;
            _converterOutput.Subscribe(this);

            if (chkContinueOnError.IsChecked != null)
            {
                _converterOutput.ContinueOnError = chkContinueOnError.IsChecked.Value;
            }
            _converterOutput.SourceFiles = _listItems.FileItems;
            _converterOutput.OutputDir   = txtOutputDir.Text;

            _parentFrame.Content = _converterOutput;

            //_converterOutput.Convert();
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                        new ConvertHandler(_converterOutput.Convert));
        }
        private void OnWindowContentRendered(object sender, EventArgs e)
        {
            if (_options == null || !_options.IsValid)
            {
                return;
            }

            MainApplication theApp = (MainApplication)Application.Current;

            Debug.Assert(theApp != null);
            if (theApp == null)
            {
                return;
            }
            ConverterCommandLines commandLines = theApp.CommandLines;

            Debug.Assert(commandLines != null);
            if (commandLines == null || commandLines.IsEmpty)
            {
                return;
            }
            IList <string> sourceFiles = commandLines.SourceFiles;

            if (sourceFiles == null || sourceFiles.Count == 0)
            {
                string sourceFile = commandLines.SourceFile;
                if (String.IsNullOrEmpty(sourceFile) ||
                    !File.Exists(sourceFile))
                {
                    return;
                }
                sourceFiles = new List <string>();
                sourceFiles.Add(sourceFile);
            }

            _isConverting = true;

            if (_converterOutput == null)
            {
                _converterOutput = new FileListConverterOutput();
            }

            _options.Update(commandLines);

            _converterOutput.Options = _options;
            _converterOutput.Subscribe(this);

            _converterOutput.ContinueOnError = commandLines.ContinueOnError;
            _converterOutput.SourceFiles     = sourceFiles;
            _converterOutput.OutputDir       = commandLines.OutputDir;

            frameConverter.Content = _converterOutput;

            //_converterOutput.Convert();
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                        new ConvertHandler(_converterOutput.Convert));
        }
        private void OnWindowContentRendered(object sender, EventArgs e)
        {
            if (_options == null || !_options.IsValid)
            {
                return;
            }

            MainApplication theApp = (MainApplication)Application.Current;
            Debug.Assert(theApp != null);
            if (theApp == null)
            {
                return;
            }
            ConverterCommandLines commandLines = theApp.CommandLines;
            Debug.Assert(commandLines != null);
            if (commandLines == null || commandLines.IsEmpty)
            {
                return;
            }
            IList<string> sourceFiles = commandLines.SourceFiles;
            if (sourceFiles == null || sourceFiles.Count == 0)
            {
                string sourceFile = commandLines.SourceFile;
                if (String.IsNullOrEmpty(sourceFile) ||
                    !File.Exists(sourceFile))
                {
                    return;
                }
                sourceFiles = new List<string>();
                sourceFiles.Add(sourceFile);
            }

            _isConverting = true;

            if (_converterOutput == null)
            {
                _converterOutput = new FileListConverterOutput();
            }

            _options.Update(commandLines);

            _converterOutput.Options = _options;
            _converterOutput.Subscribe(this);

            _converterOutput.ContinueOnError = commandLines.ContinueOnError;
            _converterOutput.SourceFiles = sourceFiles;
            _converterOutput.OutputDir  = commandLines.OutputDir;

            frameConverter.Content = _converterOutput;

            //_converterOutput.Convert();
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                new ConvertHandler(_converterOutput.Convert));
        }