public ShowRemind(Remind remind)
 {
     InitializeComponent();
     remind_title.Text       = remind.Title;
     remind_discription.Text = remind.Discription;
     remind_date.Text        = remind.Date.ToLongDateString() + "  " + remind.Date.ToShortTimeString();
 }
Пример #2
0
        // find active remind
        public void FindActiveRemind()
        {
            DateTime now_date = DateTime.Now;

            for (int i = 0; i < _currentReminds.Count; i++)
            {
                DateTime item = _currentReminds[i].Date;
                if (item.Year <= now_date.Year)
                {
                    if (item.Month <= now_date.Month)
                    {
                        if (item.Day <= now_date.Day)
                        {
                            if (item.Hour <= now_date.Hour)
                            {
                                if (item.Minute <= now_date.Minute)
                                {
                                    Remind r = _currentReminds[i];
                                    _activeReminds.Add(r);
                                    _tempIndex.Add(i);
                                }
                            }
                        }
                    }
                }
            }
            DeleteByTempIndex();
            if (_activeReminds.Count > 0)
            {
                if (RemindsFinded != null)
                {
                    RemindsFinded();
                }
            }
        }
 public ShowActiveRemind(RemindManager reminder, Remind remind)
 {
     InitializeComponent();
     _reminder                  = reminder;
     _remind                    = remind;
     remind_title.Text          = remind.Title;
     remind_discription.Text    = remind.Discription;
     remind_date.Text           = remind.Date.ToLongDateString() + "  " + remind.Date.ToShortTimeString();
     delayed_time.SelectedIndex = 0;
 }
Пример #4
0
        public void RemindCompleted(int index)
        {
            if (_activeReminds.Count == 0)
            {
                throw new IndexOutOfRangeException();
            }

            Remind r = _activeReminds[index];

            _activeReminds.RemoveAt(index);
            _completedReminds.Add(r);

            IsChanged = true;
        }
Пример #5
0
 public AddRemind(Remind remind, RemindManager reminder, bool delay_remind = false)
 {
     // constructor for edit remind
     InitializeComponent();
     _reminder      = reminder;
     _remind        = remind;
     _delay_remind  = delay_remind;
     this.Title     = "Редактировать";
     btn_ok.Content = "Редактировать";
     if (_delay_remind == true)
     {
         btn_cancel.Content = "Завершить";
     }
     remind_title.Focus();
     one_day.IsChecked         = true;
     timetable_group.IsEnabled = false;
     for (int i = 0; i < 60; i++)
     {
         if (i < 10)
         {
             minute_value.Items.Add(String.Format("0{0}", i));
         }
         else
         {
             minute_value.Items.Add(i.ToString());
         }
     }
     hour_value.SelectedIndex = DateTime.Now.Hour;
     for (int i = 0; i < 24; i++)
     {
         if (i < 10)
         {
             hour_value.Items.Add(String.Format("0{0}", i));
         }
         else
         {
             hour_value.Items.Add(i.ToString());
         }
     }
     minute_value.SelectedIndex = DateTime.Now.Minute;
     minute_value.Focus();
     date_picker.SelectedDate = DateTime.Now;
     remind_title.Text        = remind.Title;
     remind_discription.Text  = remind.Discription;
 }
Пример #6
0
        private void btn_ok_Click(object sender, RoutedEventArgs e)
        {
            if (remind_title.Text.Equals(String.Empty))
            {
                MessageBox.Show("Заголовок забыл ...", "Ну как, так-то?", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            if (date_picker.SelectedDate == null)
            {
                MessageBox.Show("Дату забыл ...", "Ну как, так-то?", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            if (hour_value.SelectedIndex == -1 || minute_value.SelectedIndex == -1)
            {
                MessageBox.Show("Время забыл ...", "Ну как, так-то?", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            Remind tmp = new Remind();

            tmp.Title       = remind_title.Text;
            tmp.Discription = remind_discription.Text;
            int      hour  = hour_value.SelectedIndex;
            int      min   = minute_value.SelectedIndex;
            int      month = date_picker.SelectedDate.Value.Month;
            int      day   = date_picker.SelectedDate.Value.Day;
            int      year  = date_picker.SelectedDate.Value.Year;
            DateTime t     = new DateTime(year, month, day, hour, min, 0);

            if (t < DateTime.Now)
            {
                MessageBox.Show("На вчера это не получится...", "Ну как, так-то?", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            tmp.Date = t;
            //_reminder.CurrentReminds.Remove(_remind);
            _reminder.AddCurrentRemind(tmp);
            this.Close();
        }
Пример #7
0
 // add completed remind
 public void AddCompletedRemind(Remind remind)
 {
     _completedReminds.Add(remind);
     IsChanged = true;
 }
Пример #8
0
 // add current remind
 public void AddCurrentRemind(Remind remind)
 {
     _currentReminds.Add(remind);
     IsChanged = true;
 }