Exemple #1
0
        private void AddButton(object sender, RoutedEventArgs e)
        {
            ReminderElement r = new ReminderElement();

            DateTime date;

            if (!DateTime.TryParse(dataPicker.Text, out date) || textBoxContent.Text.Length != 0)
            {
                r.time = date.Date.ToString().Substring(0, 10) + " " + comboBoxSelectHours.Text + ":" + comboBoxSelectMinutes.Text + ":" + comboBoxSelectSecunds.Text;

                FileWithReminders      f  = new FileWithReminders();
                List <ReminderElement> lr = f.readRemindersFromFile();

                if (lr.Count != 0)
                {
                    r.id = lr[lr.Count() - 1].id + 1;
                }
                else
                {
                    r.id = 0;
                }

                r.content = textBoxContent.Text;

                lr.Add(r);
                f.saveRemindersToFile(lr);

                this.Close();
            }
            else
            {
                MessageBox.Show("Dane są niepoprawne lub nie zostały wprowadzone.", "Błąd");
            }
        }
Exemple #2
0
        public void RefreshListReminders()
        {
            FileWithReminders f = new FileWithReminders();

            listReminderElement = f.readRemindersFromFile();
            if (listReminderElement.Count != 0)
            {
                showListRemainders(listReminderElement);
            }
        }
Exemple #3
0
        private void ReminderTrigger()
        {
            FileWithReminders      f = new FileWithReminders();
            List <ReminderElement> lr;

            DispatcherTimer timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, delegate
            {
                lr = f.readRemindersFromFile();
                foreach (ReminderElement r in lr)
                {
                    if (DateTime.Now.ToString() == r.time)
                    {
                        ReminderWindow rw = new ReminderWindow(r.content);
                        rw.Show();
                    }
                }
            }, Dispatcher);
        }