Example #1
0
        private void HandleCardClicked(IDMigrationStepCard c, MouseEvent e)
        {
            if (!e.ShiftPressed)
            {
                lastClickedBeforeShift = c;
            }

            // For a card to be clicked, there must be at least one card, therefore this should never throw an exception
            if (lastClickedBeforeShift == null)
            {
                lastClickedBeforeShift = Cards[0];
            }

            if (e.ShiftPressed)
            {
                DeselectAll(false);

                var start = lastClickedBeforeShift.Index;
                var end   = c.Index;

                // Swap the indices
                if (start > end)
                {
                    var t = start;
                    start = end;
                    end   = t;
                }

                for (var i = start; i <= end; i++)
                {
                    SelectStep(i, true, false);
                }

                OnSelectionChanged();
            }
            else
            {
                if (e.ControlPressed)
                {
                    ToggleStepSelection(c.Index, true);
                }
                else
                {
                    var otherSelectedSteps = SelectedStepIndices.Clone();
                    otherSelectedSteps.Remove(c.Index);
                    if (otherSelectedSteps.Count == 0)
                    {
                        ToggleStepSelection(c.Index);
                    }
                    else
                    {
                        SelectStep(c.Index);
                    }
                }
            }
        }
Example #2
0
        private void OnStepSelected(IDMigrationStepCard card)
        {
            var commonSteps = new List <SourceTargetRange> {
                card.StepRange
            };

            if (CommonIDMigrationStep.Value != null)
            {
                commonSteps.Add(CommonIDMigrationStep.Value);
            }
            CommonIDMigrationStep.Value = GetCommon(commonSteps); // Additive logic works
            StepSelected?.Invoke(card);
        }
Example #3
0
 private void OnStepDeselected(IDMigrationStepCard card)
 {
     CommonIDMigrationStep.Value = GetCommon(SelectedSteps);
     StepDeselected?.Invoke(card);
 }