public RemindRange()
        {
            RemindRange listFromXml = xml.readXML("Reminds.xml");

            if (listFromXml != null)
            {
                remindList = listFromXml.remindList;
            }
        }
Exemple #2
0
        public void writeXML(string xmlName, RemindRange newRange)
        {
            XmlSerializer formatter = new XmlSerializer(typeof(RemindRange));

            using (FileStream fs = new FileStream(xmlName, FileMode.OpenOrCreate))
            {
                formatter.Serialize(fs, newRange);
            }
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            RemindRange rem = new RemindRange();

            //rem.addMessage(new DateTime(2016, 05, 26, 19, 59, 0), "Напоминание 5");
            Application.Run(new MainForm());
        }
Exemple #4
0
        public RemindRange readXML(string xmlName)
        {
            XmlSerializer formatter = new XmlSerializer(typeof(RemindRange));
            RemindRange   newRange  = null;

            try
            {
                using (FileStream fs = new FileStream(xmlName, FileMode.Open))
                {
                    newRange = (RemindRange)formatter.Deserialize(fs);
                }
            }
            catch
            {
                return(null);
            }
            return(newRange);
        }
Exemple #5
0
        void timerEvent(Object source, System.Timers.ElapsedEventArgs e)
        {
            remindRange = remindRange.updateRemindList();
            if (remindRange == null)
            {
                return;
            }

            for (int i = 0; i < remindRange.remindList.Count; ++i)
            {
                Remind   remind       = remindRange.remindList[i];
                DateTime current_time = DateTime.Now;
                DateTime remind_time  = remind.getDateTime();
                TimeSpan delta        = current_time - remind_time;
                if ((delta.TotalSeconds >= 0) && (delta.TotalSeconds < 60))
                {
                    remindRange.removeMessage(i);
                    System.Windows.Forms.MessageBox.Show(remind.getMessage());
                }
            }
        }
Exemple #6
0
        public void addRemind(Remind remind)
        {
            RemindRange allReminds = new RemindRange();

            allReminds.addMessage(remind.getDateTime(), remind.getMessage());
        }
Exemple #7
0
        public void deleteRemind(Remind remind)
        {
            RemindRange allReminds = new RemindRange();

            allReminds.removeMessage(remind.getId());
        }
        public RemindRange updateRemindList()
        {
            RemindRange listFromXml = xml.readXML("Reminds.xml");

            return(listFromXml);
        }