Example #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.MouseDoubleClick"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.Windows.Forms.MouseEventArgs"/> that contains the event data.</param>
        protected override void OnMouseDoubleClick(MouseEventArgs e)
        {
            //handle day clicks
            foreach (BaseRegion day in this.DayRegions)
            {
                if (day.Bounds.Contains(e.Location))
                {
                    foreach (AppointmentRegion appt in day.Appointments)
                    {
                        if (appt.Bounds.Contains(e.Location))
                        {
                            AppointmentGrid.Focus();
                            SelectedSlot        = day;
                            SelectedAppointment = appt.Appointment;
                            if (SelectedAppointment != null)
                            {
                                FireAppointmentEdit(SelectedAppointment);
                            }
                            return;
                        }
                    }
                    //they probably want a new appointment
                    this.LastRightMouseClickCoords = null;
                    OnNewAppointmentClick(this, new EventArgs());
                    return;
                }
            }


            base.OnMouseDoubleClick(e);
        }
Example #2
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.MouseClick"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.Windows.Forms.MouseEventArgs"/> that contains the event data.</param>
        protected override void OnMouseClick(MouseEventArgs e)
        {
            AppointmentGrid.Focus();

            //record the location of a right mouse click
            if (e.Button == MouseButtons.Right)
            {
                //TODO: for right clicks, should all other code be aborted
                LastRightMouseClickCoords = e.Location;
            }

            //handle day clicks
            foreach (BaseRegion day in this.DayRegions)
            {
                if (day.TitleBounds.Contains(e.Location))
                {
                    SelectedSlot = day;
                    this.Invalidate();
                    return;
                }
                if (day.BodyBounds.Contains(e.Location))
                {
                    foreach (AppointmentRegion appt in day.Appointments)
                    {
                        if (appt.Bounds.Contains(e.Location))
                        {
                            SelectedSlot        = day;
                            SelectedAppointment = appt.Appointment;
                            IsUpdating          = true;
                            AppointmentGrid.ClearSelection();
                            foreach (DataGridViewRow row in AppointmentGrid.Rows)
                            {
                                if (row.DataBoundItem == SelectedAppointment)
                                {
                                    row.Selected = true;
                                    AppointmentGrid.CurrentCell = row.Cells[0];
                                    break;
                                }
                            }
                            IsUpdating = false;
                            this.Invalidate();
                            return;
                        }
                    }
                    break;
                }
            }
            base.OnMouseClick(e);
        }
Example #3
0
        private void CalendarDayOverview_OnLoaded(object sender, RoutedEventArgs e)
        {
            BackgroundGrid.SetGridRows(24);
            AppointmentGrid.SetGridRows(24);

            //Add horizontal lines
            for (int i = 0; i < 24; i++)
            {
                var r = new Rectangle
                {
                    Fill = new SolidColorBrush(Colors.White)
                    , VerticalAlignment = VerticalAlignment.Bottom
                    , Height            = 1
                };
                Grid.SetRow(r, i);
                Grid.SetColumnSpan(r, 2);
                BackgroundGrid.Children.Add(r);
            }

            UpdateEvents();
        }
Example #4
0
 public void BindData()
 {
     _presenter.OnViewLoaded();
     AppointmentGrid.DataBind();
 }