protected void SetConfigs(SavableReminder rmd) { if (rmd != null) { cbTime.SelectedIndex = cbTime.FindString(rmd.GetRemindTimeString()); if (cbTime.SelectedIndex < 0) { cbTime.SelectedIndex = cbTime.Items.Count / 2; } mcStart.SetDate(rmd.GetRemindTime()); if (!rmd.InfiniteLoop) { chNoRepeat.Checked = true; } //rdManually.Checked = true; if (rmd.ExtendedProperty.ContainsKey("rdname")) { object rdname = rmd.ExtendedProperty["rdname"]; RadioButton rb = (RadioButton)Controls.Find(rdname.ToString(), true)[0]; if (rb != null) { rb.Checked = true; } } Rmd.FullFilename = rmd.FullFilename; Settings = rmd.Settings; } }
public static SavableReminder Show(SavableReminder rmd) { SavableReminder rlt; SetRemindersForm instance = new SetRemindersForm(); instance.SetConfigs(rmd); if (instance.ShowDialog() == DialogResult.OK) { if (rmd != null) { rmd.Reset(); } rlt = instance.Rmd; } else { rlt = null; } return rlt; }
public static SavableReminder Load(string fullFilename) { SavableReminder rlt = null; FileStream fs = null; try { fs = new FileStream(fullFilename, FileMode.Open, FileAccess.Read); BinaryFormatter bf = new BinaryFormatter(); object content = bf.Deserialize(fs); rlt = (SavableReminder)content; rlt.OnLoadedFromFile(fullFilename); } catch (Exception err) { Exceptions.LogOnly(err); } finally { fs.Close(); } return(rlt); }
private void btnRmvRmd_Click(object sender, EventArgs e) { if (MessageBox.Show("This reminder will be removed permenently.\nAre you sure?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { DialogResult = DialogResult.OK; Rmd.Delete(); Rmd = null; Close(); } }
private SetRemindersForm() { InitializeComponent(); string hour, minute; Rmd = new SavableReminder(); for (int h = 0; h < 24; h++) { for (int m = 0; m < 60; m += 2) { if (h < 10) { hour = "0" + h; } else { hour = h.ToString(); } if (m < 10) { minute = "0" + m; } else { minute = m.ToString(); } cbTime.Items.Add(hour + ":" + minute); } } cbTime.Text = cbTime.Items[0].ToString(); cbTime.DropDownHeight = 300; hdRepeats.Text = rdDaily.Tag.ToString(); mcStart.SetDate(DateTime.Now); TopMost = true; }
private void reminderToolStripMenuItem_Click(object sender, EventArgs e) { SavableReminder newRmd = SetRemindersForm.Show(rmd); if (newRmd != null) { newRmd.OnElapsed += OnRemind; newRmd.OnElapsing += OnElapsing; newRmd.OnElapsedComplete += delegate(Reminder r, bool excluded) { SavableReminder rr = (SavableReminder)r; rr.Save(this.FileName + ".rmd"); return true; }; newRmd.Save(FileName + ".rmd"); newRmd.Start(); rmd = newRmd; } else { if (NotifierMenuItem.Tag != null) { NotifierMenuItem.Text = (string)NotifierMenuItem.Tag; } } }