/// <summary> /// Set the cancel flag if there is an error in this text box to ensure that the issue is addressed immedialtely /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void TextBox_Validating(object sender, CancelEventArgs e) { TextBox textBox = (TextBox)sender; if ((textBox.Name == txtStartAzimuth.Name) & (ErrorFlag.GetError(txtStartAzimuth) != "")) { e.Cancel = true; } else if ((textBox.Name == txtStartAltitude.Name) & (ErrorFlag.GetError(txtStartAltitude) != "")) { e.Cancel = true; } else if ((textBox.Name == txtParkAzimuth.Name) & (ErrorFlag.GetError(txtParkAzimuth) != "")) { e.Cancel = true; } else if ((textBox.Name == txtParkAltitude.Name) & (ErrorFlag.GetError(txtParkAltitude) != "")) { e.Cancel = true; } else if ((textBox.Name == TxtHomeAzimuth.Name) & (ErrorFlag.GetError(TxtHomeAzimuth) != "")) { e.Cancel = true; } else if ((textBox.Name == TxtHomeAltitude.Name) & (ErrorFlag.GetError(TxtHomeAltitude) != "")) { e.Cancel = true; } }
public void Should_BeFalse_WhenEnabled(int level) { var errorFlag = new ErrorFlag(); errorFlag.SetEnabled(level, 1); errorFlag.IsDetectedAtAnylevel.Should().BeFalse(); }
public void Should_BeTrueIfEnabled(int level) { var errorFlag = new ErrorFlag(); errorFlag.SetEnabled(level, 1); errorFlag.IsEnabledAtAnyLevel.Should().BeTrue(); }
public void Should_ReturnFalse_When_LevelNotEnabledAndNotDetected() { var errorFlag = new ErrorFlag(); var tryResult = errorFlag.LeaveLevelAndTryGetError(10, out var errorOnLeaving); errorOnLeaving.Should().Be(-1); tryResult.Should().BeFalse(); }
public void Should_BeFalse_IfDetected_OnLowerLevel(int level) { var errorFlag = new ErrorFlag(); errorFlag.SetEnabled(level, 1); errorFlag.SetDetected(level - 1); errorFlag.IsDetectedAtAnylevel.Should().BeFalse(); }
public void Should_BeTrue_IfDetected_OnHigherLevel(int level) { var errorFlag = new ErrorFlag(); errorFlag.SetEnabled(level, 1); errorFlag.SetDetected(level + 1); errorFlag.IsDetectedAtAnylevel.Should().BeTrue(); }
public void Should_BeFalse_AfterLeavingLevel() { var errorFlag = new ErrorFlag(); errorFlag.SetEnabled(10, 1); errorFlag.LeaveLevelAndTryGetError(10, out _); errorFlag.IsEnabledAtAnyLevel.Should().BeFalse(); }
public void Should_BeTrueIfEnabled_MultipleTimes() { var errorFlag = new ErrorFlag(); errorFlag.SetEnabled(1, 1); errorFlag.SetEnabled(10, 1); errorFlag.SetEnabled(666, 1); errorFlag.IsEnabledAtAnyLevel.Should().BeTrue(); }
public OperationLog(string menuID, string userID, LogEvent logEvent, string fieldName, string fieldValue, ErrorFlag errorFlag, string errorMsgID, DateTime operationDateTime) { _menuID = menuID; _userID = userID; _event = logEvent; _fieldName = fieldName; _fieldValue = fieldValue; _errorFlag = errorFlag; _errorMsgID = errorMsgID; _operationDateTime = operationDateTime; }
public void Should_ReturnTrue_And_SameErrorIdWhenEnabled_When_LevelEnabledAndDetected(int level, int errorId) { var errorFlag = new ErrorFlag(); errorFlag.SetEnabled(level, errorId); errorFlag.SetDetected(level); var tryResult = errorFlag.LeaveLevelAndTryGetError(level, out var errorOnLeaving); errorOnLeaving.Should().Be(errorId); tryResult.Should().BeTrue(); }
public bool Equals(ErrorFlag other) { if (ReferenceEquals(this, other)) { return(true); } if (ReferenceEquals(null, other)) { return(false); } return(value == other.value); }
/// <summary> /// Validate the textbox contents to ensure that it is a valid double number, Called every time a the text changes so that issues are flagged immediately /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Textbox_TextChanged(object sender, EventArgs e) { TextBox textBox = (TextBox)sender; try { double x = double.Parse(textBox.Text); ErrorFlag.SetError(textBox, ""); BtnOK.Enabled = true; } catch { ErrorFlag.SetError(textBox, "Not a valid number."); BtnOK.Enabled = false; } }
public void Should_ReturnTrue_And_FirstErrorIdWhenEnabled_When_LevelEnabledAndDetected_SameLevelMultipleTimes() { var errorFlag = new ErrorFlag(); errorFlag.SetEnabled(10, 1); errorFlag.SetEnabled(10, 2); errorFlag.SetEnabled(10, 3); errorFlag.SetDetected(10); errorFlag.SetDetected(10); errorFlag.SetDetected(10); var tryResult = errorFlag.LeaveLevelAndTryGetError(10, out var errorOnLeaving); errorOnLeaving.Should().Be(1); tryResult.Should().BeTrue(); }
public void Should_BeFalse_AfterLeavingLevel_MultipleTimes() { var errorFlag = new ErrorFlag(); errorFlag.SetEnabled(1, 1); errorFlag.SetEnabled(10, 1); errorFlag.SetEnabled(666, 1); errorFlag.IsEnabledAtAnyLevel.Should().BeTrue(); errorFlag.LeaveLevelAndTryGetError(1, out _); errorFlag.IsEnabledAtAnyLevel.Should().BeTrue(); errorFlag.LeaveLevelAndTryGetError(10, out _); errorFlag.IsEnabledAtAnyLevel.Should().BeTrue(); errorFlag.LeaveLevelAndTryGetError(666, out _); errorFlag.IsEnabledAtAnyLevel.Should().BeFalse(); }
public void Should_BeFalseByDefault() { var errorFlag = new ErrorFlag(); errorFlag.IsEnabledAtAnyLevel.Should().BeFalse(); }
/// <summary> /// Clear reported error(s). /// See http://www.neatorobotics.com/programmers-manual/table-of-robot-application-commands/detailed-command-descriptions/#GetErr for more info. /// </summary> /// <param name="flag">Use Clear state dismiss the reported error.</param> public void GetErr(ErrorFlag flag) { // TODO: Review and decide if useful or need to rewrite. this.neato.Connection.SendCommand("GetErr " + flag); }
public void Should_Initialize() { _ = new ErrorFlag(); }
public void Should_Initialize_WithCapacity() { _ = new ErrorFlag(10); }
public void Should_BeFalseByDefault() { var errorFlag = new ErrorFlag(); errorFlag.IsDetectedAtAnylevel.Should().BeFalse(); }
// LelliD spint is now fully zero based private static void spint(int n, double[] x, // Original 1..N , now 0..N-1 out double avh, double[] y, // Original 1..N, now 0..N-1 double[] dy, // Original 1..N, now 0..N-1 out double avdy, double[] a, double[] c1, // Original 1..IC, now 0..N+1 double[] c2, // Original 1..IC, now 0..N+1 double[] c3, // Original 1..IC, now 0..N+1 double[] r, // Original 0..N+1, 3 , now length=3*(N+2) double[] t, // Original 0..N+1, 2, now zero based with length=3*(N+2) out ErrorFlag error_flag) { int i, r_dim1, t_dim1; double e, f, g, h; // Initializes the arrays c1,c2,c3,r and t for one dimensional cubic // smoothing spline fitting by subroutine spfit. The values // df[i] are scaled so that the sum of their squares is n // and the average of the differences x[i+1]-x[i] is calculated // in avh in order to avoid underflow and overflow problems in // spfit. Subroutine sets error_flag if elements of x are non-increasing, // if n is less than 3 or if dy[i] is not positive for some i. // Parameter adjustments t_dim1 = n + 2; r_dim1 = n + 2; // initialization and input checking error_flag = ErrorFlag.no_error; if (n < 3) { avh = avdy = 0; error_flag = ErrorFlag.too_few_datapoints; return; } // get average x spacing in avh g = zero; for (i = 1; i < n; ++i) { h = x[i] - x[i - 1]; // check if abscissae are not increasing if (h <= zero) { avh = avdy = 0; error_flag = ErrorFlag.abscissa_not_ordered; return; } g += h; } avh = g / (n - 1); // average spacing // scale relative weights g = zero; for (i = 0; i < n; ++i) // LelliD modified { // check for non positive df if (dy[i] <= zero) { avdy = 0; error_flag = ErrorFlag.stddev_non_positive; return; } g += dy[i] * dy[i]; } avdy = Math.Sqrt(g / n); for (i = 0; i < n; ++i) // Lellid modified dy[i] /= avdy; // initialize h,f h = (x[1] - x[0]) / avh; // LelliD f = (y[1] - y[0]) / h; // LelliD // calculate a,t,r for (i = 2; i < n; ++i) { g = h; h = (x[i] - x[i - 1]) / avh; // LelliD e = f; f = (y[i] - y[i - 1]) / h; // LelliD a[i - 1] = f - e; // LelliD t[i] = (g + h) * 2.0 / 3.0; // LelliD t[i + t_dim1] = h / 3.0; // LelliD r[i + r_dim1 * 2] = dy[i - 2] / g; // LelliD r[i] = dy[i] / h; // LelliD r[i + r_dim1] = -dy[i - 1] / g - dy[i - 1] / h; // LelliD } // calculate c = r'*r r[n + r_dim1] = 0;// LelliD r[n + r_dim1 * 2] = 0; // LelliD r[n + 1 + r_dim1 * 2] = 0; // LelliD for (i = 2; i < n; ++i) { c1[i - 1] = r[i] * r[i] + r[i + r_dim1] * // LelliD r[i + r_dim1] + r[i + r_dim1 * 2] * r[i + r_dim1 * 2]; // lelliD c2[i - 1] = r[i] * r[i + 1 + r_dim1] + r[i + r_dim1] * r[i + 1 + r_dim1 * 2]; // LelliD c3[i - 1] = r[i] * r[i + 2 + r_dim1 * 2]; // LelliD } }
/// <summary> /// Clear reported error(s). /// See http://www.neatorobotics.com/programmers-manual/table-of-robot-application-commands/detailed-command-descriptions/#GetErr for more info. /// </summary> /// <param name="flag">Use Clear state dismiss the reported error.</param> public void GetErr(ErrorFlag flag) { // TODO: Review and decide if useful or need to rewrite. this.neato.Connection.SendCommand("GetErr " + flag); }