Extending the Operations Dashboard with the Runtime SDK for WPF

Report 8 Downloads 329 Views
Offering ID: 307

Extending the Operations Dashboard with the Runtime SDK for WPF Shelly Gill, Apurva Goyal, Tif Pun

Offering ID: 307

Offering ID: 307

The 50,000 foot summary •







Operations Dashboard has extensible framework -

Widgets, map tools, feature actions

-

Develop using ArcGIS Runtime SDK for WPF

Packaged into add-ins -

Zip file *.opdashboardAddin

-

Uploaded and shared via ArcGIS Online

Operation view author downloads add-ins to local cache -

Include in operation view

-

Share the view

Add-ins automatically deployed when user opens an operation view -

Also updated automatically

Offering ID: 307

DEMO

Extensibility points, and authoring an operation view with customizations

Offering ID: 307

How did that deployment work? •



ArcGIS Online -

Provides document storage

-

Allows seamless deployment

Relies on unique item ID Operation View Web map

Web map

mapID: “<webmap item ID>” addInIds { “add-in item ID”, … }

ID: Operations Dashboard Add-In Assembly

Offering ID: 307

ArcGIS Runtime SDK for WPF



Support added at 10.1.1



Supports Visual Studio 2012 -

Application runs .NET Framework 4.5



Includes Visual Studio templates and tools, Help, Samples



Also includes copy of the application: -

Reference assemblies

-

Test executable

Offering ID: 307

Demo

Creating a new add-in with a widget

Offering ID: 307

What makes a widget/map tool/feature action? •





Managed Extensibility Framework (MEF) for loading -

System.ComponentModel.Composition namespace

-

Attributes to advertize class to MEF, and display info before loading

-

Searches local add-in cache in userprofile, and /addinpath if set

Using System.Runtime.Serialization -

DataContract and DataMember attributes

-

Internally using a custom JSON serializer, not the standard one

Implement ESRI.ArcGIS.OperationsDashboard interface(s)

Offering ID: 307

Widget •

Dockable window



Inherits from UserControl



Implements ESRI.ArcGIS.OperationsDashboard.IWidget



-

Allows opportunity to run code when activated, deactivated

-

Allows widget configuration

Other optional interfaces

Offering ID: 307

Creating a widget that consumes a data source •

Most built in widgets are data source consumers



Implements ESRI.ArcGIS.OperationsDashboard.IDataSourceConsumer -

Optional interface for a widget

-

Notifies widget when data source is updated or removed

-

Helps the app highlight widgets with broken data sources

Offering ID: 307

Demo

A custom data source consumer widget

Offering ID: 307

Creating a widget that consumes a map widget •

Less common in built-in widgets; Legend is one example



Implements ESRI.ArcGIS.OperationsDashboard.IMapConsumer





Optional interface for a widget



If multiple map widgets, applies color theming on widget



Allows warnings if author removes map widget from view

Set DataSourceRequired attribute to False

Offering ID: 307

Feature Action



Shown in a context menu when user right-clicks



No user interface



Implement ESRI.ArcGIS.OperationsDashboard.IFeatureAction -

Allows configuration

-

Enabling/disabling

-

Provides the feature and data source to be acted upon

Offering ID: 307

Demo

A custom feature action

Offering ID: 307

Map Tool



Map tools appear on map widget toolbars



Inherits from UserControl



Implements ESRI.ArcGIS.OperationsDashboard.IMapTool

Offering ID: 307

Map Toolbar •

Used to show temporary sub-toolbars like in Measure



Not quite like others -

Not chosen by operation view author

-

Installed by custom code at run-time by calling MapWidget.SetToolbar

-

Not in operation view JSON



Inherits from UserControl



Implements ESRI.ArcGIS.OperationsDashboard.IMapToolbar



Revert to default toolbar by passing in null

Offering ID: 307

Demo

Updating a custom map tool and deploying the update

Offering ID: 307

Extending a customizable application



Customizations should be configurable



Coding does not replace customization



-

No application framework

-

Limited access to existing widgets

Access to -

data sources

-

map widgets, including the Map

-

other custom widgets

-

feature actions

-

UI settings and built-in WPF styles

Offering ID: 307

Testing your add-in locally



Test before uploading to ArcGIS Online



Application can load add-in from a local path



-

/addinpath:<PathToAssembly>

-

Set in debug properties of project by project template

-

Uses SDK copy of application to test against

No ArcGIS Online ID included in the Operation View -

Do not share these test operation views with others

Offering ID: 307

Summary •





Operations Dashboard for ArcGIS is extensible -

Widgets, feature actions, map tools/toolbars

-

Make them configurable

Requires -

ArcGIS for Organizations

-

ArcGIS Runtime SDK for WPF

-

Visual Studio 2012

Deploy and update via ArcGIS Online / Portal for ArcGIS

Please fill out the session survey in the dev summit app The offering ID for this session is 307

Offering ID: 307

Offering ID: 307

Supplemental Information

Offering ID: 307

Working with the WPF map







MapWidget.Map – ESRI.ArcGIS.Client.Map -

Same as available in the WPF SDK

-

Populated and maintained by the application

-

Generally treat as read-only.

Can use to change: -

temporary graphics

-

navigation

-

If you need to add layers, except temporary graphics layers , do it in a map authoring app; data source lists may not refresh to account for layers added directly.

Changes will not be persisted

Offering ID: 307

Map uses the accelerated display •

All feature layers contained in special group layer in the Map



ESRI.ArcGIS.Client.AcceleratedLayers



Contains basemap, feature services, map services -

Exception – some temporary graphics

client.AcceleratedDisplayLayers lyrs = mapWidget.Map.Layers.FirstOrDefault(l => l is client.AcceleratedDisplayLayers) as client.AcceleratedDisplayLayers; if (lyrs != null) { foreach (client.Layer lyr in lyrs.ChildLayers)

Offering ID: 307

Local Add-in Cache •

Add-ins are downloaded from ArcGIS Online stored in user profile: -

%USERPROFILE%\My Documents\ArcGIS\AddIns\OperationsDashboard\

-

Folders named by online item ID

-

Contains unpacked contents of .opdashboard archive



Copied to temporary directory to run



Supporting files can be manually included in archive if required -



Will be unpacked to the cache location too

Cache does not contain copies of locally loaded add-ins, loaded using /addinpath startup parameter

Offering ID: 307

Troubleshooting – setup and debugging







References -

\ArcGIS SDKs\WPF10.1.1\sdk\OperationsDashboard

-

CopyLocal = False

-

Copies of ESRI.ArcGIS.Client assemblies

Widget/tool/action not showing up? -

Check /addinpath argument

-

Check Export declaration on class

Problems loading app? -

Try clearing add-in cache \My Documents\ArcGIS\Addins\OperationsDashboard

-

Try deleting cached app settings <user>\AppData\Local\ESRI

Offering ID: 307

Troubleshooting - development



Changing the map widget’s Map outside the supported cases could cause map display or data source problems.



App crashing when loading an operation view, a classic obvious thing, but check for exceptions in constructors, especially if accessing embedded Resources.



Startup is async, check widgets and properties are present before accessing if likely to be called on initialization.



Selecting



selection data source vs full data source



Results of a query are not the features in the map



Serialization