private void GanttChart_TimeBlockSingleClick(TimeBlockClickedEventArgs e) { if (InfoPane.OpenInfoPane != null) { InfoPane.OpenInfoPane.Close(); } InfoPane infoPane = new InfoPane(e.ClickedTimeBlock as Shift, e.RelatedRow as Person); infoPane.Show(); Point p = new Point(e.CursorLocation.X + this.Left + navGanttChart.Left + 8 /*Todo: not sure why the reason for the "8"*/, e.CursorLocation.Y + this.Top + navGanttChart.Top + 31 /*Todo: not sure why the reason for the "31"*/); infoPane.Location = p; }
public InfoPane(Shift shift, Person relatedPerson) { InitializeComponent(); labelText.Text += $"{shift.Text}"; labelText.Text += $"\n\n{relatedPerson.Text}"; labelText.Text += $"\n\n{shift.StartTime.ToString("M/d %htt")}"; labelText.Text += $"\n\n{shift.EndTime.ToString("M/d %htt")}"; if (!string.IsNullOrEmpty(shift.Notes)) { labelText.Text += $"\n\n{shift.Notes}"; } ResizePane(); StartExpirationTimer(); OpenInfoPane = this; }