protected override void OnClick()
        {
            //string ISOvalveFeatureLayerName = ConfigUtil.GetConfigValue("TraceIsolation_Valve_FeatureLayer", "");
            //string ISOsourceFeatureLayerName = ConfigUtil.GetConfigValue("TraceIsolation_Source_FeatureLayer", "");

            //string ISOoperableFieldNameValves = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Valves", "");
            //string ISOoperableFieldNameSources = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Sources", "");
            //string[] ISOoperableValues = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Values", "").Split('|');

            //double SnapTol = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5);
            //if (GeoNetTools.ToggleOperableStatus(ArcMap.Application, null, false, ISOvalveFeatureLayerName, ISOsourceFeatureLayerName,
            //                                                ISOoperableFieldNameValves, ISOoperableFieldNameSources,
            //                                                ISOoperableValues, SnapTol) != null)
            //{
            //    gnTools.TraceNetwork(GeometricNetworkToolsFunc.TraceType.SecondaryIsolation);
            //}
            //else
            //{
            //    //  MessageBox.Show("Please select some valves to proceed");

            //}
            bool selectEdges = false;

            if (Control.ModifierKeys == Keys.Control)
            {
                selectEdges = true;
            }
            else
            {
                selectEdges = false;
            }
            bool   traceIndeterminate          = ConfigUtil.GetConfigValue("TraceFlow_Interminate", false);
            string ISOsourceFeatureLayerName   = ConfigUtil.GetConfigValue("TraceIsolation_Source_FeatureLayer", "");
            string ISOvalveFeatureLayerName    = ConfigUtil.GetConfigValue("TraceIsolation_Valve_FeatureLayer", "");
            string ISOoperableFieldNameValves  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Valves", "");
            string ISOoperableFieldNameSources = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Sources", "");

            string[] ISOoperableValues  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Values", "").Split('|');
            string   ISOvalveAddSQL     = ConfigUtil.GetConfigValue("TraceIsolation_Valve_AddSQL", "");
            double   SnapTol            = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0);
            string   ClearFlagBeforeIso = ConfigUtil.GetConfigValue("TraceIsolation_ClearFlagsOnClick", "true");



            if (GeoNetTools.ToggleOperableStatus(ArcMap.Application, null, false, ISOvalveFeatureLayerName, ISOsourceFeatureLayerName,
                                                 ISOoperableFieldNameValves, ISOoperableFieldNameSources,
                                                 ISOoperableValues, SnapTol) != null)
            {
                Globals.RemoveTraceGraphics(((IMxDocument)ArcMap.Application.Document).FocusMap, false);


                Globals.ClearSelected(ArcMap.Application, false);

                string returnVal = GeoNetTools.TraceIsolation(null, null, ArcMap.Application, ISOsourceFeatureLayerName, ISOvalveFeatureLayerName, ISOoperableFieldNameValves, ISOoperableFieldNameSources, SnapTol, true, ISOoperableValues, ISOvalveAddSQL, traceIndeterminate, true, selectEdges, "", "", "");
            }
            else
            {
                //  MessageBox.Show("Please select some valves to proceed");
            }
        }
        protected override void OnClick()
        {
            bool selectEdges = false;

            if (Control.ModifierKeys == Keys.Control)
            {
                selectEdges = true;
            }
            else
            {
                selectEdges = false;
            }
            bool   traceIndeterminate          = ConfigUtil.GetConfigValue("TraceFlow_Interminate", false);
            string ISOsourceFeatureLayerName   = ConfigUtil.GetConfigValue("TraceIsolation_Source_FeatureLayer", "");
            string ISOvalveFeatureLayerName    = ConfigUtil.GetConfigValue("TraceIsolation_Valve_FeatureLayer", "");
            string ISOoperableFieldNameValves  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Valves", "");
            string ISOoperableFieldNameSources = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Sources", "");

            string[] ISOoperableValues  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Values", "").Split('|');
            string   ISOvalveAddSQL     = ConfigUtil.GetConfigValue("TraceIsolation_Valve_AddSQL", "");
            double   SnapTol            = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0);
            string   ClearFlagBeforeIso = ConfigUtil.GetConfigValue("TraceIsolation_ClearFlagsOnClick", "true");

            Globals.RemoveTraceGraphics(((IMxDocument)ArcMap.Application.Document).FocusMap, false);

            Globals.ClearSelected(ArcMap.Application, false);



            //IPoint point = ArcMap.Document.CurrentLocation;
            string returnVal = GeoNetTools.TraceIsolation(null, null, ArcMap.Application, ISOsourceFeatureLayerName, ISOvalveFeatureLayerName, ISOoperableFieldNameValves, ISOoperableFieldNameSources, SnapTol, true, ISOoperableValues, ISOvalveAddSQL, traceIndeterminate, true, selectEdges, "", "", "");
        }
        protected override void OnMouseDown(MouseEventArgs arg)
        {
            bool selectEdges = false;

            if (Control.ModifierKeys == Keys.Control)
            {
                selectEdges = true;
            }
            else
            {
                selectEdges = false;
            }
            bool   traceIndeterminate          = ConfigUtil.GetConfigValue("TraceFlow_Interminate", false);
            string ISOsourceFeatureLayerName   = ConfigUtil.GetConfigValue("TraceIsolation_Source_FeatureLayer", "");
            string ISOvalveFeatureLayerName    = ConfigUtil.GetConfigValue("TraceIsolation_Valve_FeatureLayer", "");
            string ISOoperableFieldNameValves  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Valves", "");
            string ISOoperableFieldNameSources = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Sources", "");

            string[] ISOoperableValues  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Values", "").Split('|');
            string   ISOvalveAddSQL     = ConfigUtil.GetConfigValue("TraceIsolation_Valve_AddSQL", "");
            double   SnapTol            = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0);
            string   ClearFlagBeforeIso = ConfigUtil.GetConfigValue("TraceIsolation_ClearFlagsOnClick", "true");

            Globals.RemoveTraceGraphics(((IMxDocument)ArcMap.Application.Document).FocusMap, false);

            Globals.ClearSelected(ArcMap.Application, false);


            if (ClearFlagBeforeIso.ToUpper() == "TRUE")
            {
                Globals.ClearGNFlags(ArcMap.Application, Globals.GNTypes.Flags);
            }


            IPoint point     = ArcMap.Document.CurrentLocation;
            string returnVal = GeoNetTools.TraceIsolation(new double[] { point.X }, new double[] { point.Y }, ArcMap.Application, ISOsourceFeatureLayerName, ISOvalveFeatureLayerName, ISOoperableFieldNameValves, ISOoperableFieldNameSources, SnapTol, true, ISOoperableValues, ISOvalveAddSQL, traceIndeterminate, true, selectEdges, "", "", "");

            if (returnVal != null)
            {
                string[] retVals = returnVal.Split('_');

                switch (retVals.Length)
                {
                case 1:
                    MessageBox.Show(retVals[0]);
                    break;

                case 2:
                    MessageBox.Show(retVals[1]);
                    break;

                case 3:
                    break;

                default:
                    break;
                }
            }
            point = null;
        }
        protected override void OnClick()
        {
            ConfigUtil.type = "water";
            string selectFeatures = ConfigUtil.GetConfigValue("Trace_Return_Selection", "false");
            bool   selectEdges;

            if (selectFeatures.ToUpper() == "true".ToUpper() && Control.ModifierKeys == Keys.Control)
            {
                selectEdges = false;
            }
            else if (selectFeatures.ToUpper() == "true".ToUpper())
            {
                selectEdges = true;
            }
            else if (selectFeatures.ToUpper() == "false".ToUpper() && Control.ModifierKeys == Keys.Control)
            {
                selectEdges = true;
            }
            else
            {
                selectEdges = false;
            }

            bool   traceIndeterminate          = ConfigUtil.GetConfigValue("TraceFlow_Interminate", false);
            string ISOsourceFeatureLayerName   = ConfigUtil.GetConfigValue("TraceIsolation_Source_FeatureLayer", "");
            string ISOvalveFeatureLayerName    = ConfigUtil.GetConfigValue("TraceIsolation_Valve_FeatureLayer", "");
            string ISOoperableFieldNameValves  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Valves", "");
            string ISOoperableFieldNameSources = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Sources", "");

            string[] ISOoperableValues  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Values", "").Split('|');
            string   ISOvalveAddSQL     = ConfigUtil.GetConfigValue("TraceIsolation_Valve_AddSQL", "");
            double   SnapTol            = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0);
            string   ClearFlagBeforeIso = ConfigUtil.GetConfigValue("TraceIsolation_ClearFlagsOnClick", "true");
            string   closedValveQuery   = ConfigUtil.GetConfigValue("TraceIsolation_Valve_ClosedValveQuery", "");

            Globals.RemoveTraceGraphics(((IMxDocument)ArcMap.Application.Document).FocusMap, false);

            Globals.ClearSelected(ArcMap.Application, false);



            IPolyline  mergedLines;
            List <int> procoids;
            //IPoint point = ArcMap.Document.CurrentLocation;
            bool addFlagBarScreen = ConfigUtil.GetConfigValue("TraceIsolation_AddResultsAsLayers", "false").ToLower() == "false" ? false : true;

            string returnVal = GeoNetTools.TraceIsolation(null, null, ArcMap.Application, ISOsourceFeatureLayerName, ISOvalveFeatureLayerName, ISOoperableFieldNameValves, ISOoperableFieldNameSources, SnapTol, true,
                                                          ISOoperableValues, ISOvalveAddSQL, traceIndeterminate, true, selectEdges, "", "", "", closedValveQuery, null, out mergedLines, out procoids, addFlagBarScreen);
        }
        protected override void OnClick()
        {
            ConfigUtil.type = "water";
            //string ISOvalveFeatureLayerName = ConfigUtil.GetConfigValue("TraceIsolation_Valve_FeatureLayer", "");
            //string ISOsourceFeatureLayerName = ConfigUtil.GetConfigValue("TraceIsolation_Source_FeatureLayer", "");

            //string ISOoperableFieldNameValves = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Valves", "");
            //string ISOoperableFieldNameSources = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Sources", "");
            //string[] ISOoperableValues = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Values", "").Split('|');

            //double SnapTol = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5);
            //if (GeoNetTools.ToggleOperableStatus(ArcMap.Application, null, false, ISOvalveFeatureLayerName, ISOsourceFeatureLayerName,
            //                                                ISOoperableFieldNameValves, ISOoperableFieldNameSources,
            //                                                ISOoperableValues, SnapTol) != null)
            //{
            //    gnTools.TraceNetwork(GeometricNetworkToolsFunc.TraceType.SecondaryIsolation);
            //}
            //else
            //{
            //    //  MessageBox.Show("Please select some valves to proceed");

            //}
            string selectFeatures = ConfigUtil.GetConfigValue("Trace_Return_Selection", "false");
            bool   selectEdges;

            if (selectFeatures.ToUpper() == "true".ToUpper() && Control.ModifierKeys == Keys.Control)
            {
                selectEdges = false;
            }
            else if (selectFeatures.ToUpper() == "true".ToUpper())
            {
                selectEdges = true;
            }
            else if (selectFeatures.ToUpper() == "false".ToUpper() && Control.ModifierKeys == Keys.Control)
            {
                selectEdges = true;
            }
            else
            {
                selectEdges = false;
            }

            bool   traceIndeterminate          = ConfigUtil.GetConfigValue("TraceFlow_Interminate", false);
            string ISOsourceFeatureLayerName   = ConfigUtil.GetConfigValue("TraceIsolation_Source_FeatureLayer", "");
            string ISOvalveFeatureLayerName    = ConfigUtil.GetConfigValue("TraceIsolation_Valve_FeatureLayer", "");
            string ISOoperableFieldNameValves  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Valves", "");
            string ISOoperableFieldNameSources = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Sources", "");

            string[] ISOoperableValues  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Values", "").Split('|');
            string   ISOvalveAddSQL     = ConfigUtil.GetConfigValue("TraceIsolation_Valve_AddSQL", "");
            double   SnapTol            = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0);
            string   ClearFlagBeforeIso = ConfigUtil.GetConfigValue("TraceIsolation_ClearFlagsOnClick", "true");

            string closedValveQuery = ConfigUtil.GetConfigValue("TraceIsolation_Valve_ClosedValveQuery", "");


            if (GeoNetTools.ToggleOperableStatus(ArcMap.Application, null, false, ISOvalveFeatureLayerName, ISOsourceFeatureLayerName,
                                                 ISOoperableFieldNameValves, ISOoperableFieldNameSources,
                                                 ISOoperableValues, SnapTol) != null)
            {
                Globals.RemoveTraceGraphics(((IMxDocument)ArcMap.Application.Document).FocusMap, false);


                Globals.ClearSelected(ArcMap.Application, false);


                IPolyline  mergedLines;
                List <int> procoids;
                bool       addFlagBarScreen = ConfigUtil.GetConfigValue("TraceIsolation_AddResultsAsLayers", "false").ToLower() == "false" ? false : true;

                string returnVal = GeoNetTools.TraceIsolation(null, null, ArcMap.Application, ISOsourceFeatureLayerName, ISOvalveFeatureLayerName, ISOoperableFieldNameValves, ISOoperableFieldNameSources, SnapTol, true,
                                                              ISOoperableValues, ISOvalveAddSQL, traceIndeterminate, true, selectEdges, "", "", "", closedValveQuery, null, out mergedLines, out procoids, addFlagBarScreen);
            }
            else
            {
                //  MessageBox.Show("Please select some valves to proceed");
            }
        }
        protected override void OnMouseDown(MouseEventArgs arg)
        {
            ConfigUtil.type = "water";
            string selectFeatures = ConfigUtil.GetConfigValue("Trace_Return_Selection", "false");
            bool   selectEdges;

            if (selectFeatures.ToUpper() == "true".ToUpper() && Control.ModifierKeys == Keys.Control)
            {
                selectEdges = false;
            }
            else if (selectFeatures.ToUpper() == "true".ToUpper())
            {
                selectEdges = true;
            }
            else if (selectFeatures.ToUpper() == "false".ToUpper() && Control.ModifierKeys == Keys.Control)
            {
                selectEdges = true;
            }
            else
            {
                selectEdges = false;
            }

            bool   traceIndeterminate          = ConfigUtil.GetConfigValue("TraceFlow_Interminate", false);
            string ISOsourceFeatureLayerName   = ConfigUtil.GetConfigValue("TraceIsolation_Source_FeatureLayer", "");
            string ISOvalveFeatureLayerName    = ConfigUtil.GetConfigValue("TraceIsolation_Valve_FeatureLayer", "");
            string ISOoperableFieldNameValves  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Valves", "");
            string ISOoperableFieldNameSources = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Field_Sources", "");

            string[] ISOoperableValues  = ConfigUtil.GetConfigValue("TraceIsolation_Operable_Values", "").Split('|');
            string   ISOvalveAddSQL     = ConfigUtil.GetConfigValue("TraceIsolation_Valve_AddSQL", "");
            double   SnapTol            = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0);
            string   ClearFlagBeforeIso = ConfigUtil.GetConfigValue("TraceIsolation_ClearFlagsOnClick", "true");

            string closedValveQuery = ConfigUtil.GetConfigValue("TraceIsolation_Valve_ClosedValveQuery", "");

            Globals.RemoveTraceGraphics(((IMxDocument)ArcMap.Application.Document).FocusMap, false);

            Globals.ClearSelected(ArcMap.Application, false);


            if (ClearFlagBeforeIso.ToUpper() == "TRUE")
            {
                Globals.ClearGNFlags(ArcMap.Application, Globals.GNTypes.Flags);
            }


            IPoint point = ArcMap.Document.CurrentLocation;

            IPolyline  mergedLines;
            List <int> procoids;
            bool       addFlagBarScreen = ConfigUtil.GetConfigValue("TraceIsolation_AddResultsAsLayers", "false").ToLower() == "false" ? false : true;

            string returnVal = GeoNetTools.TraceIsolation(new double[] { point.X }, new double[] { point.Y }, ArcMap.Application, ISOsourceFeatureLayerName, ISOvalveFeatureLayerName, ISOoperableFieldNameValves, ISOoperableFieldNameSources,
                                                          SnapTol, true, ISOoperableValues, ISOvalveAddSQL, traceIndeterminate, true, selectEdges, "", "", "", closedValveQuery, null, out mergedLines, out procoids, addFlagBarScreen);

            if (returnVal != null)
            {
                string[] retVals = returnVal.Split('_');

                switch (retVals.Length)
                {
                case 1:
                    MessageBox.Show(retVals[0]);
                    break;

                case 2:
                    MessageBox.Show(retVals[1]);
                    break;

                case 3:
                    break;

                default:
                    break;
                }
            }
            point = null;
            ISelectionEvents selEvents = null;

            selEvents = (ISelectionEvents)((ArcMap.Document as IMxDocument).FocusMap);

            if (selEvents != null)
            {
                selEvents.SelectionChanged();
            }
        }