ArcGIS Pro SDK for.net Beginning Pro Customization. Charles Macleod

Similar documents
ArcGIS Pro SDK for.net Intro and Pro Add-in Programming Patterns. Wolfgang Kaiser

ArcGIS Pro SDK for.net: Add-in Fundamentals and Development Patterns. Wolf Kaiser, Uma Harano

ArcGIS Pro SDK for.net: Asynchronous Programming and MVVM Patterns in Pro. Wolfgang Kaiser

ArcGIS Pro Extensibility - Building and Deploying Addins with the new DotNet SDK

ArcGIS Pro SDK for.net Advanced User Interfaces in Add-ins. Wolfgang Kaiser

ArcGIS Pro SDK for.net: UI Design and MVVM

Developing Add-Ins for ArcGIS Pro (.NET) Toronto Esri Canada UC Presented by: Gandhar Wazalwar & Kern Ranjitsingh October 11, 2018

ArcGIS Pro SDK for.net: Advanced User Interfaces in Add-ins. Wolfgang Kaiser

ArcGIS Pro SDK for.net Customize Pro to Streamline Workflows. Wolfgang Kaiser

Configurations. Charles Macleod Wolfgang Kaiser

Advanced Customization. Charles Macleod, Steve Van Esch

ArcGIS Pro SDK for.net Advanced Pro Customization. Charles Macleod

Beginning Editing and Editing UI Patterns. Thomas Emge Narelle Chedzey

Visual Studio 2015: Windows Presentation Foundation (using VB.NET Language) Training Course Outline

ArcGIS Viewer for Silverlight Advanced Topics

Configuring and Customizing the ArcGIS Viewer for Silverlight. Katy Dalton

Agenda. Configuration. Customization. Customization without programming. Creating Add-ins

Creating.NET Add-ins for ArcGIS for Desktop

ArcGIS Runtime SDK for.net Building Apps. Antti Kajanus David Cardella

Windows Presentation Foundation (WPF)

.NET Add-ins for ArcGIS for Desktop. John Hauck, Chris Fox

Implementing MVVM in Real World ArcGIS Server Silverlight Applications. Brandon Copeland LJA Engineering, Inc.

ArcGIS Pro SDK for.net UI Design for Accessibility. Charles Macleod

04 Sharing Code Between Windows 8 and Windows Phone 8 in Visual Studio. Ben Riga

WPF and MVVM Study Guides

Calendar Management A Demonstration Application of TopBraid Live

ArcGIS Runtime SDK for.net Getting Started. Jo Fraley

10262A VB: Developing Windows Applications with Microsoft Visual Studio 2010

ArcGIS Runtime SDK for WPF

Integrate GIS Functionality into Windows Apps with ArcGIS Runtime SDK for.net

This document contains a general description of the MVVMStarter project, and specific guidelines for how to add a new domain class to the project.

ArcGIS Runtime: Building Cross-Platform Apps. Rex Hansen Mark Baird Michael Tims Morten Nielsen

Windows Presentation Foundation Visual Studio.NET 2008

03 Model-View-ViewModel. Ben Riga

ArcGIS Pro SDK for.net: An Overview of the Geodatabase API. Colin Zwicker Ling Zhang Nghiep Quang

Customization of ArcGIS Pro: WSDOT s GIS Workbench Data Access Add-In

Extending ArcGIS Pro with.net and Python: Interactive Analytics. Carlos A. Osorio-Murillo Mark Janikas

ArcGIS Pro: What s New in Editing and Data Management

Building Applications with the ArcGIS Runtime SDK for WPF

Office as a development platform with Visual Studio Daniel Moth Developer and Platform Group Microsoft

ExecuTrain Course Outline MOC 6460A: Visual Studio 2008: Windows Presentation Foundation

Prism Composite Application Guidance

An introduction to ArcGIS Runtime

Practical WPF. Learn by Working Professionals

ArcGIS Runtime SDK for.net Building Apps. Rex Hansen

Migrating from ArcMap to ArcGIS Pro. David Watkins Scott Noulis


Building WPF Apps with the new ArcGIS Runtime SDK for.net. Antti Kajanus Mike Branscomb

Customizing MapInfo Pro Using the.net API

Esri Developer Summit in Europe Building Applications with ArcGIS Runtime SDK for Java

Building a mobile enterprise application with Xamarin.Forms, Docker, MVVM and.net Core. Gill

Index A, B. Cascading Style Sheets (CSS), 45 Columns, 325 calculations, 330 choice type, 328

Workspace Desktop Edition Developer's Guide. Best Practices for Views

Learn to develop.net applications and master related technologies.

Building Loosely Coupled XAML Client Apps with Prism

Beginning Editing Edit Operations and Inspector. Charlie Macleod

Deep Dive on How ArcGIS API for JavaScript Widgets Were Built

Transitioning to the ArcGIS Runtime SDK for.net. Antti Kajanus & Mike Branscomb

Workspace Desktop Edition Developer's Guide. Customize Views and Regions

ArcGIS Runtime: Building Cross-Platform Apps. Mike Branscomb Michael Tims Tyler Schiewe

What s New for Developers in ArcGIS Maura Daffern October 16

NiceLabel.NET SDK Installation and Deployment Guide

Mastering VB.NET using Visual Studio 2010 Course Length: 5 days Price: $2,500

ArcGIS for Developers: An Introduction. Moey Min Ken

Index. Application programming interface (API), 38. Binary Application Markup Language (BAML), 4

Latitude Version SDK Release Notes

Enabling High-Quality Printing in Web Applications. Tanu Hoque & Craig Williams

No Programming Required Create web apps rapidly with Web AppBuilder for ArcGIS

Windows Presentation Foundation. Jim Fawcett CSE687 Object Oriented Design Spring 2018

Prism Composite Application Guidance

Intro to Workflow Part One (Configuration Lab)

Ocean Wizards and Developers Tools in Visual Studio

Building Java Apps with ArcGIS Runtime SDK

DOT NET SYLLABUS FOR 6 MONTHS

ArcGIS Pro Tasks: Tips and Tricks. Jason Camerano

Sharing Web Layers and Services in the ArcGIS Platform. Melanie Summers and Ty Fitzpatrick

Advanced WCF 4.0 .NET. Web Services. Contents for.net Professionals. Learn new and stay updated. Design Patterns, OOPS Principles, WCF, WPF, MVC &LINQ

Microsoft Partner Day. Introduction to SharePoint for.net Developer

ArcGIS for Developers. Kevin Deege Educational Services Washington DC

CHAPTER 1: INTRODUCTION TO THE IDE 3

Enabling High-Quality Printing in Web Applications. Tanu Hoque & Jeff Moulds

Xamarin for C# Developers

ArcGIS Runtime SDK for Android: Building Apps. Shelly Gill

AADL Graphical Editor Design

Index. Alessandro Del Sole 2017 A. Del Sole, Beginning Visual Studio for Mac,

Introduction to C++/CLI 3. What C++/CLI can do for you 6 The rationale behind the new syntax Hello World in C++/CLI 13

Migrating your WPF Apps to the New ArcGIS Runtime SDK for.net. Mike Branscomb Antti Kajanus

Saperion. Release Notes. Version: 8.0

Windows Presentation Foundation Programming Using C#

Wpf Button Click Event Firing Multiple Times

COPYRIGHTED MATERIAL. Contents. Part I: C# Fundamentals 1. Chapter 1: The.NET Framework 3. Chapter 2: Getting Started with Visual Studio

Installation Guide for 3.1.x

Learn.Net WPF with Prism & Multithreading. This syllabus is cover WPF with Prism 4.0 & multithreading

University of West Bohemia. Faculty of Applied Sciences. Department of Computer Science and Engineering MASTER THESIS

ArcGIS Pro. Terminology Guide

Using the vrealize Orchestrator Operations Client. vrealize Orchestrator 7.5

Session ID vsphere Client Plug-ins. Nimish Sheth Manas Kelshikar

CHANNEL9 S WINDOWS PHONE 8.1 DEVELOPMENT FOR ABSOLUTE BEGINNERS

SAS 9.2 Foundation Services. Administrator s Guide

MICROSOFT VISUAL STUDIO 2010 Overview

Transcription:

ArcGIS Pro SDK for.net Beginning Pro Customization Charles Macleod

Session Overview Extensibility patterns - Add-ins - Configurations Primary API Patterns - QueuedTask and Asynchronous Programming - async and await - Model, View, View Model or MVVM

ArcGIS Pro SDK for.net Add-ins Extends ArcGIS Pro through: - Buttons, Tools, Checkboxes - Combo Boxes, Edit Boxes, Spinners - Menus, Context Menus, Dynamic Menus - Galleries, Button and Tool Palettes, Split Buttons - Tabs, Groups, Contextual Groups - Property Pages/Sheets, Wizards - Views and Docking Panes - Custom (XAML) controls - Backstage Tabs, Backstage Button - Use Add-ins to add new functionality to Pro or to - Augment existing.

ArcGIS Pro SDK for.net Addins Characteristics - Archive (.esriaddinx) - Xcopy or double-click deployment (via RegisterAddin.exe) - C:\users\<username>\Documents\ArcGIS\Addins\ArcGISPro - Multiple Add-ins can be loaded per user (per Pro session). - Admin and per-user settings for: - Well known folders - Add-in security level, etc.

ArcGIS Pro SDK for.net Addins Consists of A module ( Module1.cs ) An xml Configuration file (Config.daml) and code files, etc.

ArcGIS Pro SDK for.net Addins Module - Hub and central access point - Singleton instantiated automatically by the Framework - Can use Module to centralize shared logic internal class Module1 : Module { private static Module1 _this = null; /// <summary>retrieve the singleton instance to this module here /// </summary> public static Module1 Current{ get { return _this?? (_this = (Module1)FrameworkApplication.FindModule("ProAppModule7_Module")); } }

ArcGIS Pro SDK for.net Addins Config.daml - Declarative add-in definition for UI and related UI state - Contains framework element declarations (buttons, dockpane, galleries) <insertmodule id="mvvm_module" classname="module1" autoload= false" caption="module1"> <tabs> <tab id="mvvm_tab1" caption="mvvm Demo" keytip="t1"> <group refid="mvvm_group1" /> </tab> </tabs> <groups> <group id="mvvm_group1" caption="mvvm Demo" keytip="g1"> <button refid="mvvm_mvvmdockpane_showbutton" size="large" /> </group> </groups> <controls> <button id="mvvm_mvvmdockpane_showbutton" caption="show Bookmark DockPane"...> </button> </controls>

ArcGIS Pro SDK for.net Addins Configurations

ArcGIS Pro SDK for.net Configurations Introduced at 1.4 - All of the functionality of an Add-in plus. - Change the application title and icon - Change the application splash and start page - Conditional customization of the UI - Eg via the a user s permissions, role, portal group membership, etc - Use Configurations when a deeper level of customization is required beyond what an Add-in provides - Eg You need to customize the Pro start-up process and/or streamline its functionality for some specific workflow

ArcGIS Pro SDK for.net Configurations Characteristics - Archive.proConfigX - Xcopy or double-click deployment (via RegisterAddin.exe) - C:\Users\Public\Documents\ArcGIS\ArcGISPro\Configurations - One configuration can run per instance of Pro - Specify via Command line: - /config:{configuration_name} - Admin registry key to force Pro to run under a specific configuration: - HKLM\Software\ESRI\ArcGISPro\Settings\ConfigurationName https://github.com/arcgis/arcgis-pro-sdk/wiki/arcgis-pro-registry-keys

ArcGIS Pro SDK for.net Configurations ConfigurationManager class The Central Component of a Configuration is the ConfigurationManager - Defined in DAML (generated automatically by the template) <Configuration appname= GeocodeConfiguration"> <ConfigurationManager classname="configurationmanager1"/> </Configuration> - Provides a set of methods by which a developer can override that aspect of Pro public abstract class ConfigurationManager { protected internal virtual Window OnShowSplashScreen(); protected internal virtual FrameworkElement OnShowStartPage(); protected internal virtual FrameworkElement OnShowAboutPage();...

ArcGIS Pro SDK for.net Configurations Demo

ArcGIS Pro SDK for.net Configurations Patterns in Pro - QueuedTask and Asynchronous Programming - MVVM

ArcGIS Pro SDK.NET Asynchronous Programming ArcGIS Pro is a multi-threaded 64 bit application - Primary purpose is to allow the UI to remain responsive

ArcGIS Pro SDK.NET Asynchronous Programming ArcGIS Pro SDK developers only need to worry about two threads: - The GUI thread (Graphical User Interface thread) - By default, your Add-in is running on the UI thread - A specialized worker thread called the Main CIM Thread, MCT - All work/business logic using API should run on the MCT - To access the MCT we use use ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask

ArcGIS Pro SDK.NET Asynchronous Programming We need to consider two Categories of Methods: - Coarse-grained asynchronous methods: - Can be called on any thread - Returns immediately - Fine-grained synchronous methods: - Must be called using the QueuedTask class

Coarse-Grained Asynchronous Methods - Return type of Task and method names end with Async - Can be called from any thread, typically the UI - Execute internally on the worker threads via MCT - Use them with async/await semantic if you need to wait for them to finish protected async override void OnClick() { //Execute a Geoprocessing Tool await Geoprocessing.ExecuteToolAsync("SelectLayerByAttribute_management", new string[] {"parcels","new_selection", "description = 'VACANT LAND'"}); MapView.Active.ZoomToSelectedAsync(new TimeSpan(0, 0, 3));

Fine-Grained, Synchronous Methods Must be called using the QueuedTask class* - A much greater number of fine grained methods and classes - Designed for aggregation into your own coarse-grained async methods - i.e. you can write your custom business logic as background tasks await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { var layers = MapView.Active.Map.FindLayers("Parcels").OfType<FeatureLayer>().ToList(); var parcels = layers[0] as FeatureLayer; QueryFilter qf = new QueryFilter() { WhereClause = "description = 'VACANT LAND'", SubFields = "*" }; parcels.select(qf, SelectionCombinationMethod.New); }); - *Will throw a CalledOnWrongThread exception

ArcGIS Pro SDK.NET Asynchronous Programming Demo

ArcGIS Pro SDK.NET MVVM Pattern MVVM: Model View ViewModel Design pattern used to separate implementation aspects - UI separated from business logic and data Central to the ArcGIS Pro SDK - Pro Framework handles instantiating the View and View Model and binds them together

ArcGIS Pro SDK.NET MVVM Pattern MVVM is used for many of the Framework elements - Dockpane, Property Page, Ribbon Custom Control, Embeddable Control, Pane, - Backstage tab, etc. Simply run the relevant Pro SDK item template - Adds the relevant View and View Model pair to your project - Updates the Config.daml as needed

ArcGIS Pro SDK.NET MVVM Pattern Assume we added a Dockpane. In the project you get: - A new Dockpane View (User Control) - A new Dockpane ViewModel (Code behind file) In the Config.daml you get - A dockpane declaration with View and View Model - A button declaration which can be used to show your view - Implementation is added in to the bottom of the view model code behind file

ArcGIS Pro SDK.NET MVVM Pattern Add your desired UI to the Dockpane using WPF Add your desired code-behind/properties/etc to the Dockpane View Model - Optionally add your own Model class Bind your ViewModel properties to your View UI elements public string Heading => _heading; <DockPanel Grid.Row="0" LastChildFill="true" KeyboardNavigation.TabNavigation="Local" Height="30"> <TextBlock Grid.Column="1" Text="{Binding Heading}" Style="{...}">...

ArcGIS Pro SDK.NET MVVM Pattern Demo

ArcGIS Pro SDK.NET MVVM Pattern Questions?

What is the ArcGIS Pro SDK for.net? Easy to use project and item templates (in the Visual Studio IDE) - Currently Visual Studio 2015 and 2017 - Integrated with Visual Studio Gallery - Version 2.1 -.NET 4.6.1+ Resources - Github: Concept docs, Samples, Snippets API Reference (pro.arcgis.com)

What is the ArcGIS Pro SDK for.net?.net APIs exposed by the ArcGIS Pro extensions - Installed as part of Pro (not as part of the SDK) - Modern API - Uses.NET features - UI is WPF Core Catalog Mapping Layout Editing Sharing Search GP Raster GDB

ArcGIS Pro SDK for.net Configurations Start Page - User Control View + View Model pair - Shown at the conclusion of Pro initialization - Shown only once - Start Page is responsible for initiating the Pro session - Either: Open an existing project - Or: Create a new project - Note: Closed automatically by Pro when the project is being opened

ArcGIS Pro SDK.NET Asynchronous Programming To access the MCT use ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask - Threading infrastructure tailored to reduce complexity - Serializes or Queues access to Pro s internal thread pool - Functionality can execute sequentially and asynchronously -.Hence allowing the UI to remain responsive while ensuring consistency of the underlying application state

Plug-Ins Many customizations are purely declarative - Eg Menus Others (such as Controls ) have an active (code-behind) component Inherit from common base class PlugIn Most methods and properties do not need to be overridden - Provided by the DAML public abstract class PlugIn : PropertyChangedBase { public string Caption { get; set; } public string DisabledTooltip { get; set; } public bool Enabled { get; set; } protected internal string ID { get; }... - Most Controls generated automatically out-of-the-box by the SDK

Plug-Ins (Controls) Cannot exist un-tethered or stand-alone They have to be defined in a Module Require a unique ID Have a code behind file (or class file) linked to the DAML <insertbutton id="esri_subsystem_button1" classname="testbutton" caption="test /> public sealed class TestButton : Contracts.Button { protected override void OnClick() { this.caption = New Caption ; this.tooltip = New Tooltip ; this.checked = true; }...

Hooking Existing ArcGIS Pro Commands in Code Use the ArcGIS Pro Framework s GetPlugInWrapper method with any ArcGIS Pro element s Id to get the IPlugInWrapper interface All buttons implement the ICommand interface - with Execute() and CanExecute() // ArcGIS Pro's Create button control DAML ID. var commandid = DAML.Button.esri_mapping_createBookmark; // get the ICommand interface from the ArcGIS Pro Button // using command's plug-in wrapper // (note ArcGIS.Desktop.Core.ProApp can also be used) var icommand = FrameworkApplication.GetPlugInWrapper(commandId) as ICommand; if (icommand!= null) { // Let ArcGIS Pro do the work for us if (icommand.canexecute(null)) icommand.execute(null); } Using the above pattern you can use any ArcGIS Pro button functionality to your code

ICommand Pattern in MVVM Adding a button to the Dockpane to run the Close ArcGIS Pro Command - Use Data Binding in UI declaration to bind to an ICommand view model property - Define the reference ICommand property in your viewmodel Adding a button to the Dockpane with our custom behavior using RelayCommand RelayCommand implements ICommand and allows you to specify your own implementation of Execute and CanExecute

Delegate Commands A pattern for simplifying the creation of buttons Declare the button as a static method in the Module OnUpdate logic can be implemented as a static bool getter property <insertmodule id="workingwithdaml" classname="module1" autoload="false" caption="module1">... <insertbutton id= TestButton1" classname= WorkingWithDAML:OnCustomButtonClick" caption="test /> internal class Module1 : Contracts.Module { internal static void OnCustomButtonClick() { IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("TestButton1"); wrapper.caption = "New Caption"; wrapper.tooltip = "New Tooltip"; //TODO - something on click... } internal static bool CanOnCustomButtonClick { get { return true; } }

States & Conditions Simplifies coding by reducing event wiring associated with more traditional models. Example: A button is activated only when a example_state_condition is met. States - are named values which describes a particular aspect of the application s overall status. - Activate or deactivate in code Conditions - Declared in DAML - Expressions composed of one or more states - AND, OR, NOT - Used for triggering the activation of framework elements.

States and Conditions (continued) <conditions> <insertcondition id="example_state_condition" caption= Custom Condition"> <state id="example_state" /> </insertcondition> </conditions> if(frameworkapplication.state.contains( example_state ) FrameworkApplication.State.Deactivate( example_state ); else FrameworkApplication.State.Activate( example_state ); <!-- associate our condition with the enabled state of the button --> <button id="esri_sdk_respondtoappstatebtn" caption="respond to state" condition="example_state_condition"> </button>

States & Conditions (continued)

States and Conditions (continued) <!--Some conditions from ADMapping.daml in Pro--> <conditions> <insertcondition id="esri_mapping_mappaneorlayoutpane"> <or> <state id="esri_layouts_layoutpane"/> <state id ="esri_mapping_mappane"/> </or> </insertcondition> <insertcondition id="esri_mapping_singlelayerselectedcondition" caption="a single layer is selected"> <and> <state id="esri_mapping_layerselectedstate" /> <state id="esri_mapping_singletocitemselectedstate" /> <not> <state id="esri_mapping_grouplayerselectedstate" /> </not> </and> </insertcondition>

ArcGIS Pro SDK.NET MVVM Pattern The Basic Pattern is: - ViewModel declared in DAML and implemented in code - View referenced in DAML and implemented as WPF UserControl - Use standard WPF and Xaml - Model is optional your own custom C# or VB.Net class Pro Framework handles instantiating the View and View Model and binds them together

ArcGIS Pro SDK.NET MVVM Pattern Dockpane example - Run the Pro SDK Dockpane item template