private void btnOK_Click(object sender, RoutedEventArgs e) { properties.SaveTo = SaveTo_txtBox.Text; properties.DownloadLink = new System.Uri(Address.Text); properties.Description = Description.Text; properties.AuthUsername = authUser.Text; properties.AuthPassword = authPass.Password; Downloads.Serialize(); this.Close(); }
string SaveDownload() // repeated calls, made a function { Prepender(); string currentDownloadID = Helper.RandomStringGenerator(); Downloads.DownloadEntries.Add(new DownloadEntry { DownloadID = currentDownloadID, FileName = filename, DateAdded = DateTime.Now, LastTryDate = DateTime.Now, Size = filesize, Description = Description.Text, SaveTo = SaveLocationComboBox.Text, Q = "Main Download Queue", DownloadLink = DownloadLink, AuthUsername = authUser, AuthPassword = authPass, ObtainedFrom = obtainedFrom }); Downloads.Serialize(); // Saves added download entry return(currentDownloadID); }
private void CurrentDownload_Completed(object sender, EventArgs e) { Dispatcher.Invoke(() => { Status.Text = "Completed"; downloadData.Status = "Complete"; downloadData.TimeLeft = null; downloadData.TransferRate = null; downloadData.Running = false; Downloads.Serialize(); this.Close(); }); }