private void GanttChart_TimeBlockDoubleClick(TimeBlockClickedEventArgs e) { if (CurrentUser?.Permissions == Permissions.Manager) { ShiftEditor editor = new ShiftEditor(e.RelatedRow, e.ClickedTimeBlock as Shift); editor.ShiftResult += (result) => { if (result == null) { Common.PendingShiftChanges.Add(new Tuple <Shift, Person, Edit>(e.ClickedTimeBlock as Shift, e.RelatedRow as Person, Edit.Delete)); //Delete timeblock from chart } else { //Update timeblock in chart Common.PendingShiftChanges.Add(new Tuple <Shift, Person, Edit>(e.ClickedTimeBlock as Shift, e.RelatedRow as Person, Edit.Delete)); Common.PendingShiftChanges.Add(new Tuple <Shift, Person, Edit>(result as Shift, e.RelatedRow as Person, Edit.Add)); } Editor_RefreshGanttChart(); }; editor.ShowDialog(); Common.CurrentlyUsedColors = Common.CurrentData.SelectMany(p => p.TimeBlocks).Where(p => p.Clickable).Select(p => p.Color).Distinct().ToList(); } }
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; }