From b2d2f1becaa18e8edf3ee3b9164199b8a83cc9f4 Mon Sep 17 00:00:00 2001 From: sam Date: Mon, 17 Jan 2011 14:12:38 +0000 Subject: [PATCH] CalendarGrid: - Added PositionGrid from CGView - Added Delegates from other classes that contained just one line. CGAppointmentChangedArgs & CGSelectionChangedArgs: - Changed to use automatic properties CGAvailability: - Added override ToString() --- cs/bsdx0200GUISourceCode/CGAVView.cs | 6 +- .../CGAppointmentChangedArgs.cs | 97 ++----------------- cs/bsdx0200GUISourceCode/CGAvailability.cs | 5 + .../CGSelectionChangedArgs.cs | 44 +-------- cs/bsdx0200GUISourceCode/CalendarGrid.cs | 19 +++- 5 files changed, 40 insertions(+), 131 deletions(-) diff --git a/cs/bsdx0200GUISourceCode/CGAVView.cs b/cs/bsdx0200GUISourceCode/CGAVView.cs index b7a7d0f..333a99e 100644 --- a/cs/bsdx0200GUISourceCode/CGAVView.cs +++ b/cs/bsdx0200GUISourceCode/CGAVView.cs @@ -489,9 +489,9 @@ namespace IndianHealthService.ClinicalScheduling this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0); this.calendarGrid1.TabIndex = 2; this.calendarGrid1.TimeScale = 20; - this.calendarGrid1.CGAppointmentAdded += new IndianHealthService.ClinicalScheduling.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded); - this.calendarGrid1.CGAppointmentChanged += new IndianHealthService.ClinicalScheduling.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged); - this.calendarGrid1.CGSelectionChanged += new IndianHealthService.ClinicalScheduling.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged); + this.calendarGrid1.CGAppointmentAdded += new CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentAdded); + this.calendarGrid1.CGAppointmentChanged += new CalendarGrid.CGAppointmentChangedHandler(this.calendarGrid1_CGAppointmentChanged); + this.calendarGrid1.CGSelectionChanged += new CalendarGrid.CGSelectionChangedHandler(this.calendarGrid1_CGSelectionChanged); this.calendarGrid1.DoubleClick += new System.EventHandler(this.calendarGrid1_DoubleClick); // // CGAVView diff --git a/cs/bsdx0200GUISourceCode/CGAppointmentChangedArgs.cs b/cs/bsdx0200GUISourceCode/CGAppointmentChangedArgs.cs index 26716a6..9231836 100644 --- a/cs/bsdx0200GUISourceCode/CGAppointmentChangedArgs.cs +++ b/cs/bsdx0200GUISourceCode/CGAppointmentChangedArgs.cs @@ -2,103 +2,26 @@ { using System; /// - /// This class was regenerated from Calendargrid.dll using Reflector.exe - /// by Sam Habiel for WorldVista. The original source code is lost. + /// Custom event args for CGAppointment events when changing appointments. + /// More documentation when I totally understand it. + /// I changed it to automatic properties. /// [Serializable] public class CGAppointmentChangedArgs : EventArgs { - private DateTime m_dEnd; - private DateTime m_dStart; - private int m_nAccessTypeID; - private int m_nSlots; - private CGAppointment m_pAppt; - private string m_sOldResource; - private string m_sResource; + public int AccessTypeID {get; set;} - public int AccessTypeID - { - get - { - return this.m_nAccessTypeID; - } - set - { - this.m_nAccessTypeID = value; - } - } + public CGAppointment Appointment {get; set;} - public CGAppointment Appointment - { - get - { - return this.m_pAppt; - } - set - { - this.m_pAppt = value; - } - } + public DateTime EndTime {get; set;} - public DateTime EndTime - { - get - { - return this.m_dEnd; - } - set - { - this.m_dEnd = value; - } - } + public string OldResource {get; set;} - public string OldResource - { - get - { - return this.m_sOldResource; - } - set - { - this.m_sOldResource = value; - } - } + public string Resource {get; set;} - public string Resource - { - get - { - return this.m_sResource; - } - set - { - this.m_sResource = value; - } - } + public int Slots {get; set;} - public int Slots - { - get - { - return this.m_nSlots; - } - set - { - this.m_nSlots = value; - } - } - - public DateTime StartTime - { - get - { - return this.m_dStart; - } - set - { - this.m_dStart = value; - } - } + public DateTime StartTime {get; set;} } } diff --git a/cs/bsdx0200GUISourceCode/CGAvailability.cs b/cs/bsdx0200GUISourceCode/CGAvailability.cs index 7d2390d..40b853a 100644 --- a/cs/bsdx0200GUISourceCode/CGAvailability.cs +++ b/cs/bsdx0200GUISourceCode/CGAvailability.cs @@ -213,6 +213,11 @@ this.m_StartTime = value; } } + + public override string ToString() + { + return ResourceList + " (" + Slots + ") @ " + StartTime; + } } } diff --git a/cs/bsdx0200GUISourceCode/CGSelectionChangedArgs.cs b/cs/bsdx0200GUISourceCode/CGSelectionChangedArgs.cs index f1c7286..deb2944 100644 --- a/cs/bsdx0200GUISourceCode/CGSelectionChangedArgs.cs +++ b/cs/bsdx0200GUISourceCode/CGSelectionChangedArgs.cs @@ -2,51 +2,17 @@ { using System; /// - /// This class was regenerated from Calendargrid.dll using Reflector.exe - /// by Sam Habiel for WorldVista. The original source code is lost. + /// Custom Event Args for SelectionChange. Don't know totally what it does yet. + /// Changed to automatic properties. /// [Serializable] public class CGSelectionChangedArgs : EventArgs { - private DateTime m_dEnd; - private DateTime m_dStart; - private string m_sResource; + public DateTime EndTime {get; set;} - public DateTime EndTime - { - get - { - return this.m_dEnd; - } - set - { - this.m_dEnd = value; - } - } + public string Resource {get; set;} - public string Resource - { - get - { - return this.m_sResource; - } - set - { - this.m_sResource = value; - } - } - - public DateTime StartTime - { - get - { - return this.m_dStart; - } - set - { - this.m_dStart = value; - } - } + public DateTime StartTime {get; set;} } } diff --git a/cs/bsdx0200GUISourceCode/CalendarGrid.cs b/cs/bsdx0200GUISourceCode/CalendarGrid.cs index b450276..2d7f05e 100644 --- a/cs/bsdx0200GUISourceCode/CalendarGrid.cs +++ b/cs/bsdx0200GUISourceCode/CalendarGrid.cs @@ -53,10 +53,11 @@ private const int WM_HSCROLL = 0x114; // Horizontal Scrolling Windows Message private const int WM_VSCROLL = 0x115; // Vertical Scrolling Windows Message + public delegate void CGAppointmentChangedHandler(object sender, CGAppointmentChangedArgs e); + public event CGAppointmentChangedHandler CGAppointmentChanged; public event CGAppointmentChangedHandler CGAppointmentAdded; - public event CGAppointmentChangedHandler CGAppointmentChanged; - + public delegate void CGSelectionChangedHandler(object sender, CGSelectionChangedArgs e); public event CGSelectionChangedHandler CGSelectionChanged; public CalendarGrid() @@ -1171,6 +1172,20 @@ return rectangle2.IntersectsWith(rect); } + public void PositionGrid(int nHour) + { + //Position grid to nHour + int nRow = 0, nCol = 0; + DateTime dStart = DateTime.Today; + dStart = dStart.AddHours(nHour); + this.GetCellFromTime(dStart, ref nRow, ref nCol, false, ""); + int nHeight = this.CellHeight + 10; + nHeight *= nRow; + this.AutoScrollPosition = new Point(50, nHeight); + this.Invalidate(); + } + + /// /// The purpose of this is to properly draw the date boxes at the top of the calendar grid. /// Otherwise, when scrolling, it gets garbled.