<esri:Map x:Name="MyMap" esri:Editor.SnapDistance="0" WrapAround="True" Margin="1,1,1,0" Height="{Binding Path=LocalSubLayerList}" Background="White" MinimumResolution="0.001" MaximumResolution="1000" Style="{StaticResource MyMapStyle}" MouseEnter="Map_MouseEnter" MouseLeave="Map_MouseLeave" MouseClick="QueryPoint_MouseClick" IsEnabled="False" IsLogoVisible="False" AllowDrop="True" UseAcceleratedDisplay="True"> <esri:Map.Layers> <esri:LayerCollection> <esri:ArcGISLocalDynamicMapServiceLayer ID="Layers" x:Name="MXD1" DisableClientCaching="True" EnableDynamicLayers="True" Initialized="ArcGISLocalDynamicMapServiceLayer_Initialized"/> <esri:GraphicsLayer ID="SelectGraphic" RendererTakesPrecedence="True" ShowLegend="False"/> <esri:GraphicsLayer ID="AreaGraphic" RendererTakesPrecedence="True" ShowLegend="False"/> <esri:GraphicsLayer ID="DistanceGraphic" RendererTakesPrecedence="True" ShowLegend="False"/> </esri:LayerCollection> </esri:Map.Layers> </esri:Map>
public MainWindow() { // License setting and ArcGIS Runtime initialization is done in Application.xaml.cs. Application.Current.DispatcherUnhandledException += AppDispatcherUnhandledException; InitializeComponent(); } void AppDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { // Process unhandled exception // If it's display-related the error message is: // "Failed to create Accelerated Display. Please check the display hardware and drivers meet the minimum requirements." MessageBox.Show(e.Exception.Message); // Prevent default unhandled exception processing e.Handled = true; this.Close(); }
Hi,
Does your machine meet the minimum requirements for the hardware accelerated display?: DirectX 9 support, Shader model 2.0 or greater and at least 256MB dedicated graphics memory.
In the scenario where the display fails we raise an exception: Error: Failed to create Accelerated Display. Please check the display hardware and drivers meet the minimum requirements.
However - when you enable the accelerated display on the Map in XAML and the display creation fails then it happens early on and isn't caught by any of our event handlers. Therefore you should register a handler for the Application.Current.DispatcherUnhandledException. In the example below I've added the handler in the window class but you probably want to register this handler and handle the event in the Application class.
e.g.public MainWindow() { // License setting and ArcGIS Runtime initialization is done in Application.xaml.cs. Application.Current.DispatcherUnhandledException += AppDispatcherUnhandledException; InitializeComponent(); } void AppDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { // Process unhandled exception // If it's display-related the error message is: // "Failed to create Accelerated Display. Please check the display hardware and drivers meet the minimum requirements." MessageBox.Show(e.Exception.Message); // Prevent default unhandled exception processing e.Handled = true; this.Close(); }
I appreciate this is not sufficiently documented - I'll investigate that and we'll also consider how better we can handle this for you as the developer.
Cheers
Mike