private void mainWindow_ContentRendered(object sender, EventArgs e) { // In case the application was started from a web browser and receives command-line arguments if (args.Length == 2) { if (args[1].StartsWith("http")) { System.Windows.Clipboard.SetText(args[1]); NewDownload newDownloadDialog = new NewDownload(this); newDownloadDialog.ShowDialog(); } } }
void mainWindow_ContentRendered(object sender, EventArgs e) { // In case the application was started from a web browser and receives command-line arguments if (args.Length == 2) { if (args[1].StartsWith("http", StringComparison.OrdinalIgnoreCase)) { Clipboard.SetText(args[1]); var newDownloadDialog = new NewDownload(this); newDownloadDialog.ShowDialog(); } } }
// This method is executed if you start the SGet process from an external application, e.g. a web browser which sends the URL of the file to download public bool SignalExternalCommandLineArgs(IList <string> args) { // Check if the command-line arguments were sent and if the NewDownload window is already open if ((args.Count == 2) && args[1].ToString().StartsWith("http") && !IsWindowAlreadyOpen(typeof(NewDownload))) { // The first argument args[0] contains the path to the SGet process // The second argument args[1] contains the URL of the file to download, which is set as text in the Clipboard Clipboard.SetText(args[1].ToString()); // Open the Add New Download window and ensure it's on the top NewDownload newDownloadDialog = new NewDownload((MainWindow)Application.Current.MainWindow); newDownloadDialog.Topmost = true; newDownloadDialog.ShowDialog(); } return(true); }
// This method is executed if you start the SGet process from an external application, e.g. a web browser which sends the URL of the file to download public bool SignalExternalCommandLineArgs(IList<string> args) { // Check if the command-line arguments were sent and if the NewDownload window is already open if ((args.Count == 2) && args[1].ToString().StartsWith("http") && !IsWindowAlreadyOpen(typeof(NewDownload))) { // The first argument args[0] contains the path to the SGet process // The second argument args[1] contains the URL of the file to download, which is set as text in the Clipboard Clipboard.SetText(args[1].ToString()); // Open the Add New Download window and ensure it's on the top NewDownload newDownloadDialog = new NewDownload((MainWindow)Application.Current.MainWindow); newDownloadDialog.Topmost = true; newDownloadDialog.ShowDialog(); } return true; }
private void btnNewDownload_Click(object sender, RoutedEventArgs e) { NewDownload newDownloadDialog = new NewDownload(this); newDownloadDialog.ShowDialog(); }