/// <summary> /// Click on a Reminder, go open it. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void tsmi_Click(object sender, EventArgs e) { clsReminderEntry re = (clsReminderEntry)(((ToolStripMenuItem)sender).Tag); frmSchedule fs = new frmSchedule(); this._I18N.DoForm(fs); fs.NewReminder = re; fs.ShowDialog(this); this.Focus(); if (fs.DialogResult == System.Windows.Forms.DialogResult.OK) { mReminders.DeleteReminder(re); // Delete or edit? if (fs.DeleteReminder) { // Don't add in again. } else { // Add amended version in again. mReminders.AddReminder(fs.NewReminder); } DisplayReminders(); } }
public void Check(I18N i18n) { string nowString = System.DateTime.Now.ToString("hh:mm"); string report = ""; for (int i = 0; i < mReminders.Count; i++) { clsReminderEntry r = (clsReminderEntry)mReminders[i]; if (r.fired != nowString) // Also okay for r.fired = "" { if (r.when == nowString) { report += r.reminder + "\n"; r.fired = nowString; } } } if (report.Length > 0) { frmReminder rem = new frmReminder(); i18n.DoForm(rem); rem.reminderText = report; rem.Show(); } }
public void LoadReminders() { mReminders.Clear(); System.Xml.XmlDocument reminders = new System.Xml.XmlDocument(); string reminderPath = ReminderFilePath(); if (!System.IO.File.Exists(reminderPath)) { // Have we got a previous version? reminderPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\WebbIE\\Clock\\1\\reminders.xml"; } if (System.IO.File.Exists(reminderPath)) { reminders.Load(reminderPath); foreach (System.Xml.XmlNode reminder in reminders.DocumentElement.SelectNodes("reminderItem")) { clsReminderEntry re = new clsReminderEntry(); re.when = reminder.SelectSingleNode("when").InnerText; re.fired = reminder.SelectSingleNode("fired").InnerText; re.reminder = reminder.SelectSingleNode("reminder").InnerText; mReminders.Add(re); } mReminders.Sort(); } }
int IComparable.CompareTo(object obj) { clsReminderEntry re = (clsReminderEntry)obj; System.DateTime thisWhen = System.DateTime.Parse(this.when); System.DateTime thatWhen = System.DateTime.Parse(re.when); return(System.DateTime.Compare(thisWhen, thatWhen)); }
private void btnOK_Click(object sender, EventArgs e) { // TODO What about the Delete button? this.DialogResult = System.Windows.Forms.DialogResult.OK; clsReminderEntry re = new clsReminderEntry(); re.when = System.DateTime.Parse(lstTime.Text).ToString("hh:mm"); re.reminder = txtReminder.Text; this.Hide(); }
public void SaveReminders() { System.Xml.XmlDocument reminders = new System.Xml.XmlDocument(); reminders.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\"?><reminders />"); for (int i = 0; i < mReminders.Count; i++) { System.Xml.XmlNode rem = reminders.CreateNode(System.Xml.XmlNodeType.Element, "reminderItem", ""); rem.AppendChild(reminders.CreateNode(System.Xml.XmlNodeType.Element, "when", "")); rem.AppendChild(reminders.CreateNode(System.Xml.XmlNodeType.Element, "fired", "")); rem.AppendChild(reminders.CreateNode(System.Xml.XmlNodeType.Element, "reminder", "")); clsReminderEntry re = (clsReminderEntry)mReminders[i]; rem.SelectSingleNode("when").InnerText = re.when; rem.SelectSingleNode("fired").InnerText = re.fired; rem.SelectSingleNode("reminder").InnerText = re.reminder; reminders.DocumentElement.AppendChild(rem); } reminders.Save(ReminderFilePath()); }
public void AddReminder(clsReminderEntry reminder) { mReminders.Add(reminder); mReminders.Sort(); }
public void DeleteReminder(clsReminderEntry re) { mReminders.Remove(re); }