コード例 #1
0
        public void CalculateRunTime()
        {
            _calculator = new Calculator.Calculator();

            var distance = new Distance(SelectedKilometer.Title, SelectedMeter.Title, SelectedCentimeter.Title);
            var date = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, SelectedHour.Title,
                                    SelectedMinute.Title, SelectedSecond.Title);

            var kmh = _calculator.CalculateKilometersPerHour(distance, date);
            var minKm = _calculator.CalculateMinutePerKilometer(kmh);
            if (kmh.Value <= 0.0 || minKm.Minutes <= 0) return;

            // Navigate to result page --- publish result message
            _navigationService.NavigateToViewModel<ResultItemDetailViewModel>();
            _eventAggregator.Publish(new ResultMessage {Distance = distance, Date = date, KilometerPerHour = kmh, MinutePerKilometer = minKm});
        }