public bool Configure(Window owner, IList <ESRI.ArcGIS.OperationsDashboard.DataSource> dataSources) { // Allow author to configure the map widget that the earthquakes are shown in. // Get a list of all map widgets. IEnumerable <MapWidget> mapWidgets = ESRI.ArcGIS.OperationsDashboard.OperationsDashboard.Instance.Widgets.OfType <MapWidget>(); // Show the configuration dialog, passing in reference to find current MapWidgetId, if set. Config.EarthquakeWidgetDialog dialog = new Config.EarthquakeWidgetDialog(mapWidgets, this) { Owner = owner }; // If the user cancels the configuation dialog, indicate that configuration failed and the widget should not // be added to the current confirguration. if (dialog.ShowDialog() != true) { return(false); } // Retrieve the selected values for the properties from the configuration dialog. Caption = dialog.Caption; MapWidgetId = dialog.MapWidget.Id; // If re-configuring, then ensure any graphics previously added to either map are removed. if (_map != null) { if ((_graphics != null) && (_map.Layers.Contains(_graphics))) { _graphics.ClearGraphics(); _map.Layers.Remove(_graphics); _graphics = null; } } // Get the map from the selected widget. GetMapAndAddEarthquakes(); // Indicate that configuration was successful and the widget can be added to the configuration. return(true); }
public bool Configure(Window owner, IList<ESRI.ArcGIS.OperationsDashboard.DataSource> dataSources) { // Allow author to configure the map widget that the earthquakes are shown in. // Get a list of all map widgets. IEnumerable<MapWidget> mapWidgets = ESRI.ArcGIS.OperationsDashboard.OperationsDashboard.Instance.Widgets.OfType<MapWidget>(); // Show the configuration dialog, passing in reference to find current MapWidgetId, if set. Config.EarthquakeWidgetDialog dialog = new Config.EarthquakeWidgetDialog(mapWidgets, this) { Owner = owner }; // If the user cancels the configuation dialog, indicate that configuration failed and the widget should not // be added to the current confirguration. if (dialog.ShowDialog() != true) return false; // Retrieve the selected values for the properties from the configuration dialog. Caption = dialog.Caption; MapWidgetId = dialog.MapWidget.Id; // If re-configuring, then ensure any graphics previously added to either map are removed. if (_map != null) { if ((_graphics != null) && (_map.Layers.Contains(_graphics))) { _graphics.ClearGraphics(); _map.Layers.Remove(_graphics); _graphics = null; } } // Get the map from the selected widget. GetMapAndAddEarthquakes(); // Indicate that configuration was successful and the widget can be added to the configuration. return true; }