protected override void OnMouseDown(MouseEventArgs arg)
        {
            IPoint point = ArcMap.Document.CurrentLocation;

            //GeoNetTools.CalculateFlowAccumAtLocation(ConfigUtil.GetFlowAccumConfig(), ArcMap.Application, Convert.ToDouble(ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5)));
            string test = GeoNetTools.TraceFindClosest(new double[] { point.X }, new double[] { point.Y }, ArcMap.Application, "wHydrant", "Length", 45, true, true);
        }
        protected override void OnMouseDown(MouseEventArgs arg)
        {
            ConfigUtil.type = "gas";
            List <MoveConnectionsDetails> moveConnectionsConfig = ConfigUtil.GetMoveConnectionsConfig();

            GeoNetTools.MoveConnectionsToNewLine(ArcMap.Application, ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0), moveConnectionsConfig);
        }
        protected override void OnMouseDown(MouseEventArgs arg)
        {
            ConfigUtil.type = "water";
            double SnapTol            = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0);
            bool   traceIndeterminate = ConfigUtil.GetConfigValue("TraceFlow_Interminate", false);
            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;
            }

            IPoint point = ArcMap.Document.CurrentLocation;

            GeoNetTools.TraceFlow(ref point, ArcMap.Application, esriFlowMethod.esriFMUpstream, SnapTol, traceIndeterminate, selectEdges);


            point = null;
        }
        protected override void OnMouseDown(MouseEventArgs arg)
        {
            // IPoint point = ArcMap.Document.CurrentLocation;//ArcMap.Document.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
            GeoNetTools.RemoveFlagBarrier(ArcMap.Document.CurrentLocation, ArcMap.Application, ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0));

            base.OnMouseDown(arg);
        }
        protected override void OnMouseDown(MouseEventArgs arg)
        {
            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.0);

            IPoint    point = ArcMap.Document.CurrentLocation;//ArcMap.Document.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
            IEnvelope env   = GeoNetTools.ToggleOperableStatus(ArcMap.Application, point, true,
                                                               ISOvalveFeatureLayerName, ISOsourceFeatureLayerName,
                                                               ISOoperableFieldNameValves, ISOoperableFieldNameSources,
                                                               ISOoperableValues, SnapTol);

            if (env != null)
            {
                ArcMap.Document.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, env);
            }
            base.OnMouseDown(arg);
            point = null;
            env   = null;
        }
        protected override void OnClick()
        {
            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 TraceSum_LayerName               = ConfigUtil.GetConfigValue("TraceIsolationSummary_LayerName", "");
            string TraceSum_FacilityIDField         = ConfigUtil.GetConfigValue("TraceIsolationSummary_FacilityIDField", "");
            string TraceSum_DateFieldName           = ConfigUtil.GetConfigValue("TraceIsolationSummary_DateFieldName", "");
            string TraceSum_ValveCountFieldName     = ConfigUtil.GetConfigValue("TraceIsolationSummary_ValveCountFieldName", "");
            string TraceSum_MeterCountFieldName     = ConfigUtil.GetConfigValue("TraceIsolationSummary_MeterCountFieldName", "");
            string TraceSum_CritMeterCountFieldName = ConfigUtil.GetConfigValue("TraceIsolationSummary_CritMeterCountFieldName", "");
            string TraceSum_CommentsFieldName       = ConfigUtil.GetConfigValue("TraceIsolationSummary_CommentsFieldName", "");
            string TraceSum_MainsFeatureLayerName   = ConfigUtil.GetConfigValue("TraceIsolationSummary_Main_FeatureLayer", "");
            string TraceSum_MeterFeatureLayerName   = ConfigUtil.GetConfigValue("TraceIsolationSummary_Meter_FeatureLayer", "");
            string TraceSum_MeterCritFieldName      = ConfigUtil.GetConfigValue("TraceIsolationSummary_Meter_Critical_Field", "");
            string TraceSum_MeterCritValue          = ConfigUtil.GetConfigValue("TraceIsolationSummary_Meter_Critical_Value", "");



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

            Globals.ClearGNFlags(ArcMap.Application, Globals.GNTypes.Flags);

            GeoNetTools.TraceIsolationSummary(ArcMap.Application, ISOsourceFeatureLayerName, ISOvalveFeatureLayerName, ISOoperableFieldNameValves, ISOoperableFieldNameSources, SnapTol,
                                              false, ISOoperableValues, ISOvalveAddSQL, traceIndeterminate, true, TraceSum_MainsFeatureLayerName, TraceSum_MeterFeatureLayerName, TraceSum_MeterCritFieldName, TraceSum_MeterCritValue,
                                              TraceSum_LayerName, TraceSum_FacilityIDField, TraceSum_DateFieldName, TraceSum_ValveCountFieldName, TraceSum_MeterCountFieldName, TraceSum_CritMeterCountFieldName, TraceSum_CommentsFieldName);
        }
        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 OnMouseDown(MouseEventArgs arg)
        {
            double SnapTol = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0);
            List <ProfileGraphDetails> ProfileGraph = ConfigUtil.GetProfileGraphConfig();

            GeoNetTools.AddFlagsForSewerProfile(ArcMap.Application, SnapTol, ProfileGraph);
            ProfileGraph = 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 OnMouseDown(MouseEventArgs arg)
        {
            double SnapTol            = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0);
            bool   traceIndeterminate = ConfigUtil.GetConfigValue("TraceFlow_Interminate", false);
            bool   selectEdges        = false;

            if (Control.ModifierKeys == Keys.Control)
            {
                selectEdges = true;
            }
            else
            {
                selectEdges = false;
            }
            IPoint point = ArcMap.Document.CurrentLocation;

            GeoNetTools.TraceFlow(ref point, ArcMap.Application, esriFlowMethod.esriFMUpstream, SnapTol, traceIndeterminate, selectEdges);


            point = null;
        }
        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();
            }
        }
 protected override void OnClick()
 {
     ConfigUtil.type = "water";
     GeoNetTools.CheckConnections(ArcMap.Application, ConfigUtil.GetConfigValue("ConnectionChecker_CheckOnlyVisibleLayers", false));
 }
 protected override void OnClick()
 {
     ConfigUtil.type = "water";
     GeoNetTools.DisconnectSelected(ArcMap.Application);
 }
 protected override void OnMouseDown(MouseEventArgs arg)
 {
     ConfigUtil.type = "water";
     GeoNetTools.CalculateFlowAccumAtLocation(ConfigUtil.GetFlowAccumConfig(), ArcMap.Application, Convert.ToDouble(ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0)));
 }
 protected override void OnClick()
 {
     ConfigUtil.type = "water";
     GeoNetTools.CalculateFlowAccum(ConfigUtil.GetFlowAccumConfig(), ArcMap.Application);
 }
        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 OnClick()
 {
     GeoNetTools.DisconnectSelected(ArcMap.Application);
 }