internal void Add(Appointment newAppointment) { if (this.AppointmentGroups.Count(ag => ag.GroupId == newAppointment.GroupId) > 0) { var group = this.m_AppointmentGroups.Where(ag => ag.GroupId == newAppointment.GroupId).First(); group.Add(newAppointment); } }
private void BuildCrewVeiw(string crewFileName) { CrewListParser crewListParser = new CrewListParser(crewFileName); DataTable crewTable = crewListParser.Read(); //to-do if (crewTable.Rows == null) { return; } crew.Clear(); for (int i = 0; i < crewTable.Rows.Count; i++) { AppointmentGroup ag = new AppointmentGroup(); ag.GroupTitle = crewTable.Rows[i].ItemArray[0].ToString(); ag.GroupId = i; if (i == 2) { Appointment ap = new Appointment() { Title = "test", GroupId = i, StartTime = DateTime.Now, EndTime = DateTime.Now.AddHours(1), Percent = 0.7f, Tooltip = "test" }; ag.Add(ap); } crew.Add(ag); } this.rosterGanttControl1.StartTime = _startTime; if (_totalHour > 1) this.rosterGanttControl1.TotalHour = _totalHour; this.rosterGanttControl1.Invalidate(); }
private void OnRowPageSizeChanged() { this.selectedAppointment = null; AdjustScrollbar(); Invalidate(); }
private void OnLeftWidthChanged() { this.selectedAppointment = null; AdjustScrollbar(); Invalidate(); }
private void EnterNewAppointmentMode(char key) { Appointment appointment = new Appointment(); appointment.StartTime = selectionStart; appointment.EndTime = selectionEnd; appointment.GroupId = selectionGroup; appointment.Title = key.ToString(); SelectedAppointment = appointment; selectedAppointmentIsNew = true; activeTool = selectionTool; Invalidate(); System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(EnterEditMode)); }
public override void DrawAppointment(System.Drawing.Graphics g, System.Drawing.Rectangle rect, Appointment appointment, bool isSelected, int gripWidth, bool drawPercent) { Color start = InterpolateColors(appointment.Color, Color.White, 0.4f); Color end = InterpolateColors(appointment.Color, Color.FromArgb(191, 210, 234), 0.7f); if ((appointment.Locked)) { // Draw back using (Brush m_Brush = new System.Drawing.Drawing2D.HatchBrush(System.Drawing.Drawing2D.HatchStyle.LargeConfetti, Color.Blue, appointment.Color)) g.FillRectangle(m_Brush, rect); // little transparent start = Color.FromArgb(230, start); end = Color.FromArgb(180, end); using (GraphicsPath path = new GraphicsPath()) path.AddRectangle(rect); using (LinearGradientBrush aGB = new LinearGradientBrush(rect, start, end, LinearGradientMode.Vertical)) g.FillRectangle(aGB, rect); } else { // Draw back using (LinearGradientBrush aGB = new LinearGradientBrush(rect, start, end, LinearGradientMode.Vertical)) g.FillRectangle(aGB, rect); } if (isSelected) { Rectangle m_BorderRectangle = rect; using (Pen m_Pen = new Pen(appointment.BorderColor, 2)) g.DrawRectangle(m_Pen, rect); m_BorderRectangle.Inflate(2, 2); using (Pen m_Pen = new Pen(SystemColors.WindowFrame, 1)) g.DrawRectangle(m_Pen, m_BorderRectangle); m_BorderRectangle.Inflate(-4, -4); using (Pen m_Pen = new Pen(SystemColors.WindowFrame, 1)) g.DrawRectangle(m_Pen, m_BorderRectangle); } else { // Draw gripper Rectangle m_GripRectangle = rect; m_GripRectangle.Width = gripWidth + 1; start = InterpolateColors(appointment.BorderColor, appointment.Color, 0.2f); end = InterpolateColors(appointment.BorderColor, Color.White, 0.6f); using (LinearGradientBrush aGB = new LinearGradientBrush(rect, start, end, LinearGradientMode.Vertical)) g.FillRectangle(aGB, m_GripRectangle); using (Pen m_Pen = new Pen(SystemColors.WindowFrame, 1)) g.DrawRectangle(m_Pen, rect); // Draw shadow lines int xLeft = rect.X + 6; int xRight = rect.Right + 1; int yTop = rect.Y + 1; int yButton = rect.Bottom + 1; for (int i = 0; i < 5; i++) { using (Pen shadow_Pen = new Pen(Color.FromArgb(70 - 12 * i, Color.Black))) { g.DrawLine(shadow_Pen, xLeft + i, yButton + i, xRight + i - 1, yButton + i); //horisontal lines g.DrawLine(shadow_Pen, xRight + i, yTop + i, xRight + i, yButton + i); //vertical } } } rect.X += gripWidth; g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; using (StringFormat m_Format = new StringFormat()) { m_Format.Alignment = StringAlignment.Near; m_Format.LineAlignment = StringAlignment.Near; g.DrawString(appointment.Title, this.BaseFont, SystemBrushes.WindowText, rect, m_Format); } g.TextRenderingHint = TextRenderingHint.SystemDefault; if (drawPercent) { //draw percentage. using (Pen percent_Pen = new Pen(InterpolateColors(appointment.BorderColor, appointment.Color, 0.4f), 6.0f)) { g.DrawLine(percent_Pen, rect.X, rect.Top + (rect.Bottom - rect.Top) / 2, rect.Left + (int)((rect.Right - rect.Left) * appointment.Percent), rect.Top + (rect.Bottom - rect.Top) / 2); } } }
public AppointmentEventArgs(Appointment appointment) { m_Appointment = appointment; }
private void BuildPairingView(string pairingFileName) { PairingListParser pairingListParser = new PairingListParser(pairingFileName); DataTable pairingTable = pairingListParser.Read(); //to-do if (pairingTable.Rows == null) { return; } string formatString = "yyyyMMddHHmmss"; DateTime startTime = DateTime.Now; DateTime endTime = DateTime.Now; List<DateTime> startTimeList = new List<DateTime>(); List<DateTime> endTimeList = new List<DateTime>(); bool newAppGroup = true; pairing.Clear(); int i = 0; foreach (DataRow dr in pairingTable.Rows) { startTime = DateTime.ParseExact(dr.ItemArray[4].ToString(), formatString, null); endTime = DateTime.ParseExact(dr.ItemArray[5].ToString(), formatString, null); startTimeList.Add(startTime); endTimeList.Add(endTime); //ag2.WorkTimes.Add(new TimeRange() { startTime = DateTime.Today.AddHours(9), endTime = DateTime.Today.AddHours(15) }); //ag2.WorkTimes.Add(new TimeRange() { startTime = DateTime.Today.AddHours(17), endTime = DateTime.Today.AddHours(18) }); foreach (AppointmentGroup _ag in pairing) { var confs = _ag.Where(a => (this.IsTimeCrossing(startTime, endTime, a.StartTime, a.EndTime))); if (confs.Count() == 0) { Appointment ap = new Appointment() { Title = dr.ItemArray[0].ToString(), GroupId = _ag.GroupId, StartTime = startTime, EndTime = endTime, Percent = 0.7f, Tooltip = dr.ItemArray[1].ToString() + " " + "Flight Time " + dr.ItemArray[6] }; _ag.Add(ap); newAppGroup = false; break; } } if (newAppGroup) { AppointmentGroup ag = new AppointmentGroup(); ag.GroupTitle = "Pairing"; ag.GroupId = i++; Appointment ap = new Appointment() { Title = dr.ItemArray[0].ToString(), GroupId = ag.GroupId, StartTime = startTime, EndTime = endTime, Percent = 0.7f, Tooltip = dr.ItemArray[1].ToString() + " " + "Flight Time " + dr.ItemArray[6] }; ag.Add(ap); pairing.Add(ag); } } TimeRange(startTimeList, endTimeList); this.rosterGanttControl2.StartTime = _startTime; if (_totalHour > 1) this.rosterGanttControl2.TotalHour = _totalHour; this.rosterGanttControl2.Invalidate(); }
public abstract void DrawAppointment(Graphics g, Rectangle rect, Appointment appointment, bool isSelected, int gripWidth, bool drawPercent);