コード例 #1
0
        public void ProcessAnalysisResult(IPlayerNotifier playerNotifier, Result result, string errorMessage,
                                          AttemptGameState attemptGameState)
        {
            if (result != null)
            {
                attemptGameState.SetLatestResult(result);
                var feedback           = CreateFeedback(attemptGameState);
                var latestResult       = attemptGameState.LatestResult;
                var kataFullyCompleted = latestResult.PlayerFeedback.KataCompleted &&
                                         !latestResult.PlayerFeedback.AllLevelsCompleted;
                if (kataFullyCompleted)
                {
                    var kataDuration = attemptGameState.KataTimer.KataDuration;

                    feedback.Message = feedback.Message + Environment.NewLine + Environment.NewLine + "Time taken: " + kataDuration;
                    var kataCompletedView = new Views.KataCompletedView();
                    kataCompletedView.SetMessage(feedback.Message);
                    kataCompletedView.ShowActivated = true;
                    kataCompletedView.Show();
                }
                else
                {
                    playerNotifier.DisplayMessage("Test State", feedback.Message, feedback.KataStateIcon, feedback.PlayerTestStateIcon);
                }
            }
            if (!string.IsNullOrEmpty(errorMessage))
            {
                playerNotifier.DisplayErrorMessage(errorMessage);
            }
        }
コード例 #2
0
        public void Handle(KataAttemptCreatedEvent message)
        {
            var newKataAttempt = message.KataAttempt;

            Katas.Add(newKataAttempt);
            SelectedKataAttempt = newKataAttempt;
            _playerNotifier.DisplayMessage(
                string.Format("Starting {0} Kata...", newKataAttempt.Config.KataName),
                GetInstruction(newKataAttempt));
        }
コード例 #3
0
        public void Start()
        {
            _playerNotifier.DisplayMessage("Welcome to Katarai",
                                           "Katarai is a tool to help you do code katas. In this version the supported katas are Roy Osherove’s String Calculator kata." +
                                           "To the katas, select Practice from the System Tray menu – Katarai will open Visual Studio with a prepared solution to get you started and will track your progress as you code." +
                                           Environment.NewLine + Environment.NewLine +
                                           "Why is TDD important? It allows us to break the negative feedback loop and maintain a constant cost of change." +
                                           "Only by actively driving down the defects in our code are we able to deliver new functionality, and modify existing functionality with a reasonably constant cost of change." +
                                           Environment.NewLine + Environment.NewLine +
                                           "To configure Katarai’s options click Show Window in the System Tray menu." + Environment.NewLine +
                                           Environment.NewLine +
                                           "To view your previous kata attempt statistics, use the Statistics menu in the System Tray menu."
                                           );

            _gameMonitor.StartMonitoring();
            _splunkLogger.Log(new MonitorEvent {
                Description = "Katarai Started", Logged = DateTime.Now
            });
            _kataFilesMonitor.Start();
            _reminderTimer.Start();
            _monitorTimer.Start();
        }