private void btnTopologyResult_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (currentTopologyTestCase is LinesMustBeLargerThanClusterToleranceTopologyTestCase)
                {
                    ToleranceForm form = new ToleranceForm();
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        ((LinesMustBeLargerThanClusterToleranceTopologyTestCase)currentTopologyTestCase).Tolerance = form.Tolerance;
                    }
                    else
                    {
                        return;
                    }
                }
                else if (currentTopologyTestCase is PolygonsMustBeLargerThanClusterToleranceTopologyTestCase)
                {
                    ToleranceForm form = new ToleranceForm();
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        ((PolygonsMustBeLargerThanClusterToleranceTopologyTestCase)currentTopologyTestCase).Tolerance = form.Tolerance;
                    }
                    else
                    {
                        return;
                    }
                }
                currentTopologyTestCase.GenerateTestResult();
                winformsMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.Clear();
                currentTopologyTestCase.Draw(winformsMap1);

                string wkt = currentTopologyTestCase.GetOutputInString();
                if (string.IsNullOrEmpty(wkt))
                {
                    MessageBox.Show(string.Format("No result returned and no WKT is exported."));
                }
                else
                {
                    Clipboard.SetDataObject(wkt);
                    MessageBox.Show(string.Format("The WKT of {0} return records has been copied to Clipboard", currentTopologyTestCase.OutputFeatureLayer.InternalFeatures.Count), "Note");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void lbTestCases_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listboxNames.SelectedValue != null && listboxNames.SelectedValue.ToString() != typeof(System.Data.DataRowView).ToString())
            {
                fromEvent = true;
                txtCaseDescription.Text = loadedTopologyTestCases[listboxNames.SelectedIndex].Description;
                ClearAll();

                TopologyTestCase testCase = loadedTopologyTestCases[listboxNames.SelectedIndex];
                winformsMap1.CurrentExtent = testCase.GetBoundingBox();
                winformsMap1.CurrentExtent.ScaleUp(30);
                string typeName = testCase.GetType().Name.Replace("TopologyTestCase", "");

                int count = 0;
                foreach (var item in cmbTopologyRules.Items)
                {
                    if (item.ToString() == typeName)
                    {
                        break;
                    }
                    count++;
                }
                cmbTopologyRules.SelectedIndex = count;

                testCase.Draw(winformsMap1);
                currentTopologyTestCase = testCase.Clone();
            }
        }