Exemple #1
0
        private void btnAlter_Click(object sender, EventArgs e)
        {
            string             date     = null;
            string             time     = null;
            string             subject  = null;
            string             content  = null;
            Schedule           schedule = null;
            ModifyScheduleForm dia      = new ModifyScheduleForm();

            if (listViewAgendaTable.SelectedItems.Count == 0)
            {
                MessageBox.Show("请在列表框中选择日程然后修改。");
            }
            foreach (ListViewItem item in listViewAgendaTable.SelectedItems)
            {
                date    = item.Text;
                time    = item.SubItems[1].Text;
                subject = item.SubItems[2].Text;

                schedule = new Schedule(date, time, subject, "");
                schedule = (Schedule)schedules[schedule.ToString()];


                dia.monthCalendar.SelectionStart = DateTime.ParseExact(schedule.getYear() + schedule.getMonth() + schedule.getDay(), "yyyyMMdd", null);
                dia.comboBox_hour.Text           = schedule.getHour();
                dia.comboBox_minute.Text         = schedule.getMinute();;
                dia.subject.Text = schedule.subject;
                dia.content.Text = schedule.content;


                if (dia.ShowDialog(this) == DialogResult.OK)
                {
                    schedules.Remove(schedule.ToString());
                    date     = dia.monthCalendar.SelectionStart.ToString("yyyy-MM-dd");
                    time     = dia.comboBox_hour.Text + ":" + dia.comboBox_minute.Text;
                    subject  = dia.subject.Text;
                    content  = dia.content.Text;
                    schedule = new Schedule(date, time, subject, content);
                    this.schedules.Add(schedule.ToString(), schedule);
                    updateListView(date, time);
                    this.richTBAgenda.Text = content;
                }
                else
                {
                }
                dia.Dispose();
            }
        }
Exemple #2
0
        private void btnAlter_Click(object sender, EventArgs e)
        {
            string date = null;
            string time = null;
            string subject = null;
            string content = null;
            Schedule schedule = null;
            ModifyScheduleForm dia = new ModifyScheduleForm();

            if (listViewAgendaTable.SelectedItems.Count == 0)
            {
                MessageBox.Show("请在列表框中选择日程然后修改。");
            }
            foreach (ListViewItem item in listViewAgendaTable.SelectedItems)
            {
                date = item.Text;
                time = item.SubItems[1].Text;
                subject = item.SubItems[2].Text;

                schedule = new Schedule(date, time, subject, "");
                schedule = (Schedule)schedules[schedule.ToString()];

                dia.monthCalendar.SelectionStart = DateTime.ParseExact(schedule.getYear()+schedule.getMonth()+schedule.getDay(),"yyyyMMdd",null);
                dia.comboBox_hour.Text = schedule.getHour();
                dia.comboBox_minute.Text = schedule.getMinute(); ;
                dia.subject.Text = schedule.subject;
                dia.content.Text = schedule.content;

                if (dia.ShowDialog(this) == DialogResult.OK)
                {
                    schedules.Remove(schedule.ToString());
                    date = dia.monthCalendar.SelectionStart.ToString("yyyy-MM-dd");
                    time = dia.comboBox_hour.Text + ":" + dia.comboBox_minute.Text;
                    subject = dia.subject.Text;
                    content = dia.content.Text;
                    schedule = new Schedule(date, time, subject, content);
                    this.schedules.Add(schedule.ToString(), schedule);
                    updateListView(date,time);
                    this.richTBAgenda.Text = content;
                }
                else
                {
                }
                dia.Dispose();
             }
        }