garysheppardjr / geodev-dc-labs

Lab exercises for Esri GeoDev events held in the Washington, D.C., area.
Apache License 2.0
3 stars 3 forks source link

.NET WPF: Lock focus button causes crash if 3D has never been enabled #140

Closed garysheppardjr closed 6 years ago

garysheppardjr commented 6 years ago

Run the Exercise 2 solution. Without toggling to 3D, click the lock focus button. The program crashes.

This behavior probably happens in Exercises 3 through 5 as well.

We need to fix the bug in the solutions and then update the Exercise 2 text.

garysheppardjr commented 6 years ago

It's a null pointer in MainWindow.xaml.cs:

Geometry target = sceneView.GetCurrentViewpoint(ViewpointType.CenterAndScale).TargetGeometry;

GetCurrentViewpoint(ViewpointType) returns null if 3D has never been enabled.