Пример #1
0
        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();
            }
        }
Пример #2
0
        private void GanttChart_MainCanvasDoubleClick(CanvasClickedEventArgs e)
        {
            if (e.ClickedLocation.HasValue && CurrentUser?.Permissions == Permissions.Manager)
            {
                ShiftEditor editor = new ShiftEditor(e.RelatedRow, e.ClickedLocation.Value);
                editor.ShiftResult += (result) =>
                {
                    if (result != null)
                    {
                        Common.PendingShiftChanges.Add(new Tuple <Shift, Person, Edit>(result, 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();;
            }
        }