Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Danish Naglekar authored and Danish Naglekar committed Jun 23, 2019
1 parent 8617462 commit df10ca6
Show file tree
Hide file tree
Showing 156 changed files with 163,774 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
################################################################################
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################

/.vs/Maverick.PCF.Builder/v15/Server/sqlite3
Binary file added .vs/Maverick.PCF.Builder/v15/.suo
Binary file not shown.
Binary file added .vs/Maverick.PCF.Builder/v16/.suo
Binary file not shown.
Empty file.
Binary file not shown.
Binary file added .vs/PCF-CustomControlBuilder/v16/.suo
Binary file not shown.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
6 changes: 6 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ExpandedNodes": [
""
],
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
Binary file added Images/icons8-add-column-filled-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/icons8-close-window-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/icons8-close-window-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/icons8-close-window-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/icons8-plus-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions Maverick.PCF.Builder.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.645
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maverick.PCF.Builder", "Maverick.PCF.Builder\Maverick.PCF.Builder.csproj", "{FC42397B-0A52-4491-8EEE-764A5B283282}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FC42397B-0A52-4491-8EEE-764A5B283282}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC42397B-0A52-4491-8EEE-764A5B283282}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC42397B-0A52-4491-8EEE-764A5B283282}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC42397B-0A52-4491-8EEE-764A5B283282}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {21367311-E36F-4E49-BBD1-1FA24C5744C8}
EndGlobalSection
EndGlobal
163 changes: 163 additions & 0 deletions Maverick.PCF.Builder/Maverick.PCF.Builder.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.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>{FC42397B-0A52-4491-8EEE-764A5B283282}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Maverick.PCF.Builder</RootNamespace>
<AssemblyName>Maverick.PCF.Builder</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</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>
</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>
</PropertyGroup>
<ItemGroup>
<Reference Include="McTools.Xrm.Connection, Version=1.2019.6.25, Culture=neutral, PublicKeyToken=96037217801d9658, processorArchitecture=MSIL">
<HintPath>..\packages\MscrmTools.Xrm.Connection.1.2019.6.25\lib\net462\McTools.Xrm.Connection.dll</HintPath>
</Reference>
<Reference Include="McTools.Xrm.Connection.WinForms, Version=1.2019.6.25, Culture=neutral, PublicKeyToken=f1559f79cf894e27, processorArchitecture=MSIL">
<HintPath>..\packages\MscrmTools.Xrm.Connection.1.2019.6.25\lib\net462\McTools.Xrm.Connection.WinForms.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Crm.Sdk.Proxy, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CrmSdk.CoreAssemblies.9.0.2.9\lib\net462\Microsoft.Crm.Sdk.Proxy.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.29.0.1078, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.29.0\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms, Version=2.29.0.1078, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.29.0\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CrmSdk.XrmTooling.CoreAssembly.9.0.2.12\lib\net462\Microsoft.Rest.ClientRuntime.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.XmlTransform, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CrmSdk.CoreAssemblies.9.0.2.9\lib\net462\Microsoft.Xrm.Sdk.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xrm.Sdk.Deployment, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CrmSdk.Deployment.9.0.2.9\lib\net462\Microsoft.Xrm.Sdk.Deployment.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xrm.Sdk.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CrmSdk.Workflow.9.0.2.9\lib\net462\Microsoft.Xrm.Sdk.Workflow.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xrm.Tooling.Connector, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CrmSdk.XrmTooling.CoreAssembly.9.0.2.12\lib\net462\Microsoft.Xrm.Tooling.Connector.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NuGet.Core, Version=2.14.0.832, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\NuGet.Core.2.14.0\lib\net40-Client\NuGet.Core.dll</HintPath>
</Reference>
<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" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.VisualStudio.CoreUtility">
<Private>False</Private>
</Reference>
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Activities" />
<Reference Include="System.Activities.Presentation" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.DirectoryServices.AccountManagement" />
<Reference Include="System.Drawing" />
<Reference Include="System.IdentityModel" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Workflow.Activities" />
<Reference Include="System.Workflow.ComponentModel" />
<Reference Include="System.Workflow.Runtime" />
<Reference Include="WeifenLuo.WinFormsUI.Docking, Version=3.0.6.0, Culture=neutral, PublicKeyToken=5cded1a1a0a7b481, processorArchitecture=MSIL">
<HintPath>..\packages\DockPanelSuite.3.0.6\lib\net40\WeifenLuo.WinFormsUI.Docking.dll</HintPath>
</Reference>
<Reference Include="WeifenLuo.WinFormsUI.Docking.ThemeVS2015, Version=3.0.6.0, Culture=neutral, PublicKeyToken=5cded1a1a0a7b481, processorArchitecture=MSIL">
<HintPath>..\packages\DockPanelSuite.ThemeVS2015.3.0.6\lib\net40\WeifenLuo.WinFormsUI.Docking.ThemeVS2015.dll</HintPath>
</Reference>
<Reference Include="XrmToolBox, Version=1.2019.6.33, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\XrmToolBoxPackage.1.2019.6.33\lib\net462\XrmToolBox.exe</HintPath>
</Reference>
<Reference Include="XrmToolBox.Extensibility, Version=1.2019.6.33, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\XrmToolBoxPackage.1.2019.6.33\lib\net462\XrmToolBox.Extensibility.dll</HintPath>
</Reference>
<Reference Include="XrmToolBox.PluginsStore, Version=1.2019.6.33, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\XrmToolBoxPackage.1.2019.6.33\lib\net462\XrmToolBox.PluginsStore.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="MyPlugin.cs" />
<Compile Include="MyPluginControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="MyPluginControl.designer.cs">
<DependentUpon>MyPluginControl.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Settings.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MyPluginControl.resx">
<DependentUpon>MyPluginControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>IF $(ConfigurationName) == Debug (
IF NOT EXIST Plugins mkdir Plugins
xcopy "$(TargetDir)$(TargetFileName)" "$(TargetDir)Plugins\" /Y
xcopy "$(TargetDir)$(TargetName).pdb" "$(TargetDir)Plugins\" /Y
)</PostBuildEvent>
</PropertyGroup>
<!-- 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>
84 changes: 84 additions & 0 deletions Maverick.PCF.Builder/MyPlugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
using System;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using XrmToolBox.Extensibility;
using XrmToolBox.Extensibility.Interfaces;

namespace Maverick.PCF.Builder
{
// Do not forget to update version number and author (company attribute) in AssemblyInfo.cs class
// To generate Base64 string for Images below, you can use https://www.base64-image.de/
[Export(typeof(IXrmToolBoxPlugin)),
ExportMetadata("Name", "PCF Custom Control Builder"),
ExportMetadata("Description", "Easily create, build and deployment solution for your custom control using PCF."),
// Please specify the base64 content of a 32x32 pixels image
ExportMetadata("SmallImageBase64", "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCAAgACADASIAAhEBAxEB/8QAGgAAAgIDAAAAAAAAAAAAAAAABwkECAMFBv/EACkQAAICAQQCAAYCAwAAAAAAAAIDAQQFBgcREgATCBQhIjEzCTIVUZL/xAAVAQEBAAAAAAAAAAAAAAAAAAAAAf/EABURAQEAAAAAAAAAAAAAAAAAAAAR/9oADAMBAAIRAxEAPwBlrnJrpOxYaClKGTMzKBERiOZmZn8REeR7GWxVT2RbydVHq/Z7XCHT+n55n6fsX/2P+48w3Mrbq2jrLwN6wMfLety2IgGy1hAcDBMguUiMNZyMcgUev2HBBAf17lNQ5RVrH19Dbh1RyNlGTm3QPRxwqTx61MqRF15wUQJzDCISOSkhBsokRkCnl9eaOweJtZ3I6ipRQoCLLj0n7xqqk4GXN9fb1pDt2Y0uAWEEZkICRRtqGSx+VQVrGX69xIOdWJiGiwRcphKauZGZiCBgGBD+RISieJiY8AQbCZHWeCTqi5mLLsrYey4VLVOEwJPlgGcysreIUPULMj6rHDHCyrYsJIIJkyFBfgs+IPdXYz4nnbUa/wAjkrdHWWqW4bU2NssG4xOda4kRbBns4hvzMiLjEig1dpmGECpGxYbVa0/WtDIvZDBNxvb3rIOWSUxHE8hxMeqCTzx2lZTHbn7vBVqzROex4Hk8fhNR517SssaqvhtNS8zGwIARHZNIzLQZLRmSn7VM79GSKiNXkDJYDBZiSnL4Whek6j6B/M1wb2rP6+5M9onlbPWvuH9S6DzE8R4qAJqvdjc/Qm3MYbAbWZLAZ10Oq4m/qg8KFa1eZDCr11VcZdZJsNnQZmYUpSodZafVJAyi/wDH/wDDTrzdzevEb67i4/LN01i2HqgMzdYTP8xlgtMBY+6WQw2DZU1zCnv+iBZHDwkmi0doNpsWF5eM2u0jUHJ1W0b0IwlZcWqzI4YlvUI7rKPoQlzEx+YnzrYiIiIiIiI+kRHirX//2Q=="),
// Please specify the base64 content of a 80x80 pixels image
ExportMetadata("BigImageBase64", "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgk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8kaNGgNGjRoDRo0aD/2Q=="),
ExportMetadata("BackgroundColor", "Lavender"),
ExportMetadata("PrimaryFontColor", "Black"),
ExportMetadata("SecondaryFontColor", "Gray")]
public class MyPlugin : PluginBase
{
public override IXrmToolBoxPluginControl GetControl()
{
return new MyPluginControl();
}

/// <summary>
/// Constructor
/// </summary>
public MyPlugin()
{
// If you have external assemblies that you need to load, uncomment the following to
// hook into the event that will fire when an Assembly fails to resolve
// AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolveEventHandler);
}

/// <summary>
/// Event fired by CLR when an assembly reference fails to load
/// Assumes that related assemblies will be loaded from a subfolder named the same as the Plugin
/// For example, a folder named Sample.XrmToolBox.MyPlugin
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
/// <returns></returns>
private Assembly AssemblyResolveEventHandler(object sender, ResolveEventArgs args)
{
Assembly loadAssembly = null;
Assembly currAssembly = Assembly.GetExecutingAssembly();

// base name of the assembly that failed to resolve
var argName = args.Name.Substring(0, args.Name.IndexOf(","));

// check to see if the failing assembly is one that we reference.
List<AssemblyName> refAssemblies = currAssembly.GetReferencedAssemblies().ToList();
var refAssembly = refAssemblies.Where(a => a.Name == argName).FirstOrDefault();

// if the current unresolved assembly is referenced by our plugin, attempt to load
if (refAssembly != null)
{
// load from the path to this plugin assembly, not host executable
string dir = Path.GetDirectoryName(currAssembly.Location).ToLower();
string folder = Path.GetFileNameWithoutExtension(currAssembly.Location);
dir = Path.Combine(dir, folder);

var assmbPath = Path.Combine(dir, $"{argName}.dll");

if (File.Exists(assmbPath))
{
loadAssembly = Assembly.LoadFrom(assmbPath);
}
else
{
throw new FileNotFoundException($"Unable to locate dependency: {assmbPath}");
}
}

return loadAssembly;
}
}
}
Loading

0 comments on commit df10ca6

Please sign in to comment.