void SetZeroValues() { m_Focus = null; m_FromPointed = false; m_ToPointed = false; m_Items = null; m_PathData = null; m_DrawPath = false; m_Adjustment = null; m_Units = null; }
private void cancelButton_Click(object sender, EventArgs e) { // If we are showing adjustment results, get rid of them if (m_Adjustment != null) { m_Adjustment.Dispose(); m_Adjustment = null; } // Tell the command that's running this dialog that we're done if (m_Command != null) { m_Command.DialAbort(this); } }
/* * /// <summary> * /// Adjusts a validated path. * /// </summary> * void Adjust() * { * // Confirm that the from-point & to-point are both defined (this * // should have been checked beforehand). * if (m_From==null || m_To==null) * { * MessageBox.Show("Terminal points have not been defined"); * return; * } * * // Get rid of any path previously created. * m_PathData = null; * * try * { * // Create new path data * Leg[] legs = PathParser.CreateLegs(m_Items); * m_PathData = new PathInfo(m_From, m_To, legs); * * // Adjust the path * * double de; // Misclosure in eastings * double dn; // Misclosure in northings * double prec; // Precision * double length; // Total observed length * double rotation; // Rotation for adjustment * double sfac; // Adjustment scaling factor * * m_PathData.Adjust(out dn, out de, out prec, out length, out rotation, out sfac); * * // Draw the path with the adjustment info * m_DrawPath = true; * m_PathData.Render(m_Command.ActiveDisplay); * * // Display the numeric results. * m_Adjustment = new AdjustmentForm(dn, de, prec, length, this); * m_Adjustment.Show(); * * // Disable the preview button (it will be re-enabled when * // the adjustment dialog is destroyed). * previewButton.Enabled = false; * } * * catch (Exception ex) * { * MessageBox.Show(ex.Message); * return; * } * } */ /// <summary> /// Takes action when the adjustment result dialog has been cancelled (user /// has clicked the "Reject" button). At the time of call, the dialog /// is already closed, though a reference to the instance is still /// held by this class. /// </summary> internal void OnDestroyAdj() { // Remember not to draw the path. m_DrawPath = false; // Get rid of the dialog object. if (m_Adjustment != null) { m_Adjustment.Dispose(); m_Adjustment = null; } // Re-enable the Preview button. previewButton.Enabled = true; // Ensure any preview stuff gets erased m_Command.ErasePainting(); }
private void pathTextBox_TextChanged(object sender, EventArgs e) { // Cancel any previous auto-preview previewTimer.Stop(); // If we previously had an adjustment dialog, cancel it. // This should also end up calling this->OnDestroyAdj if (m_Adjustment != null) { m_Adjustment.Dispose(); m_Adjustment = null; } // Ignore any path data that remains. m_PathData = null; // The preview button should be enabled only if there is // something defined for the path. CheckPreview(); //if (autoPreviewCheckBox.Checked) previewTimer.Start(); }