BackstageTabTestButton.cs
using ArcGIS.Desktop.Framework.Contracts;
using ArcGIS.Desktop.Framework.Dialogs;
namespace WineMonk.Demo.ProAppModule.Code14_BackstageTab
{
internal class BackstageTabTestButton : Button
{
protected override void OnClick()
{
MessageBox.Show("Sample action using C#.");
}
}
}
Config.daml
<modules>
<insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1"> <controls>
<button id="WineMonk_Demo_ProAppModule_Code14_BackstageTab_BackstageTabTest_Button" caption="BackstageTabTestButton" className="WineMonk.Demo.ProAppModule.Code14_BackstageTab.BackstageTabTestButton" loadOnClick="true">
<tooltip heading="BackstageTab Button Heading">BackstageTab button tool tip text.<disabledText />tooltip>
button>
controls>
insertModule>
modules>
<backstage>
<insertButton refID="WineMonk_Demo_ProAppModule_Code14_BackstageTab_BackstageTabTest_Button" insert="before" placeWith="esri_core_exitApplicationButton" separator="true" />
backstage>
BackstageTabTest.xaml
BackstageTabTestViewModel.cs
using ArcGIS.Desktop.Framework.Contracts;
using System.Threading.Tasks;
namespace WineMonk.Demo.ProAppModule.Code14_BackstageTab
{
internal class BackstageTabTestViewModel : BackstageTab
{
///
/// Called when the backstage tab is selected.
///
protected override Task InitializeAsync()
{
return base.InitializeAsync();
}
///
/// Called when the backstage tab is unselected.
///
protected override Task UninitializeAsync()
{
return base.UninitializeAsync();
}
private string _tabHeading = "Tab Title";
public string TabHeading
{
get
{
return _tabHeading;
}
set
{
SetProperty(ref _tabHeading, value, () => TabHeading);
}
}
}
}
Config.daml
<modules>
<insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
insertModule>
modules>
<backstage>
<insertTab id="WineMonk_Demo_ProAppModule_Code14_BackstageTab_BackstageTabTest" caption="BackstageTabTest" className="WineMonk.Demo.ProAppModule.Code14_BackstageTab.BackstageTabTestViewModel" insert="before" placeWith="esri_core_exitApplicationButton">
<content className="WineMonk.Demo.ProAppModule.Code14_BackstageTab.BackstageTabTestView" />
insertTab>
backstage>
ShowProWindowTest.cs
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
namespace WineMonk.Demo.ProAppModule.Code15_ProWindow
{
internal class ShowProWindowTest : Button
{
private ProWindowTest _prowindowtest = null;
protected override void OnClick()
{
//already open?
if (_prowindowtest != null)
return;
_prowindowtest = new ProWindowTest();
_prowindowtest.Owner = FrameworkApplication.Current.MainWindow;
_prowindowtest.Closed += (o, e) => { _prowindowtest = null; };
_prowindowtest.Show();
//uncomment for modal
//_prowindowtest.ShowDialog();
}
}
}
ProWindowTest.xaml
Config.daml
<modules>
<insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
<groups>
<group id="WineMonk_Demo_ProAppModule_Group1" caption="Group 1" appearsOnAddInTab="false">
<button refID="WineMonk_Demo_ProAppModule_Code15_ProWindow_ProWindowTest" size="large" />
group>
groups>
<controls>
<button id="WineMonk_Demo_ProAppModule_Code15_ProWindow_ProWindowTest" caption="ProWindowTest" className="WineMonk.Demo.ProAppModule.Code15_ProWindow.ShowProWindowTest" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple32.png">
<tooltip heading="Tooltip Heading">Tooltip text<disabledText />tooltip>
button>
controls>
insertModule>
modules>
PropertyPageTest.xaml
PropertyPageTestViewModel.cs
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
using System;
using System.Threading.Tasks;
namespace WineMonk.Demo.ProAppModule.Code16_PropertyPage
{
internal class PropertyPageTestViewModel : Page
{
///
/// Invoked when the OK or apply button on the property sheet has been clicked.
///
/// A task that represents the work queued to execute in the ThreadPool.
/// This function is only called if the page has set its IsModified flag to true.
protected override Task CommitAsync()
{
return Task.FromResult(0);
}
///
/// Called when the page loads because it has become visible.
///
/// A task that represents the work queued to execute in the ThreadPool.
protected override Task InitializeAsync()
{
return Task.FromResult(true);
}
///
/// Called when the page is destroyed.
///
protected override void Uninitialize()
{
}
///
/// Text shown inside the page hosted by the property sheet
///
public string DataUIContent
{
get
{
return base.Data[0] as string;
}
set
{
SetProperty(ref base.Data[0], value, () => DataUIContent);
}
}
}
///
/// Button implementation to show the property sheet.
///
internal class PropertyPageTest_ShowButton : Button
{
protected override void OnClick()
{
// collect data to be passed to the page(s) of the property sheet
Object[] data = new object[] { "Page UI content" };
if (!PropertySheet.IsVisible)
PropertySheet.ShowDialog("WineMonk_Demo_ProAppModule_Code16_PropertySheet_PropertySheetTest", "WineMonk_Demo_ProAppModule_Code16_PropertyPage_PropertyPageTest", data);
}
}
}
Config.daml
<modules>
<insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
<groups>
<group id="WineMonk_Demo_ProAppModule_Group1" caption="Group 1" appearsOnAddInTab="false">
<button refID="WineMonk_Demo_ProAppModule_Code16_PropertySheet_PropertySheetTest_ShowPropertySheet" size="large" />
group>
groups>
<controls>
<button id="WineMonk_Demo_ProAppModule_Code16_PropertySheet_PropertySheetTest_ShowPropertySheet" caption="Show PropertySheetTest" className="WineMonk.Demo.ProAppModule.Code16_PropertyPage.PropertyPageTest_ShowButton" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple32.png">
<tooltip heading="Show Property Sheet">Show Property Sheet<disabledText />tooltip>
button>
controls>
insertModule>
modules>
<propertySheets>
<insertSheet id="WineMonk_Demo_ProAppModule_Code16_PropertySheet_PropertySheetTest" caption="PropertySheetTest" hasGroups="true">
<page id="WineMonk_Demo_ProAppModule_Code16_PropertyPage_PropertyPageTest" caption="PropertyPageTest" className="WineMonk.Demo.ProAppModule.Code16_PropertyPage.PropertyPageTestViewModel" group="Group 1">
<content className="WineMonk.Demo.ProAppModule.Code16_PropertyPage.PropertyPageTestView" />
page>
insertSheet>
propertySheets>
PaneTest.xaml
PaneTestViewModel.cs
using ArcGIS.Core.CIM;
using ArcGIS.Desktop.Core;
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
using System.Threading.Tasks;
namespace WineMonk.Demo.ProAppModule.Code17_Pane
{
internal class PaneTestViewModel : ViewStatePane
{
private const string _viewPaneID = "WineMonk_Demo_ProAppModule_Code17_Pane_PaneTest";
///
/// Consume the passed in CIMView. Call the base constructor to wire up the CIMView.
///
public PaneTestViewModel(CIMView view)
: base(view) { }
///
/// Create a new instance of the pane.
///
internal static PaneTestViewModel Create()
{
var view = new CIMGenericView();
view.ViewType = _viewPaneID;
return FrameworkApplication.Panes.Create(_viewPaneID, new object[] { view }) as PaneTestViewModel;
}
#region Pane Overrides
///
/// Must be overridden in child classes used to persist the state of the view to the CIM.
///
public override CIMView ViewState
{
get
{
_cimView.InstanceID = (int)InstanceID;
return _cimView;
}
}
///
/// Called when the pane is initialized.
///
protected async override Task InitializeAsync()
{
await base.InitializeAsync();
}
///
/// Called when the pane is uninitialized.
///
protected async override Task UninitializeAsync()
{
await base.UninitializeAsync();
}
#endregion Pane Overrides
}
///
/// Button implementation to create a new instance of the pane and activate it.
///
internal class PaneTest_OpenButton : Button
{
protected override void OnClick()
{
PaneTestViewModel.Create();
}
}
}
Config.daml
<modules>
<insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
<groups>
<group id="WineMonk_Demo_ProAppModule_Group1" caption="Group 1" appearsOnAddInTab="false">
<button refID="WineMonk_Demo_ProAppModule_Code17_Pane_PaneTest_OpenButton" size="large" />
group>
groups>
<panes>
<pane id="WineMonk_Demo_ProAppModule_Code17_Pane_PaneTest" caption="PaneTest" className="WineMonk.Demo.ProAppModule.Code17_Pane.PaneTestViewModel" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonGreen16.png" defaultTab="esri_mapping_homeTab" defaultTool="esri_mapping_navigateTool">
<content className="WineMonk.Demo.ProAppModule.Code17_Pane.PaneTestView" />
pane>
panes>
insertModule>
modules>
ImpersonateMapPaneTest.xaml
ImpersonateMapPaneTestViewModel.cs
using ArcGIS.Core.CIM;
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
using ArcGIS.Desktop.Mapping;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace WineMonk.Demo.ProAppModule.Code18_ImpersonateMapPane
{
internal class ImpersonateMapPaneTestViewModel : TOCMapPaneProviderPane
{
private const string _viewPaneID = "WineMonk_Demo_ProAppModule_Code18_ImpersonateMapPane_ImpersonateMapPaneTest";
///
/// Consume the passed in CIMView. Call the base constructor to wire up the CIMView.
///
public ImpersonateMapPaneTestViewModel(CIMView view)
: base(view)
{
//Set to true to change docking behavior
_dockUnderMapView = false;
}
///
/// Create a new instance of the pane.
///
internal static ImpersonateMapPaneTestViewModel Create(MapView mapView)
{
var view = new CIMGenericView();
view.ViewType = _viewPaneID;
view.ViewProperties = new Dictionary<string, object>();
view.ViewProperties["MAPURI"] = mapView.Map.URI;
var newPane = FrameworkApplication.Panes.Create(_viewPaneID, new object[] { view }) as ImpersonateMapPaneTestViewModel;
newPane.Caption = $"Impersonate {mapView.Map.Name}";
return newPane;
}
#region Pane Overrides
///
/// Must be overridden in child classes used to persist the state of the view to the CIM.
///
/// View state is called on each project save
public override CIMView ViewState
{
get
{
_cimView.InstanceID = (int)InstanceID;
//Cache content in _cimView.ViewProperties
//((CIMGenericView)_cimView).ViewProperties["custom"] = "custom value";
//((CIMGenericView)_cimView).ViewProperties["custom2"] = "custom value2";
return _cimView;
}
}
///
/// Called when the pane is initialized.
///
protected async override Task InitializeAsync()
{
var uri = ((CIMGenericView)_cimView).ViewProperties["MAPURI"] as string;
await this.SetMapURI(uri);
await base.InitializeAsync();
}
///
/// Called when the pane is uninitialized.
///
protected async override Task UninitializeAsync()
{
await base.UninitializeAsync();
}
#endregion Pane Overrides
}
///
/// Button implementation to create a new instance of the pane and activate it.
///
internal class ImpersonateMapPaneTest_OpenButton : Button
{
protected override void OnClick()
{
ImpersonateMapPaneTestViewModel.Create(MapView.Active);
}
}
}
Config.daml
<modules>
<insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
<groups>
<group id="WineMonk_Demo_ProAppModule_Group1" caption="Group 1" appearsOnAddInTab="false">
<button refID="WineMonk_Demo_ProAppModule_Code18_ImpersonateMapPane_ImpersonateMapPaneTest_OpenButton" size="large" />
group>
groups>
<controls>
<button id="WineMonk_Demo_ProAppModule_Code18_ImpersonateMapPane_ImpersonateMapPaneTest_OpenButton" caption="Open ImpersonateMapPaneTest" className="WineMonk.Demo.ProAppModule.Code18_ImpersonateMapPane.ImpersonateMapPaneTest_OpenButton" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonGreen16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonGreen32.png" condition="esri_mapping_mapPane">
<tooltip heading="Open Pane">Open Pane<disabledText />tooltip>
button>
controls>
<panes>
<pane id="WineMonk_Demo_ProAppModule_Code18_ImpersonateMapPane_ImpersonateMapPaneTest" caption="ImpersonateMapPaneTest" className="WineMonk.Demo.ProAppModule.Code18_ImpersonateMapPane.ImpersonateMapPaneTestViewModel" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonGreen16.png" defaultTab="esri_mapping_homeTab" defaultTool="esri_mapping_navigateTool">
<content className="WineMonk.Demo.ProAppModule.Code18_ImpersonateMapPane.ImpersonateMapPaneTestView" />
pane>
panes>
insertModule>
modules>
DockpaneTest.xaml
DockpaneTestViewModel.cs
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
namespace WineMonk.Demo.ProAppModule.Code19_Dockpane
{
internal class DockpaneTestViewModel : DockPane
{
private const string _dockPaneID = "WineMonk_Demo_ProAppModule_Code19_Dockpane_DockpaneTest";
protected DockpaneTestViewModel() { }
///
/// Show the DockPane.
///
internal static void Show()
{
DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);
if (pane == null)
return;
pane.Activate();
}
///
/// Text shown near the top of the DockPane.
///
private string _heading = "My DockPane";
public string Heading
{
get { return _heading; }
set
{
SetProperty(ref _heading, value, () => Heading);
}
}
}
///
/// Button implementation to show the DockPane.
///
internal class DockpaneTest_ShowButton : Button
{
protected override void OnClick()
{
DockpaneTestViewModel.Show();
}
}
}
Config.daml
<modules>
<insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
<groups>
<group id="WineMonk_Demo_ProAppModule_Group1" caption="Group 1" appearsOnAddInTab="false">
<button refID="WineMonk_Demo_ProAppModule_Code19_Dockpane_DockpaneTest_ShowButton" size="large" />
group>
groups>
<controls>
<button id="WineMonk_Demo_ProAppModule_Code19_Dockpane_DockpaneTest_ShowButton" caption="Show DockpaneTest" className="WineMonk.Demo.ProAppModule.Code19_Dockpane.DockpaneTest_ShowButton" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple32.png">
<tooltip heading="Show Dockpane">Show Dockpane<disabledText />tooltip>
button>
controls>
<dockPanes>
<dockPane id="WineMonk_Demo_ProAppModule_Code19_Dockpane_DockpaneTest" caption="DockpaneTest" className="WineMonk.Demo.ProAppModule.Code19_Dockpane.DockpaneTestViewModel" dock="group" dockWith="esri_core_projectDockPane">
<content className="WineMonk.Demo.ProAppModule.Code19_Dockpane.DockpaneTestView" />
dockPane>
dockPanes>
insertModule>
modules>
ButtonDockpaneTest.xaml
ButtonDockpaneTestViewModel.cs
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
namespace WineMonk.Demo.ProAppModule.Code20_ButtonDockpane
{
internal class ButtonDockpaneTestViewModel : DockPane
{
private const string _dockPaneID = "WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest";
private const string _menuID = "WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest_Menu";
protected ButtonDockpaneTestViewModel() { }
///
/// Show the DockPane.
///
internal static void Show()
{
DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);
if (pane == null)
return;
pane.Activate();
}
///
/// Text shown near the top of the DockPane.
///
private string _heading = "My DockPane";
public string Heading
{
get { return _heading; }
set
{
SetProperty(ref _heading, value, () => Heading);
}
}
#region Burger Button
///
/// Tooltip shown when hovering over the burger button.
///
public string BurgerButtonTooltip
{
get { return "Options"; }
}
///
/// Menu shown when burger button is clicked.
///
public System.Windows.Controls.ContextMenu BurgerButtonMenu
{
get { return FrameworkApplication.CreateContextMenu(_menuID); }
}
#endregion
}
///
/// Button implementation to show the DockPane.
///
internal class ButtonDockpaneTest_ShowButton : Button
{
protected override void OnClick()
{
ButtonDockpaneTestViewModel.Show();
}
}
///
/// Button implementation for the button on the menu of the burger button.
///
internal class ButtonDockpaneTest_MenuButton : Button
{
protected override void OnClick()
{
}
}
}
Config.daml
<modules>
<insertModule id="WineMonk_Demo_ProAppModule_Module" className="Module1" autoLoad="false" caption="Module1">
<groups>
<group id="WineMonk_Demo_ProAppModule_Group1" caption="Group 1" appearsOnAddInTab="false">
<button refID="WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest_ShowButton" size="large" />
group>
groups>
<controls>
<button id="WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest_MenuButton" caption="Burger Menu Button" className="WineMonk.Demo.ProAppModule.Code20_ButtonDockpane.ButtonDockpaneTest_MenuButton" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonPurple32.png">
<tooltip heading="Burger Menu Button">ToolTip<disabledText />tooltip>
button>
controls>
<menus>
<menu id="WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest_Menu" caption="Options" contextMenu="true">
<button refID="WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest_MenuButton" />
menu>
menus>
<dockPanes>
<dockPane id="WineMonk_Demo_ProAppModule_Code20_ButtonDockpane_ButtonDockpaneTest" caption="ButtonDockpaneTest" className="WineMonk.Demo.ProAppModule.Code20_ButtonDockpane.ButtonDockpaneTestViewModel" dock="group" dockWith="esri_core_projectDockPane">
<content className="WineMonk.Demo.ProAppModule.Code20_ButtonDockpane.ButtonDockpaneTestView" />
dockPane>
dockPanes>
insertModule>
modules>