コード例 #1
0
        private void modifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listEntries.SelectedIndex == -1)
            {
                return;
            }
            try
            {
                object            selected = listEntries.SelectedItem;
                CalendarEntryEdit Edit     = new CalendarEntryEdit(listEntries.SelectedItem);
                Edit.ShowDialog();
                if (Edit.OutOK)
                {
                    object o = Edit.GetBackEntry();

                    calendarEntries.Entries.Remove(listEntries.SelectedItem);
                    int Idx = listEntries.SelectedIndex;

                    try // Don't understand, exception, but all is OK , and the job is done !
                    {
                        listEntries.Items.Remove(selected);
                    }
                    catch { }

                    listEntries.Items.Insert(Idx, o);
                    calendarEntries.Entries.Add(o);
                }
            }
            catch { }
            SetCalendarDisplayDate(CalendarStartRequested);
        }
コード例 #2
0
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            BacnetweekNDay    bwd  = new BacnetweekNDay(1, 1);
            CalendarEntryEdit Edit = new CalendarEntryEdit(bwd);

            Edit.ShowDialog();
            if (Edit.OutOK)
            {
                object o = Edit.GetBackEntry();
                listEntries.Items.Add(o);
                calendarEntries.Entries.Add(o);
                SetCalendarDisplayDate(CalendarStartRequested);
            }
        }