private ArcmapPick LazyLoadPickTool() { if (_pick == null) { _pick = new ArcmapPick(_pickLayers, ArcmapUtils.GetFocusMap(), 10); } return(_pick); }
/// <summary> /// This event is called, when the user released the mouse button in ArcMap. /// </summary> /// <param name="arg">Event arguments</param> protected override void OnMouseUp(MouseEventArgs arg) { try { ArcmapPick pick = LazyLoadPickTool(); ArcmapPickCandidate pickedCandidate = pick.OnMouseUp(arg.X, arg.Y); if (pickedCandidate != null) { ArcmapUtils.FlashFeature(pickedCandidate.Feature, ArcmapUtils.FocusMapToScreenDisplay(pick.FocusMap)); GeometrySpyViewModel viewModel = new GeometrySpyViewModel(pickedCandidate.Feature); GeometrySpyView form = new GeometrySpyView(); form.SetDataContext(viewModel); WindowsUtils.MakeModelessDialogParentOf(form, new IntPtr(ArcMap.Application.hWnd)); form.Show(); } } catch (Exception) { // Don't let the exeption escape to arcgis. ResetPickTool(); } ArcmapUtils.InvalidateMap(ArcmapUtils.GetFocusMap()); }
private void ResetPickTool() { _pick = null; }