source: Scheduling/trunk/cs/bsdx0200GUISourceCode/CalendarGrid.cs@ 1082

Last change on this file since 1082 was 1075, checked in by Sam Habiel, 14 years ago

CalendarGrid: Handling for mouse scroll wheel added.
CGAppointments: Now supports Deep Cloning with Clone().
Updated Exes

File size: 56.0 KB
RevLine 
[622]1namespace IndianHealthService.ClinicalScheduling
2{
3 using System;
4 using System.Collections;
5 using System.ComponentModel;
6 using System.Drawing;
7 using System.Globalization;
8 using System.Runtime.CompilerServices;
9 using System.Runtime.InteropServices;
10 using System.Windows.Forms;
[824]11
[622]12 /// <summary>
[821]13 /// This class is reponsible for rendering the Calendar Grid.
[622]14 /// </summary>
[1027]15 public class CalendarGrid : ScrollableControl
[622]16 {
[821]17 private IContainer components;
[622]18 private Font fontArial10;
19 private Font fontArial8;
20 private CGAppointments m_Appointments;
21 private Hashtable m_ApptOverlapTable;
22 private bool m_bAutoDrag = true;
23 private bool m_bDragDropStart;
24 private bool m_bDrawWalkIns = true;
25 private bool m_bGridEnter;
26 private bool m_bInitialUpdate;
27 private bool m_bMouseDown;
28 private bool m_bScroll;
29 private bool m_bScrollDown;
30 private bool m_bSelectingRange;
31 private int m_cellHeight;
32 private int m_cellWidth;
33 private int m_col0Width;
34 private Hashtable m_ColumnInfoTable;
35 private CGCell m_currentCell;
36 private DateTime m_dtStart;
37 private Font m_fCell;
38 private string m_GridBackColor;
39 private CGCells m_gridCells;
40 private int m_nColumns = 5;
41 private int m_nSelectID;
42 private int m_nTimeScale = 20;
43 private ArrayList m_pAvArray;
44 private string m_sDragSource;
45 private CGAppointments m_SelectedAppointments;
46 private CGRange m_selectedRange;
47 private StringFormat m_sf;
48 private StringFormat m_sfHour;
49 private StringFormat m_sfRight;
50 private ArrayList m_sResourcesArray;
[821]51 private Timer m_Timer; // Timeer used in Drag and Drop Operations
[622]52 private ToolTip m_toolTip;
[1075]53 private const int WM_HSCROLL = 0x114; // Horizontal Scrolling Windows Message
54 private const int WM_VSCROLL = 0x115; // Vertical Scrolling Windows Message
55 private const int WM_MOUSEWHEEL = 0x20a; // Windows Mouse Scrolling Message
[622]56
[1068]57 public delegate void CGAppointmentChangedHandler(object sender, CGAppointmentChangedArgs e);
58 public event CGAppointmentChangedHandler CGAppointmentChanged;
[622]59 public event CGAppointmentChangedHandler CGAppointmentAdded;
60
[1068]61 public delegate void CGSelectionChangedHandler(object sender, CGSelectionChangedArgs e);
[622]62 public event CGSelectionChangedHandler CGSelectionChanged;
63
64 public CalendarGrid()
65 {
66 this.InitializeComponent();
67 base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
68 base.SetStyle(ControlStyles.UserPaint, true);
69 base.SetStyle(ControlStyles.DoubleBuffer, true);
70 this.m_nColumns = 5;
71 this.m_gridCells = new CGCells();
72 this.m_selectedRange = new CGRange();
73 this.m_SelectedAppointments = new CGAppointments();
[1073]74 //this.m_Appointments = new CGAppointments();
[821]75 this.m_dtStart = new DateTime(2003, 1, 27);
[622]76 this.m_ApptOverlapTable = new Hashtable();
77 this.m_ColumnInfoTable = new Hashtable();
78 this.m_sResourcesArray = new ArrayList();
79 base.ResizeRedraw = true;
80 this.m_col0Width = 100;
81 this.fontArial8 = new Font("Arial", 8f);
82 this.fontArial10 = new Font("Arial", 10f);
83 this.m_fCell = this.fontArial10;
84 this.m_sf = new StringFormat();
85 this.m_sfRight = new StringFormat();
86 this.m_sfHour = new StringFormat();
87 this.m_sf.LineAlignment = StringAlignment.Center;
88 this.m_sfRight.LineAlignment = StringAlignment.Center;
89 this.m_sfRight.Alignment = StringAlignment.Far;
90 this.m_sfHour.LineAlignment = StringAlignment.Center;
91 this.m_sfHour.Alignment = StringAlignment.Far;
92 this.m_bInitialUpdate = false;
93 }
94
95 private Rectangle AdjustRectForOverlap()
96 {
97 return new Rectangle();
98 }
99
100 private void AutoDragStart()
101 {
102 this.m_bAutoDrag = true;
103 this.m_Timer = new Timer();
104 this.m_Timer.Interval = 5;
105 this.m_Timer.Tick += new EventHandler(this.tickEventHandler);
106 this.m_Timer.Start();
107 }
108
109 private void AutoDragStop()
110 {
111 this.m_bAutoDrag = false;
112 if (this.m_Timer != null)
113 {
114 this.m_Timer.Stop();
115 this.m_Timer.Dispose();
116 this.m_Timer = null;
117 }
118 }
119
120 private void BuildGridCellsArray(Graphics g)
121 {
122 try
123 {
124 SizeF ef = g.MeasureString("Test", this.m_fCell);
125 this.m_cellHeight = ((int) ef.Height) + 4;
126 int nColumns = this.m_nColumns;
127 int num2 = 60 / this.m_nTimeScale;
[821]128 int num3 = 24 * num2;
[622]129 nColumns++;
130 num3++;
131 this.m_cellWidth = 600 / nColumns;
132 if (base.ClientRectangle.Width > 600)
133 {
134 this.m_cellWidth = (base.ClientRectangle.Width - this.m_col0Width) / (nColumns - 1);
135 }
136 if (this.m_nColumns == 1)
137 {
138 this.m_cellWidth = base.ClientRectangle.Width - this.m_col0Width;
139 }
140 g.TranslateTransform((float) base.AutoScrollPosition.X, (float) base.AutoScrollPosition.Y);
141 for (int i = num3; i > -1; i--)
142 {
143 for (int j = 1; j < nColumns; j++)
144 {
145 int x = 0;
146 if (j == 1)
147 {
148 x = this.m_col0Width;
149 }
150 if (j > 1)
151 {
152 x = this.m_col0Width + (this.m_cellWidth * (j - 1));
153 }
154 Point point = new Point(x, i * this.m_cellHeight);
155 Rectangle r = new Rectangle(point.X, point.Y, this.m_cellWidth, this.m_cellHeight);
156 if (i != 0)
157 {
158 CGCell cell = null;
159 cell = new CGCell(r, i, j);
160 this.m_gridCells.AddCell(cell);
161 }
162 }
163 }
164 }
165 catch (Exception exception)
166 {
167 string message = exception.Message;
168 }
169 }
170
171 private void CalendarGrid_DragDrop(object Sender, DragEventArgs e)
172 {
173 CGAppointment data = (CGAppointment) e.Data.GetData(typeof(CGAppointment));
174 Point point = base.PointToClient(new Point(e.X, e.Y));
175 int x = point.X - base.AutoScrollPosition.X;
176 int y = point.Y - base.AutoScrollPosition.Y;
177 Point pt = new Point(x, y);
178 foreach (DictionaryEntry entry in this.m_gridCells.CellHashTable)
179 {
180 CGCell cgCell = (CGCell) entry.Value;
181 if (cgCell.CellRectangle.Contains(pt))
182 {
183 DateTime timeFromCell = this.GetTimeFromCell(cgCell);
184 string resourceFromColumn = this.GetResourceFromColumn(cgCell.CellColumn);
185 int duration = data.Duration;
186 TimeSpan span = new TimeSpan(0, duration, 0);
187 DateTime time2 = timeFromCell + span;
188 data.Selected = false;
189 this.m_nSelectID = 0;
190 CGAppointmentChangedArgs args = new CGAppointmentChangedArgs();
191 args.Appointment = data;
192 args.StartTime = timeFromCell;
193 args.EndTime = time2;
194 args.Resource = resourceFromColumn;
195 args.OldResource = data.Resource;
196 args.AccessTypeID = data.AccessTypeID;
197 args.Slots = data.Slots;
198 if (this.ApptDragSource == "grid")
199 {
200 this.CGAppointmentChanged(this, args);
201 }
202 else
203 {
204 this.CGAppointmentAdded(this, args);
205 }
206 break;
207 }
208 }
209 this.SetOverlapTable();
210 base.Invalidate();
211 }
212
213 private void CalendarGrid_DragEnter(object Sender, DragEventArgs e)
214 {
215 if (e.Data.GetDataPresent(typeof(CGAppointment)))
216 {
217 if ((e.KeyState & 8) == 8)
218 {
219 e.Effect = DragDropEffects.Copy;
220 }
221 else
222 {
223 e.Effect = DragDropEffects.Move;
224 }
225 }
226 else
227 {
228 e.Effect = DragDropEffects.None;
229 }
230 }
231
232 private void CalendarGrid_MouseDown(object sender, MouseEventArgs e)
233 {
234 if (e.Button == MouseButtons.Left)
235 {
236 foreach (DictionaryEntry entry in this.m_gridCells.CellHashTable)
237 {
238 CGCell cell = (CGCell) entry.Value;
239 cell.IsSelected = false;
240 }
241 this.m_selectedRange.Cells.ClearAllCells();
242 this.m_bMouseDown = true;
243 this.OnLButtonDown(e.X, e.Y, true);
244 }
245 }
246
247 private void CalendarGrid_MouseMove(object Sender, MouseEventArgs e)
248 {
249 if (this.m_bMouseDown)
250 {
251 if ((e.Y >= base.ClientRectangle.Bottom) || (e.Y <= base.ClientRectangle.Top))
252 {
253 this.m_bScrollDown = e.Y >= base.ClientRectangle.Bottom;
254 }
255 if ((e.Y < base.ClientRectangle.Bottom) && (e.Y > base.ClientRectangle.Top))
256 {
257 bool bAutoDrag = this.m_bAutoDrag;
258 }
259 if (this.m_bSelectingRange)
260 {
261 this.OnLButtonDown(e.X, e.Y, false);
262 }
263 if (this.m_nSelectID != 0)
264 {
265 if (this.m_bGridEnter)
266 {
267 this.m_bGridEnter = false;
268 }
269 else if (!this.m_bDragDropStart)
270 {
271 CGAppointment data = (CGAppointment) this.m_Appointments.AppointmentTable[this.m_nSelectID];
272 this.ApptDragSource = "grid";
273 base.DoDragDrop(data, DragDropEffects.Move);
274 this.m_bDragDropStart = true;
275 }
276 }
277 }
278 else
279 {
280 int y = e.Y - base.AutoScrollPosition.Y;
281 int x = e.X - base.AutoScrollPosition.X;
282 Point pt = new Point(x, y);
283 foreach (CGAppointment appointment2 in this.m_Appointments.AppointmentTable.Values)
284 {
285 if (appointment2.GridRectangle.Contains(pt))
286 {
287 this.m_toolTip.SetToolTip(this, appointment2.ToString());
288 return;
289 }
290 }
291 this.m_toolTip.RemoveAll();
[821]292
293 ////smh new code -- select cell
294 //int nRow = -1;
295 //int nCol = -1;
296
297 ////Is the mouse over a known cell? If so, highlight cell
298 //if (this.HitTest(x, y, ref nRow, ref nCol))
299 //{
300 // CGCell cellFromRowCol = this.m_gridCells.GetCellFromRowCol(nRow, nCol);
301 // if (cellFromRowCol != null)
302 // {
303 // this.m_currentCell = cellFromRowCol;
304 // this.m_selectedRange.StartCell = null;
305 // this.m_selectedRange.EndCell = null;
306 // this.m_selectedRange.CreateRange(this.m_gridCells, cellFromRowCol, cellFromRowCol);
307 // this.m_bSelectingRange = true;
308 // cellFromRowCol.IsSelected = true;
309 // base.Invalidate(this.m_currentCell.CellRectangle);
310 // //base.Invalidate();
311 // }
312 //}
313
314
[622]315 }
316 }
317
318 private void CalendarGrid_MouseUp(object Sender, MouseEventArgs e)
319 {
320 if (this.m_bAutoDrag)
321 {
322 this.m_bAutoDrag = false;
323 this.AutoDragStop();
324 }
325 this.m_bMouseDown = false;
326 if (this.m_bSelectingRange)
327 {
328 CGSelectionChangedArgs args = new CGSelectionChangedArgs();
329 args.StartTime = this.GetTimeFromCell(this.m_selectedRange.StartCell);
330 args.EndTime = this.GetTimeFromCell(this.m_selectedRange.EndCell);
331 args.Resource = this.GetResourceFromColumn(this.m_selectedRange.StartCell.CellColumn);
332 if (args.EndTime < args.StartTime)
333 {
334 DateTime startTime = args.StartTime;
335 args.StartTime = args.EndTime;
336 args.EndTime = startTime;
337 }
338 TimeSpan span = new TimeSpan(0, 0, this.m_nTimeScale, 0, 0);
339 args.EndTime += span;
340 this.CGSelectionChanged(this, args);
341 this.m_bSelectingRange = false;
342 }
343 }
344
345 private void CalendarGrid_Paint(object sender, PaintEventArgs e)
346 {
347 if (e.Graphics != null)
348 {
349 this.DrawGrid(e.Graphics);
350 if (!this.m_bInitialUpdate)
351 {
352 this.SetAppointmentTypes();
353 base.Invalidate();
354 this.m_bInitialUpdate = true;
355 }
356 }
357 }
358
359 public void CloseGrid()
360 {
361 foreach (CGAppointment appointment in this.m_Appointments.AppointmentTable.Values)
362 {
363 appointment.Selected = false;
364 }
365 this.m_nSelectID = 0;
366 }
367
368 protected override void Dispose(bool disposing)
369 {
370 if (disposing && (this.components != null))
371 {
372 this.components.Dispose();
373 }
374 base.Dispose(disposing);
375 }
376
377 private void DrawAppointments(Graphics g, int col0Width, int cellWidth, int cellHeight)
378 {
379 if (!base.DesignMode && (this.m_Appointments != null))
380 {
381 int num = 0;
382 int num2 = 0;
383 int x = 0;
384 ArrayList list = new ArrayList();
385 foreach (CGAppointment appointment in this.m_Appointments.AppointmentTable.Values)
386 {
387 bool bRet = false;
388 Rectangle rect = this.GetAppointmentRect(appointment, col0Width, cellWidth, cellHeight, out bRet);
389 if (bRet && (!appointment.WalkIn || this.m_bDrawWalkIns))
390 {
391 rect.Inflate(-10, 0);
392 num = (int) this.m_ApptOverlapTable[appointment.m_nKey];
393 num2 = rect.Right - rect.Left;
394 x = num2 / (num + 1);
395 rect.Width = x;
396 if (num > 0)
397 {
398 foreach (object obj2 in list)
399 {
400 Rectangle rectangle2 = (Rectangle) obj2;
401 if (rect.IntersectsWith(rectangle2))
402 {
403 rect.Offset(x, 0);
404 }
405 }
406 }
407 appointment.GridRectangle = rect;
408 if (appointment.Selected)
409 {
410 Pen pen = new Pen(Brushes.Black, 5f);
411 g.DrawRectangle(pen, rect);
412 pen.Dispose();
413 }
414 else
415 {
416 g.DrawRectangle(Pens.Blue, rect);
417 }
418 string s = appointment.ToString();
419 Rectangle rectangle3 = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 1, rect.Height - 1);
420 g.FillRectangle(Brushes.White, rectangle3);
421 Brush black = Brushes.Black;
422 if (appointment.CheckInTime.Ticks > 0L)
423 {
424 black = Brushes.Green;
425 g.FillRectangle(Brushes.LightGreen, rectangle3);
426 }
427 if (appointment.NoShow)
428 {
429 black = Brushes.Red;
430 g.FillRectangle(Brushes.LightPink, rectangle3);
431 }
432 if (appointment.WalkIn)
433 {
434 black = Brushes.Blue;
435 g.FillRectangle(Brushes.LightSteelBlue, rectangle3);
436 }
437 g.DrawString(s, this.fontArial8, black, rectangle3);
438 list.Add(rect);
439 }
440 }
441 }
442 }
443
444 private void DrawGrid(Graphics g)
445 {
[821]446 //Default color of grid lines is black
447 Pen pen = new Pen(Color.Black);
448
449 //each cell's height is Height of Arial Font 10pt + 10 pixels (by default 26 pixels)
450 SizeF ef = g.MeasureString("Test", this.m_fCell);
451 int num = 10;
452 this.m_cellHeight = ((int) ef.Height) + num;
453
454 // Number of columns is dynamic based on user of Grid. See Property Columns. Default 5 in init.
455 int nColumns = this.m_nColumns;
456
457 //Time scale is also dynamic. Property TimeScale. Default 20 (minutes)
458 //num3 stands for number of cells per hour
459 int num3 = 60 / this.m_nTimeScale;
460 //num4 stands for number of cells per day (aka rows in the grid)
461 int num4 = 24 * num3;
462 //Add extra column to hold time in the left hand corner
463 nColumns++;
464 //add extra row to represent dates or resources (depending on which view we are in)
465 //Not sure of which variable controls view yet.
466 num4++;
467
468 // 100 px is reserved no matter our column sizes for displaying the time scale
469
470 // Minimum cell width is 600/columns (100 px by default)
471 this.m_cellWidth = 600 / nColumns;
472
473 // if we happen to have more than 600 pixels in our Client Window then cell
474 // is (Width-100) / (number of date columns)
475 if (base.ClientRectangle.Width > 600)
[622]476 {
[821]477 this.m_cellWidth = (base.ClientRectangle.Width - this.m_col0Width) / (nColumns - 1);
478 }
479
480 // If we have one column, the cell width is the itself - 100
481 if (this.m_nColumns == 1)
482 {
483 this.m_cellWidth = base.ClientRectangle.Width - this.m_col0Width;
484 }
485
486 // Our rectangle will start scrolling if width is less than 600 and height less than height of all cells comb
487 // Of course Height will scroll all the time unless you have a humungous screen
488 base.AutoScrollMinSize = new Size(600, this.m_cellHeight * num4);
489
490 // Default Rectangle is Gray
491 g.FillRectangle(Brushes.LightGray, base.ClientRectangle);
492
493 int num5 = 0; //Minutes (start at 0)
494 int num6 = 0; //Hour (starts at 0)
495
496 // flag is true only if there are no cells what so ever in the screen
497 // Only true when no resource is selected.
498 bool flag = this.m_gridCells.CellCount == 0;
499
500 // Move the base point from the client screen to the scrolling region top-left corner.
501 g.TranslateTransform((float) base.AutoScrollPosition.X, (float) base.AutoScrollPosition.Y);
502
[846]503 // This for loop draws the time scale (although I haven't completely traced it out)
[821]504 // For each row except the first one (i starts from 1 rather than zero)
505 for (int i = 1; i < num4; i++)
506 {
507 int x = 0;
508 //point is (0, 1st Cell Start) then (0, 2nd Cell Start) until we run out
509 Point point = new Point(x, i * this.m_cellHeight);
510 //rectangle2 represents each cell rectangle
511 Rectangle rectangle2 = new Rectangle(point.X, point.Y, this.m_cellWidth, this.m_cellHeight);
512 //rect stands for the time scale rectangle; width is 100px; Height is length of the hour on grid
513 Rectangle rect = new Rectangle(0, rectangle2.Y, this.m_col0Width, rectangle2.Height * num3);
514 //height is length of hour
515 int height = rect.Height;
516 //Min font height is 25 pixels (100/4)--see below where it's used
517 height = (height > (this.m_col0Width / 4)) ? (this.m_col0Width / 4) : height;
518
519 //if we are the top of the time scale (at hour:00) -- num5 is min
520 if (num5 == 0)
[622]521 {
[821]522 // Fill time scale triangle with Gray (remember, this is the whole hour!)
523 g.FillRectangle(Brushes.LightGray, rect);
524 // Draw Rectangle
525 g.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height);
526 //Pad time with at least one zero to make it 2 digits
527 string str = string.Format("{0}", num6).PadLeft(2, '0');
528 //Font height using pixels. Min is 25 pixels
529 Font font = new Font("Arial", (float) height, FontStyle.Bold, GraphicsUnit.Pixel);
530 // rectangle3 is the left half of the time rectangle
531 Rectangle rectangle3 = new Rectangle(rect.X, rect.Y, rect.Width / 2, rect.Height);
532 // In this left half, draw the hours (m_sfHour is the stringformat:
533 // Horizontal Center and Right Justified to rectangle3
534 g.DrawString(str, font, Brushes.Black, rectangle3, this.m_sfHour);
535 // Increment hour
536 num6++;
537 font.Dispose();
[622]538 }
[821]539
540 // Pad minutes with zeros to be 2 digits long
541 string s = string.Format("{0}", num5);
542 s = ":" + s.PadLeft(2, '0');
543 // Rectangle starts at
544 // X: 2/3rds of width of Time Rectangle
545 // Y: Top of the current time slot cell
546 // Width: 1/3rd of the width of the Time Rectangle
547 // Height: Height of a time slot
548 Rectangle layoutRectangle = new Rectangle(rect.X + ((rect.Width * 2) / 3), rectangle2.Top, rect.Width / 3, rectangle2.Height);
549 // At in this rectangle, write the minutes. Horizontal Ctr and Right Justified to Rectangle
550 g.DrawString(s, this.m_fCell, Brushes.Black, layoutRectangle, this.m_sfRight);
[846]551 // Draw Line from two points, just under the time we have just written
[821]552 Point point2 = new Point(rect.X + ((rect.Width * 2) / 3), rectangle2.Bottom);
553 Point point3 = new Point(rect.Right, rectangle2.Bottom);
554 g.DrawLine(pen, point2, point3);
[846]555 // Increment the minutes with the time scale
[821]556 num5 += this.m_nTimeScale;
[846]557 // If miniutes reaches 60, reset to zero
[821]558 num5 = (num5 >= 60) ? 0 : num5;
[846]559 // When we reach the bottom (num4 - 1 is # of rows) and we are not scrolling
[821]560 if ((i == (num4 - 1)) && !this.m_bScroll)
[622]561 {
[846]562 // Fill the last cell with Gray (?)
[821]563 g.TranslateTransform((float) -base.AutoScrollPosition.X, (float) -base.AutoScrollPosition.Y);
564 rect = new Rectangle(0, 0, this.m_col0Width, this.m_cellHeight);
565 g.FillRectangle(Brushes.LightGray, rect);
566 g.DrawRectangle(pen, rect);
567 g.TranslateTransform((float) base.AutoScrollPosition.X, (float) base.AutoScrollPosition.Y);
[622]568 }
[821]569 }
[846]570
571 //This for loop draws the cells
572 //Start from the bottom (num4 is # of rows) and go down to the zeroth row (ie date row/resource row)
[821]573 for (int j = num4; j > -1; j--)
574 {
[846]575 // For each column - 1 (we start at 1, not zero-->We drew the first column anyways in the 1st loop)
[821]576 for (int k = 1; k < nColumns; k++)
[622]577 {
[846]578 int num12 = 0; // X-axis position
579 if (k == 1) // If we are at the first column, start at 100px (default)
[622]580 {
[821]581 num12 = this.m_col0Width;
[622]582 }
[846]583 if (k > 1) //
[622]584 {
[821]585 num12 = this.m_col0Width + (this.m_cellWidth * (k - 1));
[622]586 }
[821]587 Point point4 = new Point(num12, j * this.m_cellHeight);
588 Rectangle r = new Rectangle(point4.X, point4.Y, this.m_cellWidth, this.m_cellHeight);
589 if (j != 0)
[622]590 {
[821]591 CGCell cellFromRowCol = null;
592 if (flag)
[622]593 {
[821]594 cellFromRowCol = new CGCell(r, j, k);
595 this.m_gridCells.AddCell(cellFromRowCol);
[622]596 }
[821]597 else
[622]598 {
[821]599 cellFromRowCol = this.m_gridCells.GetCellFromRowCol(j, k);
600 cellFromRowCol.CellRectangle = r;
[622]601 }
[821]602 if (this.m_sResourcesArray.Count > 0)
[622]603 {
[821]604 if (this.m_selectedRange.CellIsInRange(cellFromRowCol))
[622]605 {
[821]606 g.FillRectangle(Brushes.Aquamarine, r);
[622]607 }
608 else
609 {
[821]610 g.FillRectangle(cellFromRowCol.AppointmentTypeColor, r);
[622]611 }
[821]612 g.DrawRectangle(pen, r.X, r.Y, r.Width, r.Height);
613 if (j == 1)
[622]614 {
[821]615 this.DrawAppointments(g, this.m_col0Width, this.m_cellWidth, this.m_cellHeight);
[622]616 }
617 }
[821]618 continue;
619 }
620 if (!this.m_bScroll)
621 {
622 g.TranslateTransform(0f, (float) -base.AutoScrollPosition.Y);
623 Rectangle rectangle6 = r;
624 g.FillRectangle(Brushes.LightBlue, rectangle6);
625 g.DrawRectangle(pen, rectangle6.X, rectangle6.Y, rectangle6.Width, rectangle6.Height);
626 string str3 = "";
627 if (this.m_sResourcesArray.Count > 1)
[622]628 {
[821]629 foreach (DictionaryEntry entry in this.m_ColumnInfoTable)
[622]630 {
[821]631 int num13 = (int) entry.Value;
632 num13++;
633 if (num13 == k)
[622]634 {
[821]635 str3 = entry.Key.ToString();
636 break;
[622]637 }
638 }
[821]639 }
640 else
641 {
642 DateTime dtStart = this.m_dtStart;
643 if (k > 1)
[622]644 {
[821]645 dtStart = dtStart.AddDays((double) (k - 1));
[622]646 }
[821]647 string format = "ddd, MMM d";
648 str3 = dtStart.ToString(format, DateTimeFormatInfo.InvariantInfo);
[622]649 }
[821]650 g.DrawString(str3, this.m_fCell, Brushes.Black, rectangle6, this.m_sf);
651 g.TranslateTransform(0f, (float) base.AutoScrollPosition.Y);
[622]652 }
653 }
654 }
[821]655 this.m_bScroll = false;
656 pen.Dispose();
[622]657 }
658
659 public Rectangle GetAppointmentRect(CGAppointment a, int col0Width, int cellWidth, int cellHeight, out bool bRet)
660 {
661 DateTime startTime = a.StartTime;
662 DateTime endTime = a.EndTime;
663 string resource = a.Resource;
[900]664 int originX = 0;
665 int originY = 0;
666 int recHeight = 0;
667 int recWidth = 0;
668 int columnToPutAppt = 0;
[622]669 Rectangle rectangle = new Rectangle();
[900]670 int startTotalMinutesoffset = (int) startTime.TimeOfDay.TotalMinutes;
671 int endTotalMinutesoffset = (int) endTime.TimeOfDay.TotalMinutes;
[1038]672
673 // To fix a bug with 1 day view: if the start time of appt is before Calendar Start Date, don't draw anything.
674 if (startTime < this.m_dtStart)
675 {
676 bRet = false;
677 return rectangle;
678 }
679
[900]680 // if grid has more than one reource
[622]681 if (this.m_sResourcesArray.Count > 1)
682 {
[900]683 // get zero based index
684 columnToPutAppt = (int) this.m_ColumnInfoTable[resource];
685 // increment to 1 based index
686 columnToPutAppt++;
[622]687 }
688 else
689 {
[900]690 columnToPutAppt = (startTime - this.m_dtStart).Days + 1;
[622]691 }
[1038]692 // this if should not get tripped; it did the same function as the new first if check.
693 //if (columnToPutAppt < 1)
694 //{
695 // bRet = false;
696 // return rectangle;
697 //}
[900]698 originX = col0Width + (cellWidth * (columnToPutAppt - 1));
699 int num8 = startTotalMinutesoffset + this.m_nTimeScale;
700 int num9 = (endTotalMinutesoffset > 0) ? endTotalMinutesoffset : 0x5a0;
701 num9 -= startTotalMinutesoffset;
702 originY = (cellHeight * num8) / this.m_nTimeScale;
703 recHeight = (cellHeight * num9) / this.m_nTimeScale;
704 recWidth = cellWidth;
705 rectangle.X = originX;
706 rectangle.Y = originY;
707 rectangle.Width = recWidth;
708 rectangle.Height = recHeight;
[622]709 bRet = true;
710 return rectangle;
711 }
712
713 public bool GetCellFromTime(DateTime dDate, ref int nRow, ref int nCol, bool bStartCell, string sResource)
714 {
715 int num = (dDate.Hour * 60) + dDate.Minute;
716 nRow = num / this.m_nTimeScale;
717 if (bStartCell)
718 {
719 nRow++;
720 }
721 if (this.m_sResourcesArray.Count > 1)
722 {
723 if (sResource == "")
724 {
725 sResource = this.m_sResourcesArray[0].ToString();
726 }
727 nCol = (int) this.m_ColumnInfoTable[sResource];
728 nCol++;
729 return true;
730 }
731 DateTime time = new DateTime(dDate.Year, dDate.Month, dDate.Day);
732 TimeSpan span = (TimeSpan) (time - this.StartDate);
733 int totalDays = 0;
734 totalDays = (int) span.TotalDays;
735 nCol = totalDays;
736 nCol++;
737 return true;
738 }
739
740 private string GetResourceFromColumn(int nCol)
741 {
742 if (this.m_sResourcesArray.Count == 1)
743 {
744 return this.m_sResourcesArray[0].ToString();
745 }
746 foreach (DictionaryEntry entry in this.m_ColumnInfoTable)
747 {
748 int num = (int) entry.Value;
749 num++;
750 if (num == nCol)
751 {
752 return entry.Key.ToString();
753 }
754 }
755 return "";
756 }
757
758 public bool GetSelectedTime(out DateTime dStart, out DateTime dEnd, out string sResource)
759 {
760 if (this.m_selectedRange.Cells.CellCount == 0)
761 {
762 dEnd = new DateTime();
763 dStart = dEnd;
764 sResource = "";
765 return false;
766 }
767 CGCell startCell = this.m_selectedRange.StartCell;
768 CGCell endCell = this.m_selectedRange.EndCell;
769 if (startCell.CellRow > endCell.CellRow)
770 {
771 CGCell cell3 = startCell;
772 startCell = endCell;
773 endCell = cell3;
774 }
775 dStart = this.GetTimeFromCell(startCell);
776 dEnd = this.GetTimeFromCell(endCell);
777 dEnd = dEnd.AddMinutes((double) this.m_nTimeScale);
778 sResource = this.GetResourceFromColumn(startCell.CellColumn);
779 return true;
780 }
781
782 public bool GetSelectedType(out int nAccessTypeID)
783 {
784 nAccessTypeID = 0;
785 if (this.m_selectedRange.Cells.CellCount == 0)
786 {
787 return false;
788 }
789 CGCell startCell = this.m_selectedRange.StartCell;
790 CGCell endCell = this.m_selectedRange.EndCell;
791 if (startCell.CellRow > endCell.CellRow)
792 {
793 CGCell cell3 = startCell;
794 startCell = endCell;
795 endCell = cell3;
796 }
797 DateTime timeFromCell = this.GetTimeFromCell(startCell);
798 DateTime time2 = this.GetTimeFromCell(endCell).AddMinutes((double) this.m_nTimeScale);
799 foreach (CGAvailability availability in this.m_pAvArray)
800 {
801 if (this.TimesOverlap(availability.StartTime, availability.EndTime, timeFromCell, time2))
802 {
803 nAccessTypeID = availability.AvailabilityType;
804 break;
805 }
806 }
807 return (nAccessTypeID > 0);
808 }
809
810 public DateTime GetTimeFromCell(CGCell cgCell)
811 {
812 int cellRow = cgCell.CellRow;
813 int cellColumn = cgCell.CellColumn;
814 DateTime dtStart = this.m_dtStart;
815 int num3 = (cellRow - 1) * this.m_nTimeScale;
816 int num4 = num3 / 60;
817 if (num4 > 0)
818 {
819 num3 = num3 % (num4 * 60);
820 }
821 dtStart = dtStart.AddHours((double) num4).AddMinutes((double) num3);
822 if (this.m_sResourcesArray.Count == 1)
823 {
824 dtStart = dtStart.AddDays((double) (cellColumn - 1));
825 }
826 return dtStart;
827 }
828
829 public bool GetTypeFromCell(CGCell cgCell, out int nAccessTypeID)
830 {
831 nAccessTypeID = 0;
832 CGCell cell = cgCell;
833 CGCell cell2 = cgCell;
834 if (cell.CellRow > cell2.CellRow)
835 {
836 CGCell cell3 = cell;
837 cell = cell2;
838 cell2 = cell3;
839 }
840 DateTime timeFromCell = this.GetTimeFromCell(cell);
841 DateTime time2 = this.GetTimeFromCell(cell2).AddMinutes((double) this.m_nTimeScale);
842 foreach (CGAvailability availability in this.m_pAvArray)
843 {
844 if (this.TimesOverlap(availability.StartTime, availability.EndTime, timeFromCell, time2))
845 {
846 nAccessTypeID = availability.AvailabilityType;
847 break;
848 }
849 }
850 return (nAccessTypeID > 0);
851 }
852
853 private bool HitTest(int X, int Y, ref int nRow, ref int nCol)
854 {
855 Y -= base.AutoScrollPosition.Y;
856 X -= base.AutoScrollPosition.X;
857 foreach (DictionaryEntry entry in this.m_gridCells)
858 {
859 CGCell cell = (CGCell) entry.Value;
860 if (cell.CellRectangle.Contains(X, Y))
861 {
862 nRow = cell.CellRow;
863 nCol = cell.CellColumn;
864 return true;
865 }
866 }
867 return false;
868 }
869
870 public void InitializeCalendarGrid()
871 {
872 this.AllowDrop = true;
873 }
874
875 private void InitializeComponent()
876 {
[821]877 this.components = new System.ComponentModel.Container();
878 this.m_toolTip = new System.Windows.Forms.ToolTip(this.components);
879 this.SuspendLayout();
880 //
881 // CalendarGrid
882 //
[622]883 this.AutoScroll = true;
[821]884 this.AutoScrollMinSize = new System.Drawing.Size(600, 400);
885 this.BackColor = System.Drawing.SystemColors.Window;
886 this.Paint += new System.Windows.Forms.PaintEventHandler(this.CalendarGrid_Paint);
887 this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.CalendarGrid_MouseMove);
888 this.DragDrop += new System.Windows.Forms.DragEventHandler(this.CalendarGrid_DragDrop);
889 this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CalendarGrid_MouseDown);
890 this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.CalendarGrid_MouseUp);
891 this.DragEnter += new System.Windows.Forms.DragEventHandler(this.CalendarGrid_DragEnter);
892 this.ResumeLayout(false);
893
[622]894 }
895
896 private int MinSince80(DateTime d)
897 {
[821]898 DateTime time = new DateTime(1980, 1, 1, 0, 0, 0);
[622]899 TimeSpan span = (TimeSpan) (d - time);
900 return (int) span.TotalMinutes;
901 }
902
903 private void OnLButtonDown(int X, int Y, bool bStart)
904 {
905 this.m_bDragDropStart = false;
906 this.m_nSelectID = 0;
907 if (!this.m_bSelectingRange)
908 {
909 int y = Y - base.AutoScrollPosition.Y;
910 int x = X - base.AutoScrollPosition.X;
911 Point pt = new Point(x, y);
912 if (Control.ModifierKeys == Keys.Control)
913 {
914 this.m_bMouseDown = false;
915 foreach (CGAppointment appointment in this.m_Appointments.AppointmentTable.Values)
916 {
917 if (!appointment.GridRectangle.Contains(pt))
918 {
919 continue;
920 }
921 if (this.m_SelectedAppointments.AppointmentTable.ContainsKey(appointment.AppointmentKey))
922 {
923 this.m_SelectedAppointments.RemoveAppointment(appointment.AppointmentKey);
924 if (this.m_SelectedAppointments.AppointmentTable.Count == 0)
925 {
926 this.m_nSelectID = 0;
927 }
928 else
929 {
930 foreach (CGAppointment appointment2 in this.m_Appointments.AppointmentTable.Values)
931 {
932 this.m_nSelectID = appointment2.AppointmentKey;
933 }
934 }
935 }
936 else
937 {
938 this.m_SelectedAppointments.AddAppointment(appointment);
939 this.m_nSelectID = appointment.AppointmentKey;
940 }
941 appointment.Selected = !appointment.Selected;
942 break;
943 }
944 base.Invalidate();
945 return;
946 }
947 foreach (CGAppointment appointment3 in this.m_Appointments.AppointmentTable.Values)
948 {
949 if (!appointment3.GridRectangle.Contains(pt))
950 {
951 continue;
952 }
953 this.m_bMouseDown = false;
954 if (appointment3.Selected)
955 {
956 appointment3.Selected = false;
957 this.m_SelectedAppointments.ClearAllAppointments();
958 this.m_nSelectID = 0;
959 }
960 else
961 {
962 foreach (CGAppointment appointment4 in this.m_Appointments.AppointmentTable.Values)
963 {
964 appointment4.Selected = false;
965 }
966 this.m_SelectedAppointments.ClearAllAppointments();
967 this.m_SelectedAppointments.AddAppointment(appointment3);
968 appointment3.Selected = true;
969 this.m_nSelectID = appointment3.AppointmentKey;
970 this.m_bMouseDown = true;
971 this.m_bGridEnter = true;
972 }
973 base.Invalidate();
974 return;
975 }
976 }
977 int nRow = -1;
978 int nCol = -1;
979 if (this.HitTest(X, Y, ref nRow, ref nCol))
980 {
981 CGCell cellFromRowCol = this.m_gridCells.GetCellFromRowCol(nRow, nCol);
982 if (cellFromRowCol != null)
983 {
984 if (bStart)
985 {
986 this.m_currentCell = cellFromRowCol;
987 this.m_selectedRange.StartCell = null;
988 this.m_selectedRange.EndCell = null;
989 this.m_selectedRange.CreateRange(this.m_gridCells, cellFromRowCol, cellFromRowCol);
990 bStart = false;
991 this.m_bMouseDown = true;
992 this.m_bSelectingRange = true;
993 }
994 else if (cellFromRowCol != this.m_currentCell)
995 {
996 if (!this.m_selectedRange.Cells.CellHashTable.ContainsKey(cellFromRowCol.Key))
997 {
998 this.m_selectedRange.AppendCell(this.m_gridCells, cellFromRowCol);
999 }
1000 else
1001 {
1002 bool bUp = cellFromRowCol.CellRow < this.m_currentCell.CellRow;
1003 this.m_selectedRange.SubtractCell(this.m_gridCells, cellFromRowCol, bUp);
1004 }
1005 this.m_currentCell = cellFromRowCol;
1006 }
1007 cellFromRowCol.IsSelected = true;
1008 base.Invalidate();
1009 }
1010 }
1011 }
1012
1013 public void OnUpdateArrays()
1014 {
1015 try
1016 {
1017 this.m_gridCells.ClearAllCells();
1018 this.SetColumnInfo();
1019 this.SetOverlapTable();
1020 Graphics g = base.CreateGraphics();
1021 this.BuildGridCellsArray(g);
1022 this.SetAppointmentTypes();
1023 }
1024 catch (Exception exception)
1025 {
1026 string message = exception.Message;
1027 }
1028 }
1029
1030 private void SetAppointmentTypes()
1031 {
1032 if (this.m_gridCells.CellCount != 0)
1033 {
1034 foreach (DictionaryEntry entry in this.m_gridCells.CellHashTable)
1035 {
1036 CGCell cell = (CGCell) entry.Value;
1037 cell.AppointmentTypeColor = (this.m_GridBackColor == "blue") ? Brushes.CornflowerBlue : Brushes.Khaki;
1038 }
1039 if ((this.m_pAvArray != null) && (this.m_pAvArray.Count != 0))
1040 {
1041 foreach (CGAvailability availability in this.m_pAvArray)
1042 {
1043 int nRow = 0;
1044 int nCol = 0;
1045 int num3 = 0;
1046 int num4 = 0;
1047 Brush brush = new SolidBrush(Color.FromArgb(availability.Red, availability.Green, availability.Blue));
1048 this.GetCellFromTime(availability.StartTime, ref nRow, ref nCol, true, availability.ResourceList);
1049 this.GetCellFromTime(availability.EndTime, ref num3, ref num4, false, availability.ResourceList);
1050 for (int i = nCol; i <= num4; i++)
1051 {
1052 for (int j = nRow; (i == num4) && (j <= num3); j++)
1053 {
1054 string str = "r" + j.ToString() + "c" + i.ToString();
1055 CGCell cell2 = (CGCell) this.m_gridCells.CellHashTable[str];
1056 if (cell2 != null)
1057 {
1058 cell2.AppointmentTypeColor = brush;
1059 }
1060 }
1061 }
1062 }
1063 }
1064 }
1065 }
1066
1067 private void SetColumnInfo()
1068 {
1069 this.m_ColumnInfoTable.Clear();
1070 for (int i = 0; i < this.m_sResourcesArray.Count; i++)
1071 {
1072 this.m_ColumnInfoTable.Add(this.m_sResourcesArray[i], i);
1073 }
1074 if (this.m_sResourcesArray.Count > 1)
1075 {
1076 this.m_nColumns = this.m_sResourcesArray.Count;
1077 }
1078 }
1079
1080 public void SetOverlapTable()
1081 {
1082 Hashtable hashtable = new Hashtable();
1083 int y = 0;
1084 int num2 = 0;
1085 int x = 0;
1086 foreach (CGAppointment appointment in this.m_Appointments.AppointmentTable.Values)
1087 {
1088 if (!appointment.WalkIn || this.m_bDrawWalkIns)
1089 {
1090 string resource = appointment.Resource;
1091 y = appointment.StartTime.Minute + (60 * appointment.StartTime.Hour);
1092 num2 = appointment.EndTime.Minute + (60 * appointment.EndTime.Hour);
1093 x = (this.m_sResourcesArray.Count > 1) ? (((int) this.m_ColumnInfoTable[resource]) + 1) : appointment.StartTime.DayOfYear;
1094 Rectangle rectangle = new Rectangle(x, y, 1, num2 - y);
1095 hashtable.Add(appointment.m_nKey, rectangle);
1096 }
1097 }
1098 this.m_ApptOverlapTable.Clear();
1099 foreach (int num4 in hashtable.Keys)
1100 {
1101 this.m_ApptOverlapTable.Add(num4, 0);
1102 }
[821]1103 // Here it draws the Dates on Top
[622]1104 if (this.m_ApptOverlapTable.Count != 0)
1105 {
1106 int num5 = (this.m_sResourcesArray.Count > 1) ? 1 : this.StartDate.DayOfYear;
1107 int num6 = (this.m_sResourcesArray.Count > 1) ? (this.m_sResourcesArray.Count + 1) : (this.Columns + this.StartDate.DayOfYear);
1108 for (int i = num5; i < num6; i++)
1109 {
1110 ArrayList list = new ArrayList();
1111 for (int j = 1; j < this.Rows; j++)
1112 {
1113 Rectangle rectangle2 = new Rectangle(i, j * this.m_nTimeScale, 1, this.m_nTimeScale);
1114 int num9 = -1;
1115 list.Clear();
1116 foreach (int num10 in hashtable.Keys)
1117 {
1118 Rectangle rect = (Rectangle) hashtable[num10];
1119 if (rectangle2.IntersectsWith(rect))
1120 {
1121 num9++;
1122 list.Add(num10);
1123 }
1124 }
1125 if (num9 > 0)
1126 {
1127 foreach (object obj2 in list)
1128 {
1129 int num11 = (int) obj2;
1130 if (((int) this.m_ApptOverlapTable[num11]) < num9)
1131 {
1132 this.m_ApptOverlapTable[num11] = num9;
1133 }
1134 }
1135 }
1136 }
1137 }
1138 }
1139 }
1140
1141 private void tickEventHandler(object o, EventArgs e)
1142 {
1143 Point point = new Point(base.AutoScrollPosition.X, base.AutoScrollPosition.Y);
1144 int x = point.X;
1145 int num = point.Y * -1;
1146 num = this.m_bScrollDown ? (num + 5) : (num - 5);
1147 point.Y = num;
1148 base.AutoScrollPosition = point;
1149 base.Invalidate();
1150 }
1151
1152 private bool TimesOverlap(DateTime dStart1, DateTime dEnd1, DateTime dStart2, DateTime dEnd2)
1153 {
1154 long ticks = dEnd1.Ticks - dStart1.Ticks;
1155 TimeSpan ts = new TimeSpan(ticks);
1156 ticks = dEnd2.Ticks - dStart2.Ticks;
1157 new TimeSpan(ticks).Subtract(ts);
1158 Rectangle rect = new Rectangle();
1159 Rectangle rectangle2 = new Rectangle();
1160 rect.X = 0;
1161 rectangle2.X = 0;
1162 rect.Width = 1;
1163 rectangle2.Width = 1;
1164 rect.Y = this.MinSince80(dStart1);
1165 rect.Height = this.MinSince80(dEnd1) - rect.Y;
1166 rectangle2.Y = this.MinSince80(dStart2);
1167 rectangle2.Height = this.MinSince80(dEnd2) - rectangle2.Y;
1168 return rectangle2.IntersectsWith(rect);
1169 }
1170
[1068]1171 public void PositionGrid(int nHour)
1172 {
1173 //Position grid to nHour
1174 int nRow = 0, nCol = 0;
1175 DateTime dStart = DateTime.Today;
1176 dStart = dStart.AddHours(nHour);
1177 this.GetCellFromTime(dStart, ref nRow, ref nCol, false, "");
1178 int nHeight = this.CellHeight + 10;
1179 nHeight *= nRow;
1180 this.AutoScrollPosition = new Point(50, nHeight);
1181 this.Invalidate();
1182 }
1183
1184
[821]1185 /// <summary>
1186 /// The purpose of this is to properly draw the date boxes at the top of the calendar grid.
1187 /// Otherwise, when scrolling, it gets garbled.
1188 /// </summary>
[1075]1189 /// <param name="msg">Handles three messages:
[821]1190 /// WM_VSCROLL (0x115 - Vertical Scrolling)
1191 /// WM_HSCROLL (0x114 - Horizontal Scrolling)
[1075]1192 /// WM_MOUSEWHEEL (0x20a - Mouse Wheel Movement)
[821]1193 /// </param>
[622]1194 protected override void WndProc(ref Message msg)
1195 {
1196 try
1197 {
[1075]1198 if (msg.Msg == WM_VSCROLL || msg.Msg == WM_MOUSEWHEEL)
[622]1199 {
1200 this.m_bScroll = true;
1201 base.Invalidate(false);
1202 this.m_bScroll = false;
1203 }
[821]1204 if (msg.Msg == WM_HSCROLL)
[622]1205 {
1206 base.Invalidate(false);
1207 }
1208 base.WndProc(ref msg);
1209 }
1210 catch (Exception exception)
1211 {
1212 MessageBox.Show("CalendarGrid::WndProc: " + exception.Message + "\nStack: " + exception.StackTrace);
1213 }
1214 }
1215
1216 public CGAppointments Appointments
1217 {
1218 get
1219 {
1220 return this.m_Appointments;
1221 }
1222 set
1223 {
1224 this.m_Appointments = value;
1225 }
1226 }
1227
1228 public string ApptDragSource
1229 {
1230 get
1231 {
1232 return this.m_sDragSource;
1233 }
1234 set
1235 {
1236 this.m_sDragSource = value;
1237 }
1238 }
1239
1240 public ArrayList AvailabilityArray
1241 {
1242 get
1243 {
1244 return this.m_pAvArray;
1245 }
1246 set
1247 {
1248 this.m_pAvArray = value;
1249 }
1250 }
1251
1252 public int CellHeight
1253 {
1254 get
1255 {
1256 return this.m_cellHeight;
1257 }
1258 }
1259
1260 public ToolTip CGToolTip
1261 {
1262 get
1263 {
1264 return this.m_toolTip;
1265 }
1266 }
1267
1268 public int Columns
1269 {
1270 get
1271 {
1272 return this.m_nColumns;
1273 }
1274 set
1275 {
1276 if ((value > 0) && (value < 11))
1277 {
1278 this.m_nColumns = value;
1279 this.m_gridCells.ClearAllCells();
1280 this.m_selectedRange.Cells.ClearAllCells();
1281 Graphics g = base.CreateGraphics();
1282 this.BuildGridCellsArray(g);
1283 this.SetAppointmentTypes();
1284 base.Invalidate();
1285 }
1286 }
1287 }
1288
1289 public bool DrawWalkIns
1290 {
1291 get
1292 {
1293 return this.m_bDrawWalkIns;
1294 }
1295 set
1296 {
1297 this.m_bDrawWalkIns = value;
1298 }
1299 }
1300
1301 public string GridBackColor
1302 {
1303 get
1304 {
1305 return this.m_GridBackColor;
1306 }
1307 set
1308 {
1309 this.m_GridBackColor = value;
1310 }
1311 }
1312
1313 public bool GridEnter
1314 {
1315 get
1316 {
1317 return this.m_bGridEnter;
1318 }
1319 set
1320 {
1321 this.m_bGridEnter = value;
1322 }
1323 }
1324
1325 public ArrayList Resources
1326 {
1327 get
1328 {
1329 return this.m_sResourcesArray;
1330 }
1331 set
1332 {
1333 this.m_sResourcesArray = value;
1334 }
1335 }
1336
1337 public int Rows
1338 {
1339 get
1340 {
1341 return (0x5a0 / this.m_nTimeScale);
1342 }
1343 }
1344
1345 public int SelectedAppointment
1346 {
1347 get
1348 {
1349 return this.m_nSelectID;
1350 }
1351 set
1352 {
1353 this.m_nSelectID = value;
1354 }
1355 }
1356
1357 public CGAppointments SelectedAppointments
1358 {
1359 get
1360 {
1361 return this.m_SelectedAppointments;
1362 }
1363 }
1364
1365 public CGRange SelectedRange
1366 {
1367 get
1368 {
1369 return this.m_selectedRange;
1370 }
1371 }
1372
1373 public DateTime StartDate
1374 {
1375 get
1376 {
1377 return this.m_dtStart;
1378 }
1379 set
1380 {
1381 this.m_dtStart = value;
1382 }
1383 }
1384
1385 public int TimeScale
1386 {
1387 get
1388 {
1389 return this.m_nTimeScale;
1390 }
1391 set
1392 {
1393 if ((((value == 5) || (value == 10)) || ((value == 15) || (value == 20))) || ((value == 30) || (value == 60)))
1394 {
1395 this.m_nTimeScale = value;
1396 this.m_gridCells.ClearAllCells();
1397 this.m_selectedRange.Cells.ClearAllCells();
1398 Graphics g = base.CreateGraphics();
1399 this.BuildGridCellsArray(g);
1400 this.SetAppointmentTypes();
1401 base.Invalidate();
1402 }
1403 }
1404 }
[821]1405
[622]1406 }
1407}
1408
Note: See TracBrowser for help on using the repository browser.