| | |
| | | |
| | | if (!decimal.TryParse(nudOilDensity.Value.ToString(), out decimal oilDensity) || nudOilDensity.Value <= 0) |
| | | { |
| | | MessageBox.Show("Please select a oil density"); |
| | | MessageBox.Show("Please enter a oil density"); |
| | | return; |
| | | } |
| | | |
| | |
| | | |
| | | if (cmbTargetLoggingIntervalUnit.Text == "ft") |
| | | targetLoggingInterval = UnitConvert.Ft2M(targetLoggingInterval); |
| | | |
| | | txtAnalysisResult.Clear(); |
| | | if (rdoLockSpeed.Checked) |
| | | { |
| | | if (!double.TryParse(nudSpeed.Value.ToString(), out double speed) || nudSpeed.Value <= 0) |
| | |
| | | |
| | | double totalTime = Math.Round((targetLoggingInterval / calcSpeed / 60), 2); |
| | | var errorRate = Math.Round(result.ErrorRatios.Min(r => r.ErrorRatioValue) * 100, 2); |
| | | txtAnalysisResult.Text = $"A total of {result.ErrorRatios.Count} passes are recommended to maintain a {errorRate}% error rate. With the tool operating at {speed} {cmbSpeedUnit.Text}, the estimated total job duration is {totalTime.ToString()} hours."; |
| | | txtAnalysisResult.AppendText("A total of "); |
| | | AppendText(txtAnalysisResult, result.ErrorRatios.Count.ToString(), ColorTranslator.FromHtml("#8B0000")); |
| | | txtAnalysisResult.AppendText(" passes are recommended to maintain a "); |
| | | AppendText(txtAnalysisResult, $"{errorRate}%", ColorTranslator.FromHtml("#8B0000")); |
| | | txtAnalysisResult.AppendText(" error rate. With the tool operating at "); |
| | | AppendText(txtAnalysisResult, $"{speed} {cmbSpeedUnit.Text}", ColorTranslator.FromHtml("#8B0000")); |
| | | txtAnalysisResult.AppendText(" the estimated total job duration is "); |
| | | AppendText(txtAnalysisResult, $"{totalTime} hours.", ColorTranslator.FromHtml("#8B0000")); |
| | | |
| | | _reportModel = CreateReportModel(totalTime.ToString(), result.ErrorRatios.Count.ToString(), Math.Round(UnitConvert.MMin2FtHr(calcSpeed), 2).ToString(), errorRate.ToString()); |
| | | } |
| | | else |
| | |
| | | var errorRate = Math.Round(result.ErrorRatios.Min(r => r.ErrorRatioValue) * 100, 2); |
| | | var speedFr = Math.Round(UnitConvert.MMin2FtHr(speed), 2); |
| | | |
| | | txtAnalysisResult.Text = $"A total of {result.ErrorRatios.Count} passes are recommended to maintain a {errorRate}% error rate. With the tool operating at {speedFr} ft/hr, the estimated total job duration is {totalTime.ToString()} hours."; |
| | | txtAnalysisResult.AppendText("A total of "); |
| | | AppendText(txtAnalysisResult, result.ErrorRatios.Count.ToString(), ColorTranslator.FromHtml("#8B0000")); |
| | | txtAnalysisResult.AppendText(" passes are recommended to maintain a "); |
| | | AppendText(txtAnalysisResult, $"{errorRate}%", ColorTranslator.FromHtml("#8B0000")); |
| | | txtAnalysisResult.AppendText(" error rate. With the tool operating at "); |
| | | AppendText(txtAnalysisResult, $"{speedFr} ft/hr", ColorTranslator.FromHtml("#8B0000")); |
| | | txtAnalysisResult.AppendText(" the estimated total job duration is "); |
| | | AppendText(txtAnalysisResult, $"{totalTime} hours.", ColorTranslator.FromHtml("#8B0000")); |
| | | |
| | | _reportModel = CreateReportModel(totalTime.ToString(), result.ErrorRatios.Count.ToString(), speedFr.ToString(), errorRate.ToString()); |
| | | } |
| | |
| | | }; |
| | | } |
| | | |
| | | private void AppendText(RichTextBox rtb, string text, Color color, Font font = null, bool isNewLine = false) |
| | | { |
| | | rtb.SuspendLayout(); |
| | | rtb.SelectionStart = rtb.TextLength; |
| | | rtb.SelectionLength = 0; |
| | | |
| | | rtb.SelectionColor = color; |
| | | if (font != null) |
| | | rtb.SelectionFont = font; |
| | | |
| | | rtb.AppendText(isNewLine ? $"{text}{Environment.NewLine}" : text); |
| | | rtb.SelectionColor = rtb.ForeColor; |
| | | rtb.ScrollToCaret(); |
| | | rtb.ResumeLayout(); |
| | | } |
| | | } |
| | | } |