public MainWindow() { InitializeComponent(); this.MinWidth = 640; this.MinHeight = 700; this.Width = 720; this.Height = 700; _startTabIndex = 0; _options = new ConverterOptions(); MainApplication theApp = (MainApplication)Application.Current; Debug.Assert(theApp != null); if (theApp != null) { ConverterCommandLines commandLines = theApp.CommandLines; if (commandLines != null) { if (commandLines.IsEmpty) { IList <string> sources = commandLines.Arguments; _displayHelp = commandLines.ShowHelp || (sources != null && sources.Count != 0); } else { _options.Update(commandLines); } } else { _displayHelp = true; } if (!_displayHelp) { string sourceFile = commandLines.SourceFile; if (!String.IsNullOrEmpty(sourceFile) && File.Exists(sourceFile)) { _startTabIndex = 1; } else { string sourceDir = commandLines.SourceDir; if (!String.IsNullOrEmpty(sourceDir) && Directory.Exists(sourceDir)) { _startTabIndex = 3; } else { IList <string> sourceFiles = commandLines.SourceFiles; if (sourceFiles != null && sourceFiles.Count != 0) { _startTabIndex = 2; } } } } } _filesPage = new FileConverterPage(); _filesPage.Options = _options; _filesPage.ParentFrame = filesFrame; _filesPage.Subscribe(this); filesFrame.Content = _filesPage; _filesListPage = new FileListConverterPage(); _filesListPage.Options = _options; _filesListPage.ParentFrame = filesListFrame; _filesListPage.Subscribe(this); filesListFrame.Content = _filesListPage; _directoriesPage = new DirectoryConverterPage(); _directoriesPage.Options = _options; _directoriesPage.ParentFrame = directoriesFrame; _directoriesPage.Subscribe(this); directoriesFrame.Content = _directoriesPage; _optionsPage = new OptionsPage(); _optionsPage.Options = _options; optionsFrame.Content = _optionsPage; this.Loaded += new RoutedEventHandler(OnWindowLoaded); this.Unloaded += new RoutedEventHandler(OnWindowUnloaded); this.Closing += new CancelEventHandler(OnWindowClosing); }
public MainWindow() { InitializeComponent(); this.MinWidth = 640; this.MinHeight = 700; this.Width = 720; this.Height = 700; _startTabIndex = 0; _options = new ConverterOptions(); MainApplication theApp = (MainApplication)Application.Current; Debug.Assert(theApp != null); if (theApp != null) { ConverterCommandLines commandLines = theApp.CommandLines; if (commandLines != null) { if (commandLines.IsEmpty) { IList<string> sources = commandLines.Arguments; _displayHelp = commandLines.ShowHelp || (sources != null && sources.Count != 0); } else { _options.Update(commandLines); } } else { _displayHelp = true; } if (!_displayHelp) { string sourceFile = commandLines.SourceFile; if (!String.IsNullOrEmpty(sourceFile) && File.Exists(sourceFile)) { _startTabIndex = 1; } else { string sourceDir = commandLines.SourceDir; if (!String.IsNullOrEmpty(sourceDir) && Directory.Exists(sourceDir)) { _startTabIndex = 3; } else { IList<string> sourceFiles = commandLines.SourceFiles; if (sourceFiles != null && sourceFiles.Count != 0) { _startTabIndex = 2; } } } } } _filesPage = new FileConverterPage(); _filesPage.Options = _options; _filesPage.ParentFrame = filesFrame; _filesPage.Subscribe(this); filesFrame.Content = _filesPage; _filesListPage = new FileListConverterPage(); _filesListPage.Options = _options; _filesListPage.ParentFrame = filesListFrame; _filesListPage.Subscribe(this); filesListFrame.Content = _filesListPage; _directoriesPage = new DirectoryConverterPage(); _directoriesPage.Options = _options; _directoriesPage.ParentFrame = directoriesFrame; _directoriesPage.Subscribe(this); directoriesFrame.Content = _directoriesPage; _optionsPage = new OptionsPage(); _optionsPage.Options = _options; optionsFrame.Content = _optionsPage; this.Loaded += new RoutedEventHandler(OnWindowLoaded); this.Unloaded += new RoutedEventHandler(OnWindowUnloaded); this.Closing += new CancelEventHandler(OnWindowClosing); }