public static void RemoveFlagBarrier(IPoint pPnt, IApplication app, double snapTol)
{
IProgressDialogFactory pProDFact = null;
IStepProgressor pStepPro = null;
IProgressDialog2 pProDlg = null;
ITrackCancel pTrkCan = null;
List<IGeometricNetwork> gnList = null;
IMap pMap = null;
INetworkAnalysisExt pNetAnalysisExt = null;
UID pID = null;
try
{
pMap = (app.Document as IMxDocument).FocusMap;
bool boolCont = true;
// Create a CancelTracker
pTrkCan = new CancelTrackerClass();
// Create the ProgressDialog. This automatically displays the dialog
pProDFact = new ProgressDialogFactoryClass();
pProDlg = (IProgressDialog2)pProDFact.Create(pTrkCan, 0);
// Set the properties of the ProgressDialog
pProDlg.CancelEnabled = true;
pProDlg.Animation = esriProgressAnimationTypes.esriProgressGlobe;
// Set the properties of the Step Progressor
pStepPro = (IStepProgressor)pProDlg;
pStepPro.MinRange = 0;
pStepPro.MaxRange = 6;
pStepPro.StepValue = 1;
pStepPro.Position = 0;
pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_4");
gnList = Globals.GetGeometricNetworksCurrentlyVisible(ref pMap);
if (gnList == null || gnList.Count == 0)
{
MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_2"), A4LGSharedFunctions.Localizer.GetString("GeoNetToolsErrorLbl_2"));
return;
}
// Create junction or edge flag at start of trace - also returns geometric network, snapped point, and EID of junction
pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_5") + "/" + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_6");
pStepPro.Step();
boolCont = pTrkCan.Continue();
if (!boolCont)
{
pStepPro.Hide();
pProDlg.HideDialog();
pStepPro = null;
pProDlg = null;
pProDFact = null;
return;
}
if (app != null)
{
pID = new UID();
pID.Value = "esriEditorExt.UtilityNetworkAnalysisExt";
pNetAnalysisExt = (INetworkAnalysisExt)app.FindExtensionByCLSID(pID);
Globals.RemoveFlagBarrierAtLocation(pPnt.X, pPnt.Y, ref pNetAnalysisExt, snapTol);
}
}
catch (Exception ex)
{
MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsLbl_3") + ": " + ex.ToString());
}
finally
{
if (pProDlg != null)
{
pProDlg.HideDialog();
}
pStepPro = null;
pProDlg = null;
pProDFact = null;
pTrkCan = null;
gnList = null;
pNetAnalysisExt = null;
pMap = null;
pID = null;
}
}