void OK_Click(object sender, RoutedEventArgs e) { try { Link = new Uri(DownloadLinkComboBox.Text); } catch (UriFormatException) { MessageBox.Show("Invalid link!"); return; } // Prepending the new download link to the beginning of the text file // (if the same link already exists, it will be removed before the link is prepended) Helper.PrependTextFile("UrlHistory.txt", DownloadLinkComboBox.Text); bool duplicateDownload = Downloads.DownloadEntries.Any(download => download.DownloadLink == Link); if (duplicateDownload != true) { DownloadFileInfo DownBox; if (UseAuth.IsChecked.Value) { DownBox = new DownloadFileInfo(Link, AuthUser.Text, AuthPass.Password); } else { DownBox = new DownloadFileInfo(Link); } DownBox.Show(); } else { var duplicate_diag = new Dialogs.Warnings.DuplicateDownloadLink(); duplicate_diag.Owner = Application.Current.MainWindow; duplicate_diag.DownloadLink.Text = Link.ToString(); duplicate_diag.Show(); } this.Close(); }
void OK_Click(object sender, RoutedEventArgs e) { try { Link = new Uri(DownloadLinkComboBox.Text); } catch (UriFormatException) { MessageBox.Show("Invalid link!"); return; } // Prepending the new download link to the beginning of the text file // (if the same link already exists, it will be removed before the link is prepended) Helper.PrependTextFile("UrlHistory.txt", DownloadLinkComboBox.Text); bool duplicateDownload = Downloads.DownloadEntries.Any(download => download.DownloadLink == Link); if (duplicateDownload != true) { DownloadFileInfo DownBox; if (UseAuth.IsChecked.Value) DownBox = new DownloadFileInfo(Link, AuthUser.Text, AuthPass.Password); else DownBox = new DownloadFileInfo(Link); DownBox.Show(); } else { var duplicate_diag = new Dialogs.Warnings.DuplicateDownloadLink(); duplicate_diag.Owner = Application.Current.MainWindow; duplicate_diag.DownloadLink.Text = Link.ToString(); duplicate_diag.Show(); } this.Close(); }