/// <summary> /// Handler for when slide manipulation is complete /// </summary> private void ContentGrid_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e) { if (SwipeStatus == SwipeStatus.Idle) { return; } var y = _transform.TranslateY; _contentAnimation.From = y; _commandContainerClipTranslateAnimation.From = 0; _commandContainerClipTranslateAnimation.To = -y; _contentStoryboard.Begin(); if (SwipeStatus == SwipeStatus.SwipingPassedTopThreshold) { BottomCommandRequested?.Invoke(this, EventArgs.Empty); BottomCommand?.Execute(BottomCommandParameter); } else if (SwipeStatus == SwipeStatus.SwipingPassedBottomThreshold) { TopCommandRequested?.Invoke(this, EventArgs.Empty); TopCommand?.Execute(TopCommandParameter); } Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { SwipeStatus = SwipeStatus.Idle; }).AsTask(); }
public void CheckIfMethodTopExecuteReturnsProperEmptyString() { IMatrixField field = FieldFactory.Instance.GetField(5); IScoreboard scoreboard = new ScoreboardProxy(); IRandomNumberGenerator random = new RandomNumberGenerator(); IGameEngine gameEngine = new GameFifteenEngine(field, scoreboard, random); TopCommand topCommand = new TopCommand(gameEngine); string result = topCommand.Execute(); Assert.IsInstanceOfType(result, typeof(String)); }
/// <summary> /// Process the game. /// </summary> /// <param name="playBoard">Current play board value.</param> /// <param name="playerMoves">Current player moves.</param> public void ProcessGame(ref char[,] playBoard, ref int playerMoves) { byte rowLenght = (byte)playBoard.GetLength(0); byte columnLenght = (byte)playBoard.GetLength(1); Board boardGenerator = new Board(rowLenght, columnLenght); ScoreBoardFormatter formatter = new ScoreBoardFormatter(); // ILogger fileLogger = new FileLogger("scorebord.txt", formatter); ILogger consoleLogger = new ConsoleLogger(formatter); ScoreBoard scoreBoard = new ScoreBoard(consoleLogger); var printer = PrintingManager.Instance; switch (this.currentCommand) { case "RESTART": IInputCommand restart = new RestartCommand(boardGenerator, printer); restart.Execute(ref playBoard, ref playerMoves); break; case "TOP": IInputCommand topscoreBoard = new TopCommand(scoreBoard, this.topPlayers); topscoreBoard.Execute(ref playBoard, ref playerMoves); break; case "EXIT": break; default: InputCommandValidator validator = new InputCommandValidator(); if (validator.IsValidInputCommand(this.currentCommand)) { IInputCommand play = new PlayCommand(this.currentCommand, this.topPlayers, scoreBoard, boardGenerator, printer); play.Execute(ref playBoard, ref playerMoves); break; } Console.WriteLine("Wrong input ! Try Again ! "); break; } }