protected override void OnPaint(PaintEventArgs e) { if (CurrentlyEditing) { FinishEditing(false); } // resolve appointments on visible date range. ResolveAppointmentsEventArgs args = new ResolveAppointmentsEventArgs(this.StartDate, this.StartDate.AddDays(daysToShow)); OnResolveAppointments(args); using (SolidBrush backBrush = new SolidBrush(renderer.BackColor)) e.Graphics.FillRectangle(backBrush, this.ClientRectangle); e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; // Calculate visible rectangle Rectangle rectangle = new Rectangle(0, 0, this.Width - scrollbar.Width, this.Height); Rectangle daysRectangle = rectangle; daysRectangle.X += hourLabelWidth + hourLabelIndent; daysRectangle.Y += this.HeaderHeight; daysRectangle.Width -= (hourLabelWidth + hourLabelIndent); if (e.ClipRectangle.IntersectsWith(daysRectangle)) { DrawDays(e, daysRectangle); } Rectangle hourLabelRectangle = rectangle; hourLabelRectangle.Y += this.HeaderHeight; DrawHourLabels(e, hourLabelRectangle); Rectangle headerRectangle = rectangle; headerRectangle.X += hourLabelWidth + hourLabelIndent; headerRectangle.Width -= (hourLabelWidth + hourLabelIndent); headerRectangle.Height = dayHeadersHeight; if (e.ClipRectangle.IntersectsWith(headerRectangle)) { DrawDayHeaders(e, headerRectangle); } Rectangle scrollrect = rectangle; if (this.AllowScroll == false) { scrollrect.X = headerRectangle.Width + hourLabelWidth + hourLabelIndent; scrollrect.Width = scrollbar.Width; using (SolidBrush backBrush = new SolidBrush(renderer.BackColor)) e.Graphics.FillRectangle(backBrush, scrollrect); } }
private void officeHoursView_OnResolveAppointments(object sender, ResolveAppointmentsEventArgs args) { //resolve appointments on calendar view List<Appointment> appts = new List<Appointment>(); foreach (Appointment appt in periods) if ((appt.StartDate >= args.StartDate) && (appt.StartDate <= args.EndDate)) appts.Add(appt); args.Appointments = appts; }
private void scheduleView_OnResolveAppointments(object sender, ResolveAppointmentsEventArgs args) { //resolve appointments on calendar view List<Appointment> appts = new List<Appointment>(); foreach (Appointment appt in classes) if ((appt.StartDate >= args.StartDate) && (appt.StartDate <= args.EndDate)) { appts.Add(appt); } args.Appointments = appts; }
protected virtual void OnResolveAppointments(ResolveAppointmentsEventArgs args) { System.Diagnostics.Debug.WriteLine("Resolve app"); if (ResolveAppointments != null) { ResolveAppointments(this, args); } this.allDayEventsHeaderHeight = 0; // cache resolved appointments in hashtable by days. cachedAppointments.Clear(); if ((selectedAppointmentIsNew) && (selectedAppointment != null)) { if ((selectedAppointment.StartDate > args.StartDate) && (selectedAppointment.StartDate < args.EndDate)) { args.Appointments.Add(selectedAppointment); } } foreach (Appointment appointment in args.Appointments) { int key = -1; AppointmentList list; if (appointment.StartDate.Day == appointment.EndDate.Day) { key = appointment.StartDate.Day; } else { // use -1 for exceeding one more than day key = -1; /** ALL DAY EVENTS IS NOT COMPLETE * this.allDayEventsHeaderHeight += horizontalAppointmentHeight; **/ } list = (AppointmentList)cachedAppointments[key]; if (list == null) { list = new AppointmentList(); cachedAppointments[key] = list; } list.Add(appointment); } }
private void dvOnline_OnResolveAppointments(object sender, ResolveAppointmentsEventArgs e) { List<HiveDowntime> apps = new List<HiveDowntime>(); foreach (HiveDowntime app in offlineTimes) { if (app.StartDate >= e.StartDate && app.StartDate <= e.EndDate && !app.Deleted) { apps.Add(app); } } e.Appointments.Clear(); foreach (HiveDowntime app in apps) { e.Appointments.Add(app); } }
protected virtual void OnStartDateChanged() { startDate = startDate.Date; selectedAppointment = null; selectedAppointmentIsNew = false; selection = SelectionType.DateRange; // resolve appointments on visible date range. ResolveAppointmentsEventArgs args = new ResolveAppointmentsEventArgs(this.StartDate, this.StartDate.AddDays(daysToShow)); OnResolveAppointments(args); Invalidate(); }
protected virtual void OnDaysToShowChanged() { if (this.CurrentlyEditing) { FinishEditing(true); } // resolve appointments on visible date range. ResolveAppointmentsEventArgs args = new ResolveAppointmentsEventArgs(this.StartDate, this.StartDate.AddDays(daysToShow)); OnResolveAppointments(args); Invalidate(); }
private void dayView1_ResolveAppointments(object sender, ResolveAppointmentsEventArgs args) { List <Appointment> m_Apps = new List <Appointment>(); foreach (Appointment m_App in m_Appointments) { if ((m_App.StartDate >= args.StartDate) && (m_App.StartDate <= args.EndDate)) { m_Apps.Add(m_App); } } args.Appointments = m_Apps; }
protected virtual void OnResolveAppointments(ResolveAppointmentsEventArgs args) { System.Diagnostics.Debug.WriteLine("Resolve app"); if (ResolveAppointments != null) { ResolveAppointments(this, args); } this.allDayEventsHeaderHeight = 0; // cache resolved appointments in hashtable by days. cachedAppointments.Clear(); if ((selectedAppointmentIsNew) && (selectedAppointment != null)) { if ((selectedAppointment.StartDate > args.StartDate) && (selectedAppointment.StartDate < args.EndDate)) { args.Appointments.Add(selectedAppointment); } } foreach (Appointment appointment in args.Appointments) { int key; AppointmentList list; if (appointment.StartDate.Day == appointment.EndDate.Day && appointment.AllDayEvent == false) { key = appointment.StartDate.Day; } else { key = -1; } list = (AppointmentList)cachedAppointments[key]; if (list == null) { list = new AppointmentList(); cachedAppointments[key] = list; } list.Add(appointment); } }
private void dayView1_ResolveAppointments(object sender, ResolveAppointmentsEventArgs args) { List<Appointment> m_Apps = new List<Appointment>(); foreach (Appointment m_App in m_Appointments) if ((m_App.StartDate >= args.StartDate) && (m_App.StartDate <= args.EndDate)) m_Apps.Add(m_App); args.Appointments = m_Apps; }
protected virtual void OnResolveAppointments(ResolveAppointmentsEventArgs args) { System.Diagnostics.Debug.WriteLine("Resolve app"); if (ResolveAppointments != null) ResolveAppointments(this, args); this.allDayEventsHeaderHeight = 0; // cache resolved appointments in hashtable by days. cachedAppointments.Clear(); if ((selectedAppointmentIsNew) && (selectedAppointment != null)) { if ((selectedAppointment.StartDate > args.StartDate) && (selectedAppointment.StartDate < args.EndDate)) { args.Appointments.Add(selectedAppointment); } } foreach (Appointment appointment in args.Appointments) { int key = -1; Appointments list; if (appointment.StartDate.Day == appointment.EndDate.Day) { key = appointment.StartDate.Day; } else { // use -1 for exceeding one more than day key = -1; /* ALL DAY EVENTS IS NOT COMPLETE this.allDayEventsHeaderHeight += horizontalAppointmentHeight; */ } list = (Appointments)cachedAppointments[key]; if (list == null) { list = new Appointments(); cachedAppointments[key] = list; } list.Add(appointment); } }
protected virtual void OnDaysToShowChanged() { if (this.CurrentlyEditing) FinishEditing(true); // resolve appointments on visible date range. ResolveAppointmentsEventArgs args = new ResolveAppointmentsEventArgs(this.StartDate, this.StartDate.AddDays(daysToShow)); OnResolveAppointments(args); Invalidate(); }
//resolve appointments on calendar view private void dayView1_ResolveAppointments(object sender, ResolveAppointmentsEventArgs args) { List<Appointment> appts = new List<Appointment>(); foreach (Appointment appt in calendarEvents) if ((appt.StartDate >= args.StartDate) && (appt.StartDate <= args.EndDate)) appts.Add(appt); args.Appointments = appts; }
private void dayView_ResolveAppointments(object sender, ResolveAppointmentsEventArgs args) { try { Cursor.Current = Cursors.WaitCursor; this.Status = "Retrieving data..."; DateTime day = args.StartDate; do { MergedLogs logs; logs = MergedLogs.GetMergedLogsByDay(day); foreach (MergedLog log in logs) { Task task; task = Tasks.FindById(log.MergeLog.TaskId); if(task.Id == Tasks.IdleTask.Id) continue; Appointment appointment = new Appointment(); appointment.StartDate = log.MergeLog.InsertTime; appointment.EndDate = log.MergeLog.InsertTime.AddSeconds(log.MergeLog.Duration); appointment.Title = task.Description; appointment.Tag = Tasks.GetFullPath(task.Id); appointment.Color = Color.Green; appointment.Locked = false; if(!task.IsActive) { appointment.Color = Color.Yellow; } args.Appointments.Add(appointment); } day = day.AddDays(1); } while (day <= args.EndDate); } finally { Cursor.Current = Cursors.Default; this.Status = "Ready"; } }
/** // \fn private void dvwTimetable_ResolveAppointments(object sender, ResolveAppointmentsEventArgs args) // // \brief Event handler. Called by dvwTimetable for resolve appointments events. // // \author Simon Menetrey // \date 23.05.2014 // // \param sender Source of the event. // \param args Resolve appointments event information. **/ private void dvwTimetable_ResolveAppointments(object sender, ResolveAppointmentsEventArgs args) { List<Appointment> m_Apps = new List<Appointment>(); foreach (Appointment m_App in this.EventsCalendar) m_Apps.Add(m_App); args.Appointments = m_Apps; }