public void CalculateScore() { try { _jumpLength = double.Parse(jumpLength.Text); _criticalPoint = double.Parse(criticalPoint.Text); _levelCompensation = double.Parse(levelCompensation.Text); _platformChange = double.Parse(levelChange.Text); _windChance1 = double.Parse(windCheck1.Text); _windChance2 = double.Parse(windCheck2.Text); _windChance3 = double.Parse(windCheck3.Text); _windChance4 = double.Parse(windCheck4.Text); _windChance5 = double.Parse(windCheck5.Text); _stylePoints1 = double.Parse(stylePoints1.Text); _stylePoints2 = double.Parse(stylePoints2.Text); _stylePoints3 = double.Parse(stylePoints3.Text); _stylePoints4 = double.Parse(stylePoints4.Text); _stylePoints5 = double.Parse(stylePoints5.Text); if (nameComboBox.SelectedIndex == -1 || _jumpLength == 0 || _criticalPoint == 0 || _levelCompensation == 0) { MessageBox.Show("Please, fill in all jump specs!"); } else { _windCompensation = countWindEffect(_criticalPoint, _windChance1, _windChance2, _windChance3, _windChance4, _windChance5); _jumpScore = countLengthScore(_jumpLength, _criticalPoint, _windCompensation); _stylePoints = countStylePoints(_stylePoints1, _stylePoints2, _stylePoints3, _stylePoints4, _stylePoints5); _platformCompensation = countPlatformCompensation(_criticalPoint, _platformChange, _levelCompensation); _score = _windCompensation + _jumpScore + _stylePoints + _platformCompensation; if (_error != true) { var thisJumper = JumperList.FirstOrDefault(x => x.Number == _number); var scoreExist = ResultList.FirstOrDefault(x => x.Number == _number); if (scoreExist != null) { double total = scoreExist.Score; scoreExist.Score = _score + total; JumperList.Remove(thisJumper); } else { ResultList.Add(new Result(_number, thisJumper.Name, thisJumper.Country, _score)); } } } } catch (Exception e) { MessageBox.Show(e.Message); } }
private void BindItem() { ResultItem = ResultList.FirstOrDefault(i => i.PassengerId == PassengerId.Value); if (ResultItem != null) { var dataPrediction = new ModelInput { PassengerId = ResultItem.PassengerId, Survived = ResultItem.ActualSurvived, Pclass = ResultItem.Pclass, Name = ResultItem.Name, Sex = ResultItem.Sex, Age = ResultItem.Age.GetValueOrDefault(), SibSp = ResultItem.SibSp, Parch = ResultItem.Parch, Ticket = ResultItem.Ticket, Fare = ResultItem.Fare.GetValueOrDefault(), Cabin = ResultItem.Cabin, Embarked = ResultItem.Embarked }; ResultItem.PredictedSurvived = ConsumeModel.Predict(dataPrediction, _env.ContentRootPath).Prediction; } }