Example #1
0
        /// <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();
            }
        }
Example #2
0
        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();
            }
        }
Example #3
0
        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();
            }
        }
Example #4
0
        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));
        }
Example #5
0
        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();
        }
Example #6
0
 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());
 }
Example #7
0
 public void AddReminder(clsReminderEntry reminder)
 {
     mReminders.Add(reminder);
     mReminders.Sort();
 }
Example #8
0
 public void DeleteReminder(clsReminderEntry re)
 {
     mReminders.Remove(re);
 }