Skip to content

Commit

Permalink
Update toolkit to contain 2.x and 3.x add-ins
Browse files Browse the repository at this point in the history
  • Loading branch information
williamscraigm committed Jun 24, 2022
1 parent bd92b89 commit 15d0f66
Show file tree
Hide file tree
Showing 100 changed files with 3,723 additions and 2 deletions.
Binary file added Add-Ins/Merge_Styles/2.x/MergeStyle.esriAddinX
Binary file not shown.
35 changes: 35 additions & 0 deletions Add-Ins/Merge_Styles/2.x/MergeStyle/Button1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
Copyright 2019 Esri
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.​
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;

namespace DictionaryToolkit
{
internal class Button1 : Button
{
private OptionsViewModel _vm = new OptionsViewModel();

protected override void OnClick()
{
Options dlg = new Options(_vm);
dlg.Owner = System.Windows.Application.Current.MainWindow;
var ok = dlg.ShowDialog();
}
}
}
36 changes: 36 additions & 0 deletions Add-Ins/Merge_Styles/2.x/MergeStyle/Config.daml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<ArcGIS defaultAssembly="MergeStyle.dll" defaultNamespace="DictionaryToolkit" xmlns="http://schemas.esri.com/DADF/Registry" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.esri.com/DADF/Registry file:///C:/Program%20Files/ArcGIS/Pro/bin/ArcGIS.Desktop.Framework.xsd">
<AddInInfo id="{308ccd40-3abd-4d22-9586-e685ecfa0648}" version="1.0" desktopVersion="2.0.8933">
<Name>MergeStyle</Name>
<Description>Merges styles, replacing items with identical keys</Description>
<Image>Images\AddinDesktop32.png</Image>
<Date>6/11/2019</Date>
<Subject>Framework</Subject>
<!-- Note subject can be one or more of these topics:
Content, Framework, Editing, Geodatabase, Geometry, Geoprocessing, Layouts, Map Authoring, Map Exploration -->
</AddInInfo>
<modules>
<insertModule id="MergeStyle_Module" className="Module1" autoLoad="false" caption="Module1">
<!-- uncomment to have the control hosted on a separate tab-->
<tabs>
<!--<tab id="MergeStyle_Tab1" caption="New Tab">
<group refID="MergeStyle_Group1"/>
</tab>-->
</tabs>
<groups>
<!-- comment this out if you have no controls on the Addin tab to avoid
an empty group-->
<group id="MergeStyle_Group1" caption="" appearsOnAddInTab="true">
<!-- host controls within groups -->
<button refID="DictionaryToolkit_MergeStyle" size="large" />
</group>
</groups>
<controls>
<!-- add your controls here -->
<button id="DictionaryToolkit_MergeStyle" caption="Merge Style" className="Button1" loadOnClick="true" smallImage="Images\GenericButtonBlue16.png" largeImage="Images\GenericButtonBlue32.png">
<tooltip heading="Tooltip Heading">Merge Style<disabledText />
</tooltip>
</button>
</controls>
</insertModule>
</modules>
</ArcGIS>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
123 changes: 123 additions & 0 deletions Add-Ins/Merge_Styles/2.x/MergeStyle/MergeStyle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
Copyright 2019 Esri
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.​
*/

using ArcGIS.Desktop.Mapping;
using System;
using System.Collections.Generic;

namespace DictionaryToolkit
{
public class MergeStyle
{
private StyleProjectItem _style = null;
private Action<string> _report = null;

private int _numSymbolsAdded = 0;
private int _numSymbolsNotAdded = 0;

public MergeStyle(StyleProjectItem style, Action<string> report = null)
{
_style = style;
_report = report;
}

public void Merge(StyleProjectItem styleToMerge, bool replaceKeys)
{
_numSymbolsAdded = 0;
_numSymbolsNotAdded = 0;

// point symbols
IList<SymbolStyleItem> sourcePointSymbols = styleToMerge.SearchSymbols(StyleItemType.PointSymbol, string.Empty);
foreach (var styleItem in sourcePointSymbols)
{
try
{
if (replaceKeys)
{
var item = _style.LookupItem(StyleItemType.PointSymbol, styleItem.Key);
if (item != null)
_style.RemoveItem(item);
}
_style.AddItem(styleItem);
//System.Diagnostics.Debug.WriteLine("Merging item: " + styleItem.Name);
_numSymbolsAdded++;
}
catch (Exception)
{
if (_report != null)
_report("Could not add key " + styleItem.Key);
_numSymbolsNotAdded++;
}
}

// point symbols
IList<SymbolStyleItem> sourceLineSymbols = styleToMerge.SearchSymbols(StyleItemType.LineSymbol, string.Empty);
foreach (var styleItem in sourceLineSymbols)
{
try
{
if (replaceKeys)
{
var item = _style.LookupItem(StyleItemType.LineSymbol, styleItem.Key);
if (item != null)
_style.RemoveItem(item);
}
_style.AddItem(styleItem);
//System.Diagnostics.Debug.WriteLine("Merging item: " + styleItem.Name);
_numSymbolsAdded++;
}
catch (Exception)
{
if (_report != null)
_report("Could not add key " + styleItem.Key);
_numSymbolsNotAdded++;
}
}

// point symbols
IList<SymbolStyleItem> sourcePolygonSymbols = styleToMerge.SearchSymbols(StyleItemType.PolygonSymbol, string.Empty);
foreach (var styleItem in sourcePolygonSymbols)
{
try
{
if (replaceKeys)
{
var item = _style.LookupItem(StyleItemType.PolygonSymbol, styleItem.Key);
if (item != null)
_style.RemoveItem(item);
}
_style.AddItem(styleItem);
//System.Diagnostics.Debug.WriteLine("Merging item: " + styleItem.Name);
_numSymbolsAdded++;
}
catch (Exception)
{
if (_report != null)
_report("Could not add key " + styleItem.Key);
_numSymbolsNotAdded++;
}
}
}

public int NumSymbolsAdded
{
get { return _numSymbolsAdded; }
}

public int NumSymbolsNotAdded
{
get { return _numSymbolsNotAdded; }
}
}

}
126 changes: 126 additions & 0 deletions Add-Ins/Merge_Styles/2.x/MergeStyle/MergeStyle.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{308CCD40-3ABD-4D22-9586-E685ECFA0648}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MergeStyle</RootNamespace>
<AssemblyName>MergeStyle</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<StartAction>Program</StartAction>
<StartProgram>C:\ArcGIS\bin\ArcGISPro.exe</StartProgram>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<StartAction>Program</StartAction>
<StartProgram>C:\ArcGIS\bin\ArcGISPro.exe</StartProgram>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsBase" />
<Reference Include="System.Xaml" />
</ItemGroup>
<ItemGroup>
<AddInContent Include="Config.daml">
<SubType>Designer</SubType>
</AddInContent>
<AddInContent Include="Images\AddInDesktop16.png" />
<AddInContent Include="Images\AddInDesktop32.png" />
<AddInContent Include="DarkImages\AddInDesktop16.png" />
<AddInContent Include="DarkImages\AddInDesktop32.png" />
</ItemGroup>
<ItemGroup>
<Compile Include="Button1.cs" />
<Compile Include="MergeStyle.cs" />
<Compile Include="Module1.cs" />
<Compile Include="Options.xaml.cs" />
<Compile Include="OptionsViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils.cs" />
</ItemGroup>
<ItemGroup>
<AddInContent Include="Images\GenericButtonBlue16.png" />
</ItemGroup>
<ItemGroup>
<AddInContent Include="Images\GenericButtonBlue32.png" />
</ItemGroup>
<ItemGroup>
<AddInContent Include="DarkImages\GenericButtonBlue16.png" />
</ItemGroup>
<ItemGroup>
<AddInContent Include="DarkImages\GenericButtonBlue32.png" />
</ItemGroup>
<ItemGroup>
<Page Include="Options.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\GenericOpen16.png" />
<Resource Include="Images\GenericOpen32.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="DarkImages\GenericOpen16.png" />
<Resource Include="DarkImages\GenericOpen32.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Esri.ArcGISPro.Extensions">
<Version>2.4.0.19948</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!--
PackageAction can be:
BuildDefault: ArcGIS Pro is required. An esriAddinX package is created and copied to ArcGIS Pro add-in folder.
BuildZipPostProcess: ArcGIS Pro install is NOT required to build the add-in. An esriAddinX package is created in your output folder.
BuildNoPostProcess: ArcGIS Pro install is NOT required to build the add-in. An esriAddinX package is NOT created.
-->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PackageAction>BuildDefault</PackageAction>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PackageAction>BuildDefault</PackageAction>
</PropertyGroup>
<UsingTask AssemblyFile="C:\ArcGIS\bin\proapp-sdk-MSBuild.dll" TaskName="proapp_sdk_MSBuild.PackageAddIn" />
<UsingTask AssemblyFile="C:\ArcGIS\bin\proapp-sdk-MSBuild.dll" TaskName="proapp_sdk_MSBuild.CleanAddIn" />
<UsingTask AssemblyFile="C:\ArcGIS\bin\proapp-sdk-MSBuild.dll" TaskName="proapp_sdk_MSBuild.ConvertToRelativePath" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
22 changes: 22 additions & 0 deletions Add-Ins/Merge_Styles/2.x/MergeStyle/MergeStyle.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MergeStyle", "MergeStyle.csproj", "{308CCD40-3ABD-4D22-9586-E685ECFA0648}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{308CCD40-3ABD-4D22-9586-E685ECFA0648}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{308CCD40-3ABD-4D22-9586-E685ECFA0648}.Debug|Any CPU.Build.0 = Debug|Any CPU
{308CCD40-3ABD-4D22-9586-E685ECFA0648}.Release|Any CPU.ActiveCfg = Release|Any CPU
{308CCD40-3ABD-4D22-9586-E685ECFA0648}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading

0 comments on commit 15d0f66

Please sign in to comment.