Exemple #1
0
        private void InstallOnActionMap(AbstractHierarchicalDictionary <string, Action <object, ActionEventArgs> > map)
        {
            map.Put(ScfeActions.GoDownFast, (sender, args) =>
            {
                var dest = _table.FocusedIndex + _table.Height - 1;
                if (dest > _table.Data.Count)
                {
                    dest = _table.Data.Count - 1;
                }

                _table.FocusIndex(dest, args.Graphics);
            });
            map.Put(
                ScfeActions.GoUpFast, (sender, args) =>
            {
                var dest = _table.FocusedIndex - _table.Height;
                if (dest < 0)
                {
                    dest = 0;
                }

                _table.FocusIndex(dest, args.Graphics);
            }
                );
            map.Put(StandardActionNames.MoveLeft, (sender, args) =>
            {
                var parent = CurrentDir.GetParent();
                ResetTextBox(args.Graphics);
                if (parent != null)
                {
                    SwitchToFolder(parent, args.Graphics, CurrentDir);
                }
            }
                    );
            map.Put(
                ScfeActions.ToggleSelection, (o, args) =>
            {
                for (int i = 0; i < _table.Data.Count; i++)
                {
                    _table.TrySelect(i);
                }

                _table.Validate();
                _table.Print(args.Graphics);
            }
                );
            map.Put(
                ScfeActions.SelectAll, (o, args) =>
            {
                _table.ResetSelection();
                for (int i = 0; i < _table.Data.Count; i++)
                {
                    _table.TrySelect(i);
                }

                _table.Validate();
                _table.Print(args.Graphics);
            });
            map.Put(
                StandardActionNames.SecondaryAction, (sender, args) =>
            {
                OpenActionSecondaryAction(_table.SelectedElements.Count > 0
                        ? _table.SelectedElements
                        : new[] { _table.FocusedElement }.ToImmutableList(), args.Graphics);
            }
                );
            map.Put(
                StandardActionNames.SelectAction, (sender, args) =>
            {
                _table.TrySelect(_table.FocusedIndex);
                _table.ValidateAndPrint(_table.FocusedIndex, args.Graphics);
            }
                );

            foreach (var(actionName, action) in _extensions.SelectMany(e => e.GetActions()))
            {
                map.Put(actionName, action);
            }
        }