/// <summary>
        /// When the user double-clicks an entry on the left list box, we open the edition box for this entry.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lbEntries_DoubleClick(object sender, EventArgs e)
        {
            if (lbEntries.SelectedIndex == -1)
            {
                return;
            }

            int           entryIndex = lbEntries.SelectedIndex;
            ScheduleEntry entry      = lbEntriesData[entryIndex];

            using (EditScheduleEntryWindow f = new EditScheduleEntryWindow())
            {
                f.ScheduleEntry = entry;
                DialogResult dr = f.ShowDialog();
                if (dr == DialogResult.Cancel)
                {
                    return;
                }

                Scheduler.Remove(entry);
                Scheduler.Add(f.ScheduleEntry);
            }

            lbEntries.SelectedIndex = entryIndex;
        }
        /// <summary>
        /// Toolbar > Add entry
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addEntryMenuItem_Click(object sender, EventArgs e)
        {
            using (EditScheduleEntryWindow f = new EditScheduleEntryWindow())
            {
                DialogResult dr = f.ShowDialog();
                if (dr == DialogResult.Cancel)
                    return;

                Scheduler.Add(f.ScheduleEntry);
            }
        }
        /// <summary>
        /// Adds the schedule entry.
        /// </summary>
        /// <param name="datetime">The datetime.</param>
        private static void AddScheduleEntry(DateTime datetime)
        {
            // Allow the user to define the new entry
            using (EditScheduleEntryWindow f = new EditScheduleEntryWindow(datetime))
            {
                DialogResult dr = f.ShowDialog();
                if (dr == DialogResult.Cancel)
                    return;

                // Add an entry
                Scheduler.Add(f.ScheduleEntry);
            }
        }
        /// <summary>
        /// Toolbar > Add entry
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addEntryMenuItem_Click(object sender, EventArgs e)
        {
            using (EditScheduleEntryWindow f = new EditScheduleEntryWindow())
            {
                DialogResult dr = f.ShowDialog();
                if (dr == DialogResult.Cancel)
                {
                    return;
                }

                Scheduler.Add(f.ScheduleEntry);
            }
        }
        /// <summary>
        /// When the user double-clicks a day on the calendar control, we allow him to add a new entry.
        /// </summary>
        /// <param name="datetime"></param>
        /// <param name="mouse"></param>
        /// <param name="loc"></param>
        private void calControl_DayDoubleClicked(DateTime datetime, MouseEventArgs mouse, Point loc)
        {
            using (EditScheduleEntryWindow f = new EditScheduleEntryWindow(datetime))
            {
                DialogResult dr = f.ShowDialog();
                if (dr == DialogResult.Cancel)
                {
                    return;
                }

                Scheduler.Add(f.ScheduleEntry);
            }
        }
示例#6
0
        /// <summary>
        /// Adds the schedule entry.
        /// </summary>
        /// <param name="datetime">The datetime.</param>
        private static void AddScheduleEntry(DateTime datetime)
        {
            // Allow the user to define the new entry
            using (EditScheduleEntryWindow f = new EditScheduleEntryWindow(datetime))
            {
                DialogResult dr = f.ShowDialog();
                if (dr == DialogResult.Cancel)
                {
                    return;
                }

                // Add an entry
                Scheduler.Add(f.ScheduleEntry);
            }
        }
        /// <summary>
        /// Context menu > New schedule entry
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void newEntryMenuItem_Click(object sender, EventArgs e)
        {
            var      menu     = (ToolStripMenuItem)sender;
            DateTime datetime = (DateTime)menu.Tag;

            // Allow the user to define the new entry
            using (EditScheduleEntryWindow f = new EditScheduleEntryWindow(datetime))
            {
                DialogResult dr = f.ShowDialog();
                if (dr == DialogResult.Cancel)
                {
                    return;
                }

                // Add an entry
                Scheduler.Add(f.ScheduleEntry);
            }
        }
        /// <summary>
        /// Context menu > Edit "entry name"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editMenuItem_Click(object sender, EventArgs e)
        {
            var           menu  = (ToolStripMenuItem)sender;
            ScheduleEntry entry = (ScheduleEntry)menu.Tag;

            // Allow the user to edit the entry
            using (EditScheduleEntryWindow f = new EditScheduleEntryWindow())
            {
                f.ScheduleEntry = entry;
                DialogResult dr = f.ShowDialog();
                if (dr == DialogResult.Cancel)
                {
                    return;
                }

                Scheduler.Remove(entry);
                Scheduler.Add(f.ScheduleEntry);
            }
        }
        /// <summary>
        /// Context menu > Edit "entry name"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void editMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menu = (ToolStripMenuItem)sender;
            ScheduleEntry entry = (ScheduleEntry)menu.Tag;

            // Allow the user to edit the entry
            using (EditScheduleEntryWindow f = new EditScheduleEntryWindow())
            {
                f.ScheduleEntry = entry;
                DialogResult dr = f.ShowDialog();
                if (dr == DialogResult.Cancel)
                    return;

                Scheduler.Remove(entry);
                Scheduler.Add(f.ScheduleEntry);
            }
        }
示例#10
0
        /// <summary>
        /// When the user double-clicks an entry on the left list box, we open the edition box for this entry.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lbEntries_DoubleClick(object sender, EventArgs e)
        {
            if (lbEntries.SelectedIndex == -1)
                return;

            int entryIndex = lbEntries.SelectedIndex;
            ScheduleEntry entry = m_lbEntriesData[entryIndex];
            using (EditScheduleEntryWindow f = new EditScheduleEntryWindow())
            {
                f.ScheduleEntry = entry;
                DialogResult dr = f.ShowDialog();
                if (dr == DialogResult.Cancel)
                    return;

                Scheduler.Remove(entry);
                Scheduler.Add(f.ScheduleEntry);
            }

            lbEntries.SelectedIndex = entryIndex;
        }
        /// <summary>
        /// Context menu > New schedule entry
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void newEntryMenuItem_Click(object sender, EventArgs e)
        {
            var menu = (ToolStripMenuItem)sender;
            DateTime datetime = (DateTime)menu.Tag;

            // Allow the user to define the new entry
            using (EditScheduleEntryWindow f = new EditScheduleEntryWindow(datetime))
            {
                DialogResult dr = f.ShowDialog();
                if (dr == DialogResult.Cancel)
                    return;

                // Add an entry
                Scheduler.Add(f.ScheduleEntry);
            }
        }
        /// <summary>
        /// When the user double-clicks a day on the calendar control, we allow him to add a new entry.
        /// </summary>
        /// <param name="datetime"></param>
        /// <param name="mouse"></param>
        /// <param name="loc"></param>
        private void calControl_DayDoubleClicked(DateTime datetime, MouseEventArgs mouse, Point loc)
        {
            using (EditScheduleEntryWindow f = new EditScheduleEntryWindow(datetime))
            {
                DialogResult dr = f.ShowDialog();
                if (dr == DialogResult.Cancel)
                    return;

                Scheduler.Add(f.ScheduleEntry);
            }
        }