Esempio n. 1
0
        public RemindRange()
        {
            RemindRange listFromXml = xml.readXML("Reminds.xml");

            if (listFromXml != null)
            {
                remindList = listFromXml.remindList;
            }
        }
Esempio n. 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);
            }
        }
Esempio n. 3
0
        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());
        }
Esempio n. 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);
        }
Esempio n. 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());
                }
            }
        }
Esempio n. 6
0
        public void addRemind(Remind remind)
        {
            RemindRange allReminds = new RemindRange();

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

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

            return(listFromXml);
        }