public void ProcessKey(KeyboardCommandData key) { var shiftValue = 200; if (key.Shift || key.Ctrl) { shiftValue = 50; } if (CommonKeyboardProcessing.ProcessCommonKeys(model, key)) { return; } switch (key.Command) { case KeyboardCommands.LargeLeft: PrevChunk(); return; case KeyboardCommands.LargeRight: NextChunk(); return; case KeyboardCommands.LeftToLeft: ShiftLeft(-shiftValue); return; case KeyboardCommands.LeftToRight: ShiftLeft(shiftValue); return; case KeyboardCommands.RightToLeft: ShiftRight(-shiftValue); return; case KeyboardCommands.RightToRight: ShiftRight(shiftValue); return; case KeyboardCommands.SpeedUp: model.WindowState.SpeedRatio += 0.5; return; case KeyboardCommands.SpeedDown: model.WindowState.SpeedRatio -= 0.5; return; } }
public void ProcessKey(KeyboardCommandData key) { if (CommonKeyboardProcessing.ProcessCommonKeys(model, key)) { return; } switch (key.Command) { case KeyboardCommands.LargeRight: var border = montage.Borders.Where(z => z.StartTime > model.WindowState.CurrentPosition).FirstOrDefault(); if (border != null) { model.WindowState.CurrentPosition = border.StartTime; } return; case KeyboardCommands.LargeLeft: var border1 = montage.Borders.Where(z => z.EndTime < model.WindowState.CurrentPosition).LastOrDefault(); if (border1 != null) { model.WindowState.CurrentPosition = border1.StartTime; } return; case KeyboardCommands.SpeedDown: FastSpeed -= 0.5; return; case KeyboardCommands.SpeedUp: FastSpeed += 0.5; return; } var borderIndex = montage.Borders.FindBorder(model.WindowState.CurrentPosition); if (borderIndex == -1) { return; } int leftBorderIndex = -1; int rightBorderIndex = -1; if (montage.Borders[borderIndex].IsLeftBorder) { leftBorderIndex = borderIndex; if (borderIndex != 0 && !montage.Borders[borderIndex - 1].IsLeftBorder) { rightBorderIndex = borderIndex - 1; } } else { rightBorderIndex = borderIndex; if (borderIndex != montage.Borders.Count - 1 && montage.Borders[borderIndex + 1].IsLeftBorder) { leftBorderIndex = borderIndex + 1; } } var value = 200; if (key.Shift) { value = 50; } switch (key.Command) { case KeyboardCommands.LeftToLeft: Shift(rightBorderIndex, -value); return; case KeyboardCommands.LeftToRight: Shift(rightBorderIndex, value); return; case KeyboardCommands.RightToLeft: Shift(leftBorderIndex, -value); return; case KeyboardCommands.RightToRight: Shift(leftBorderIndex, value); return; } }