/// <summary> /// Initializes the main window. /// </summary> private void InitializeMainWindow() { Loaded += MainWindow_Loaded; UrlTextBox.Text = HistoryItems.Count > 0 ? HistoryItems.First() : string.Empty; OpenMediaPopup.Opened += (s, e) => { if (UrlTextBox.ItemsSource == null) { UrlTextBox.ItemsSource = HistoryItems; } if (HistoryItems.Count > 0) { UrlTextBox.Text = HistoryItems.First(); } UrlTextBox.Focus(); }; UrlTextBox.KeyDown += async(s, e) => { if (e.Key == Key.Enter) { await OpenCommand.ExecuteAsync(); e.Handled = true; } }; // Open a file if it is specified in the arguments var args = Environment.GetCommandLineArgs(); if (args != null && args.Length > 1) { UrlTextBox.Text = args[1].Trim(); OpenCommand.Execute(); } }
/// <summary> /// Initializes the main window. /// </summary> private void InitializeMainWindow() { Loaded += MainWindow_Loaded; OpenFileTextBox.KeyDown += async(s, e) => { if (e.Key == Key.Enter) { await OpenCommand.ExecuteAsync(); e.Handled = true; } }; // Open a file if it is specified in the arguments var args = Environment.GetCommandLineArgs(); if (args != null && args.Length > 1) { OpenFileTextBox.Text = args[1].Trim(); OpenCommand.Execute(); } }