Exemplo n.º 1
0
 public void NotifyUpdateShortcut() => ShortcutUpdated?.Invoke(this, EventArgs.Empty);
Exemplo n.º 2
0
        public void SetShortcut(string performer, string command, Keys key)
        {
            // Задаем команды водителя
            if (command == Properties.Resources.MoveCommandNone)
            {
                none = key;
            }
            if (command == Properties.Resources.MoveCommandForward)
            {
                moveForward = key;
            }
            if (command == Properties.Resources.MoveCommandBackward)
            {
                moveBackward = key;
            }
            if (command == Properties.Resources.MoveCommandRotate45CW &&
                performer == Properties.Resources.MovePerformer)
            {
                moveRotateCW = key;
            }
            if (command == Properties.Resources.MoveCommandRotate45CCW &&
                performer == Properties.Resources.MovePerformer)
            {
                moveRotateCCW = key;
            }
            if (command == Properties.Resources.MoveCommandForwardRotate45CW)
            {
                moveForward45CW = key;
            }
            if (command == Properties.Resources.MoveCommandForwardRotate45CCW)
            {
                moveForward45CCW = key;
            }
            if (command == Properties.Resources.MoveCommandBackwardRotate45CW)
            {
                moveBackward45CW = key;
            }
            if (command == Properties.Resources.MoveCommandBackwardRotate45CCW)
            {
                moveBackward45CCW = key;
            }

            // Задаем команды заряжающего
            if (command == Properties.Resources.ChargeCommandPressure1)
            {
                chargePressure = key;
            }
            if (command == Properties.Resources.ChargeCommandCharge)
            {
                chargeCharge = key;
            }
            if (command == Properties.Resources.ChargeCommandRefuel)
            {
                chargeRefuel = key;
            }

            // Задаем команды наводчика
            if (command == Properties.Resources.TurretCommandRotate45CW &&
                performer == Properties.Resources.TurretPerformer)
            {
                turretRotateCW = key;
            }
            if (command == Properties.Resources.TurretCommandRotate45CCW &&
                performer == Properties.Resources.TurretPerformer)
            {
                turretRotateCCW = key;
            }
            if (command == Properties.Resources.TurretCommandUp)
            {
                turretUp = key;
            }
            if (command == Properties.Resources.TurretCommandDown)
            {
                turretDown = key;
            }
            if (command == Properties.Resources.TurretCommandShoot)
            {
                turretShoot = key;
            }

            // Задаем команды алгоритма
            if (command == Properties.Resources.RunAlgorithm)
            {
                run = key;
            }
            if (command == Properties.Resources.ReloadAlgorithm)
            {
                reload = key;
            }
            if (command == Properties.Resources.StepAlgorithm)
            {
                step = key;
            }
            if (command == Properties.Resources.ClearWholeAlgorithm)
            {
                clearParallelAlgorithm = key;
            }
            if (command == Properties.Resources.ClearTankAlgorithm)
            {
                clearTankAlgorithm = key;
            }
            if (command == Properties.Resources.CancelSelection)
            {
                clearSelection = key;
            }
            if (command == Properties.Resources.DeleteAction)
            {
                deleteAction = key;
            }

            ShortcutUpdated?.Invoke(this, new UpdateShortcutEventArgs(command, key));
        }