A4WaterUtilities.ConnectClosestsConstructTool.OnSketchFinished C# (CSharp) Method

OnSketchFinished() private method

private OnSketchFinished ( ) : void
return void
        private void OnSketchFinished()
        {
            ConfigUtil.type = "water";
            Keys ModKey = Control.ModifierKeys;

            // Send a shift-tab to hide the construction toolbar

            m_editor.StartOperation();
            IFeature pFeat = null;
            returnFeatArray pRetVal = null;
            if (ModKey == Keys.Shift)
            {
                pFeat = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, false, true);
                pRetVal = ConnectClosest.ConnectClosestFeatureAtPoint(ArcMap.Application, ConfigUtil.GetConnectClosestConfig(), m_edSketch.Geometry as IPoint, m_editor.CurrentTemplate.Layer.Name, true, ModKey);
                //   pFeat.Store();
            }
            else if (ModKey == (Keys.Control | Keys.Shift))
            {
                pFeat = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, false, true);
                pRetVal = ConnectClosest.ConnectClosestFeatureAtPoint(ArcMap.Application, ConfigUtil.GetConnectClosestConfig(), m_edSketch.Geometry as IPoint, m_editor.CurrentTemplate.Layer.Name, true, ModKey);
                // pFeat.Store();
            }
            else if (ModKey == Keys.Control)
            {
                pFeat = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, true, true);
                pRetVal = ConnectClosest.ConnectClosestFeatureAtPoint(ArcMap.Application, ConfigUtil.GetConnectClosestConfig(), m_edSketch.Geometry as IPoint, m_editor.CurrentTemplate.Layer.Name, true, ModKey);
                //    pFeat.Store();
            }
            else
            {

                pFeat = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, true, true);
                pRetVal = ConnectClosest.ConnectClosestFeatureAtPoint(ArcMap.Application, ConfigUtil.GetConnectClosestConfig(), m_edSketch.Geometry as IPoint, m_editor.CurrentTemplate.Layer.Name, true, ModKey);

            }
            pFeat.Store();
            foreach (IFeature featus in pRetVal.Features)
            {
                featus.Store();

            }

            if (pRetVal.Options == "DIGITIZED")
            {
                Globals.GetCommand("A4WaterUtilities_EstablishFlowDigitized", ArcMap.Application).Execute();

            }
            else if (pRetVal.Options == "ROLE")
            {
                Globals.GetCommand("A4WaterUtilities_EstablishFlowAncillary", ArcMap.Application).Execute();
            }
            else if (pRetVal.Options == "Ancillary".ToUpper())
            {
                Globals.GetCommand("A4WaterUtilities_EstablishFlowAncillary", ArcMap.Application).Execute();
            }
            else
            {
            }
            //            addLat.AddLateralAtPoint(m_edSketch.Geometry as IPoint, m_editor.CurrentTemplate.Layer.Name);

            m_editor.StopOperation(A4LGSharedFunctions.Localizer.GetString("CrtAssetAndLat"));

            //IEnvelope pEnv = pFeat.Shape.Envelope;
            //pEnv.Expand(8, 8, true);

            (ArcMap.Application.Document as IMxDocument).ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, pFeat, null);
            //pEnv = null;
            pFeat = null;
            pRetVal = null;
        }