private void buttonLoginSave_Click(object sender, EventArgs e) { ProfileLog log = ProfileLog.Create; Profile p = new Profile(); try { var x = new MailAddress(textBoxuserID.Text); p.Email = x.Address; p.Password = textBoxpassword.Text; } catch (FormatException) { textBoxErrorLogin.Text = "Email Format not Accepted"; return; } catch (ArgumentNullException) { textBoxErrorLogin.Text = "Email can not be empty"; return; } if (log.IsContainsProfile(p.Email) == true) { textBoxErrorLogin.Text = "Email is already reistered"; } else { log.Add(p); log.TurnActive(p.Email); comboBoxEmails.Items.Add(p.Email); textBoxErrorLogin.Text = "Succeded"; textBoxuserID.Text = ""; textBoxpassword.Text = ""; } }
private void buttonLoginSave_Click(object sender, EventArgs e) { Profile p = new Profile(); p.Email = textBoxuserID.Text; p.Password = textBoxpassword.Text; ProfileLog.Add(p); }
public void Serialize() { try { using (Stream stream = File.Open("data.bin", FileMode.Create)) { ProfileLog log = ProfileLog.Create; BinaryFormatter bin = new BinaryFormatter(); bin.Serialize(stream, log.ProfileList); } } catch (IOException) { } }
public void Deserialize() { try { using (Stream stream = File.Open("data.bin", FileMode.Open)) { BinaryFormatter bin = new BinaryFormatter(); var profiles = (HashSet <Profile>)bin.Deserialize(stream); foreach (var x in profiles) { Profile p = new Profile(); p.Email = x.Email; p.Password = x.Password; ProfileLog.Add(p); } } } catch (IOException) { } }
private void comboBoxEmails_SelectedIndexChanged(object sender, EventArgs e) { ProfileLog log = ProfileLog.Create; log.TurnActive(comboBoxEmails.SelectedItem.ToString()); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { try { if (radioButtonSpecificDate.Checked == true) { Date1 = dateTimePicker1.Value.Date; Date2 = dateTimePicker2.Value.Date; if (DateTime.Compare(Date1, Date2) >= 0) { MessageBox.Show("Ambigious Dates Error\nDetails:\n\nEither selected Date is same or ambigious difference"); e.Cancel = true; return; } } } catch (Exception) { e.Cancel = true; return; } RelativePath = textBoxFolderAdress.Text; ProfileLog profilelog = ProfileLog.Create; CSVhandler handler = new CSVhandler(); PostedJobsLog jobs = PostedJobsLog.Create; backgroundWorker1.ReportProgress(0); if (backgroundWorker1.CancellationPending == true) { e.Cancel = true; return; } string x = null; try { string password = null; string loginEmail = null; if (comboBoxEmails.InvokeRequired) { comboBoxEmails.Invoke(new Action(() => loginEmail = comboBoxEmails.Text)); // comboBoxEmails.Invoke(new ControlStringConsumer(SetText), new object[] {comboBoxEmails, "" }); } else { loginEmail = comboBoxEmails.Text; } password = profilelog.FindPasswordofThisEmail(loginEmail); x = w.Login(loginEmail, password); } catch (System.Net.WebException) { notifyIcon1.BalloonTipIcon = ToolTipIcon.Error; notifyIcon1.BalloonTipTitle = "Connection Error"; notifyIcon1.BalloonTipText = "Please connect to internet in order to download CV's\n "; notifyIcon1.ShowBalloonTip(1000); e.Cancel = true; return; } if (String.IsNullOrEmpty(x) == false) { MessageBox.Show(x); e.Cancel = true; return; } if (backgroundWorker1.CancellationPending == true) { e.Cancel = true; return; } backgroundWorker1.ReportProgress(1); w.DownloadAllPostedJobs(Date1, Date2, radioButtonSpecificDate.Checked); if (backgroundWorker1.CancellationPending == true) { e.Cancel = true; return; } backgroundWorker1.ReportProgress(2); w.CreateDirectories(); if (backgroundWorker1.CancellationPending == true) { e.Cancel = true; return; } backgroundWorker1.ReportProgress(3); if (backgroundWorker1.CancellationPending == true) { e.Cancel = true; return; } w.OpenAllLinks(Date1, Date2, radioButtonSpecificDate.Checked); backgroundWorker1.ReportProgress(12); if (backgroundWorker1.CancellationPending == true) { e.Cancel = true; return; } try { handler.WriteTheApplicantLists(System.IO.Path.Combine(RelativePath)); } catch (Exception eX) { MessageBox.Show(eX.Message); } backgroundWorker1.ReportProgress(18); if (backgroundWorker1.CancellationPending == true) { e.Cancel = true; return; } x = handler.WriteFolderApplicantLists(RelativePath); if (String.IsNullOrEmpty(x) == false) { MessageBox.Show(x); } if (radioButtonRecent.Checked == false && radioButtonSpecificDate.Checked == true) { w.DownloadCVS(textBoxFolderAdress.Text); } else if (radioButtonRecent.Checked == true && radioButtonSpecificDate.Checked == false) { w.DownloadCVS(textBoxFolderAdress.Text); } if (backgroundWorker1.CancellationPending == true) { e.Cancel = true; return; } backgroundWorker1.ReportProgress(100); }
public Form1() { InitializeComponent(); /* Commenting out This Dangerous Code * * Form1.CheckForIllegalCrossThreadCalls = false; */ textBoxFolderAdress.Text = "D:\\"; RelativePath = textBoxFolderAdress.Text; w = new DynamoWebClient(RelativePath); w.InformationDownloadEvent += new InformationDownloadHandler(w_InformationDownloadEvent); button2.Enabled = false; button3.Enabled = false; SerializationHandler shandler = new SerializationHandler(); shandler.Deserialize(); shandler.DeserializeJobs(); shandler.DeserializeApplicants(); ProfileLog profilelog = ProfileLog.Create; foreach (var x in profilelog.ProfileList) { if (String.IsNullOrEmpty(x.Email) == false) { comboBoxEmails.Items.Add(x.Email); } if (x.IsActive == true) { comboBoxEmails.Text = x.Email; } } xmlHandler handler = new xmlHandler(); try { comboBoxColors.Items.Clear(); handler.ReadList(); foreach (var x in ThemesCollection.themesList) { comboBoxColors.Items.Add(x.ThemeName); } comboBoxColors.Update(); } catch (Exception) { ThemesCollection.InitializeList(); LabelErrorMessage.Text = "File Not Found"; } LabelErrorMessage.Text = ""; buttonSetColor.Enabled = false; radioButtonThemes.Checked = true; radioButtonSpecificDate.Checked = true; progressBar1.Visible = false; if (ThemesCollection.themesList.Count > 0) { ThemesCollection.InitializeList(); // comboBoxColors.SelectedItem = "default"; Themes x = ThemesCollection.GetActive(); if (x != null && String.IsNullOrEmpty(x.ThemeName) == false) { SetThemes(x.ThemeName); comboBoxColors.SelectedText = x.ThemeName; comboBoxColors.Text = x.ThemeName; } } else { SetThemes("default"); } radioButtonRecent.Checked = true; ThemesCollection.themesList.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(themesList_CollectionChanged); }