Skip to content

Commit 7d414dd

Browse files
committed
Merge branch 'dev'
2 parents a2b5b76 + 7656b2b commit 7d414dd

37 files changed

+1264
-317
lines changed

CodeMaid.config

-24
This file was deleted.

Installer/AddInReg.wxs

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
</Class>
1212
<File Id="fil4320846A83E1D6A9BFA99753384C2099" KeyPath="yes" Source="$(var.SourceOutDir)\CodeStack.Sw.MyToolbar.dll" />
1313
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
14-
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\InprocServer32\2.1.0.0" Name="Class" Value="CodeStack.Sw.MyToolbar.MyToolbarSwAddin" Type="string" Action="write" />
15-
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\InprocServer32\2.1.0.0" Name="Assembly" Value="CodeStack.Sw.MyToolbar, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
16-
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\InprocServer32\2.1.0.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
17-
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\InprocServer32\2.1.0.0" Name="CodeBase" Value="file:///[#fil4320846A83E1D6A9BFA99753384C2099]" Type="string" Action="write" />
14+
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\InprocServer32\2.2.0.0" Name="Class" Value="CodeStack.Sw.MyToolbar.MyToolbarSwAddin" Type="string" Action="write" />
15+
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\InprocServer32\2.2.0.0" Name="Assembly" Value="CodeStack.Sw.MyToolbar, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
16+
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\InprocServer32\2.2.0.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
17+
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\InprocServer32\2.2.0.0" Name="CodeBase" Value="file:///[#fil4320846A83E1D6A9BFA99753384C2099]" Type="string" Action="write" />
1818
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\InprocServer32" Name="Class" Value="CodeStack.Sw.MyToolbar.MyToolbarSwAddin" Type="string" Action="write" />
19-
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\InprocServer32" Name="Assembly" Value="CodeStack.Sw.MyToolbar, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
19+
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\InprocServer32" Name="Assembly" Value="CodeStack.Sw.MyToolbar, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
2020
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
2121
<RegistryValue Root="HKCR" Key="CLSID\{63496B16-E9AD-4D3A-8473-99D124A1672B}\InprocServer32" Name="CodeBase" Value="file:///[#fil4320846A83E1D6A9BFA99753384C2099]" Type="string" Action="write" />
2222
</Component>

Installer/AddInRegistry.wxs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<RegistryValue Root="HKCU" Key="Software\SolidWorks\AddInsStartup\{63496b16-e9ad-4d3a-8473-99d124a1672b}" Value="1" Type="integer" Action="write" />
66
<RegistryValue Root="HKLM" Key="Software\SolidWorks\Addins\{63496b16-e9ad-4d3a-8473-99d124a1672b}" Value="0" Type="integer" Action="write" />
77
<RegistryValue Root="HKLM" Key="Software\SolidWorks\Addins\{63496b16-e9ad-4d3a-8473-99d124a1672b}" Name="Description" Value="Add-in for managing custom toolbars" Type="string" Action="write" />
8-
<RegistryValue Root="HKLM" Key="Software\SolidWorks\Addins\{63496b16-e9ad-4d3a-8473-99d124a1672b}" Name="Title" Value="MyToolbar" Type="string" Action="write" />
8+
<RegistryValue Root="HKLM" Key="Software\SolidWorks\Addins\{63496b16-e9ad-4d3a-8473-99d124a1672b}" Name="Title" Value="MyToolbar (Beta)" Type="string" Action="write" />
99
</Component>
1010
</Fragment>
1111
</Wix>

Installer/Addin11.wxs

-27
This file was deleted.

Installer/Installer.wixproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@
5555
<HeatFile File="..\Build\CodeStack.Sw.MyToolbar.dll" PreprocessorVariable="var.SourceOutDir" OutputFile="AddInReg.wxs" ComponentGroupName="AddInComRegGroup" DirectoryRefId="INSTALLFOLDER" AutogenerateGuids="true" ToolPath="$(WixToolPath)" SuppressFragments="false" SuppressRegistry="false" SuppressCom="false" SuppressRootDirectory="true" />
5656
</Target>
5757
<PropertyGroup>
58-
<PreBuildEvent>"%25Wix%25bin\heat" file "$(SolutionDir)Build\CodeStack.Sw.MyToolbar.dll" -gg -srd -sfrag -template fragment -cg AddinComponents -var var.SourceOutDir -dr INSTALLFOLDER -out "$(ProjectDir)Addin11.wxs"</PreBuildEvent>
58+
<PreBuildEvent />
5959
</PropertyGroup>
6060
</Project>

Installer/Product.wxs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3-
<Product Id="*" Name="MyToolbar" Language="1033" Version="2.1.0.0" Manufacturer="CodeStack" UpgradeCode="{61EB1313-A362-41AC-A3D5-F50D43CE74D8}">
3+
<Product Id="*" Name="MyToolbar (Beta)" Language="1033" Version="2.2.0.0" Manufacturer="CodeStack" UpgradeCode="{61EB1313-A362-41AC-A3D5-F50D43CE74D8}">
44
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
55

66
<MajorUpgrade DowngradeErrorMessage="A newer version of MyToolbar is already installed." />

MyToolbar.Tests/MyToolbar.Tests.csproj

+14-14
Original file line numberDiff line numberDiff line change
@@ -43,35 +43,35 @@
4343
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
4444
<Private>True</Private>
4545
</Reference>
46-
<Reference Include="CodeStack.SwEx.AddIn, Version=0.7.0.0, Culture=neutral, PublicKeyToken=a46023996d4724e7, processorArchitecture=MSIL">
47-
<HintPath>..\packages\CodeStack.SwEx.AddIn.0.7.0\lib\net40\CodeStack.SwEx.AddIn.dll</HintPath>
48-
<Private>True</Private>
46+
<Reference Include="CodeStack.SwEx.AddIn, Version=0.8.1.0, Culture=neutral, PublicKeyToken=a46023996d4724e7, processorArchitecture=MSIL">
47+
<HintPath>..\packages\CodeStack.SwEx.AddIn.0.8.1\lib\net40\CodeStack.SwEx.AddIn.dll</HintPath>
4948
</Reference>
50-
<Reference Include="CodeStack.SwEx.Common, Version=0.9.6.0, Culture=neutral, PublicKeyToken=a46023996d4724e7, processorArchitecture=MSIL">
51-
<HintPath>..\packages\CodeStack.SwEx.Common.0.9.6\lib\net40\CodeStack.SwEx.Common.dll</HintPath>
52-
<Private>True</Private>
49+
<Reference Include="CodeStack.SwEx.Common, Version=0.9.9.0, Culture=neutral, PublicKeyToken=a46023996d4724e7, processorArchitecture=MSIL">
50+
<HintPath>..\packages\CodeStack.SwEx.Common.0.9.9\lib\net40\CodeStack.SwEx.Common.dll</HintPath>
5351
</Reference>
5452
<Reference Include="Moq, Version=4.11.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
5553
<HintPath>..\packages\Moq.4.11.0\lib\net45\Moq.dll</HintPath>
5654
<Private>True</Private>
5755
</Reference>
56+
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
57+
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
58+
</Reference>
5859
<Reference Include="PresentationCore" />
5960
<Reference Include="PresentationFramework" />
60-
<Reference Include="SolidWorks.Interop.sldworks, Version=26.2.0.63, Culture=neutral, PublicKeyToken=7c4797c3e4eeac03, processorArchitecture=MSIL">
61-
<HintPath>..\packages\CodeStack.SwEx.Common.0.9.6\lib\net40\SolidWorks.Interop.sldworks.dll</HintPath>
61+
<Reference Include="SolidWorks.Interop.sldworks, Version=27.1.0.72, Culture=neutral, PublicKeyToken=7c4797c3e4eeac03, processorArchitecture=MSIL">
62+
<HintPath>..\packages\CodeStack.SwEx.Common.0.9.9\lib\net40\SolidWorks.Interop.sldworks.dll</HintPath>
6263
<EmbedInteropTypes>False</EmbedInteropTypes>
6364
</Reference>
64-
<Reference Include="SolidWorks.Interop.swconst, Version=26.2.0.63, Culture=neutral, PublicKeyToken=19f43e188e4269d8, processorArchitecture=MSIL">
65-
<HintPath>..\packages\CodeStack.SwEx.Common.0.9.6\lib\net40\SolidWorks.Interop.swconst.dll</HintPath>
65+
<Reference Include="SolidWorks.Interop.swconst, Version=27.1.0.72, Culture=neutral, PublicKeyToken=19f43e188e4269d8, processorArchitecture=MSIL">
66+
<HintPath>..\packages\CodeStack.SwEx.Common.0.9.9\lib\net40\SolidWorks.Interop.swconst.dll</HintPath>
6667
<EmbedInteropTypes>False</EmbedInteropTypes>
6768
</Reference>
68-
<Reference Include="SolidWorks.Interop.swpublished, Version=26.2.0.63, Culture=neutral, PublicKeyToken=89a97bdc5284e6d8, processorArchitecture=MSIL">
69-
<HintPath>..\packages\CodeStack.SwEx.Common.0.9.6\lib\net40\SolidWorks.Interop.swpublished.dll</HintPath>
69+
<Reference Include="SolidWorks.Interop.swpublished, Version=27.1.0.72, Culture=neutral, PublicKeyToken=89a97bdc5284e6d8, processorArchitecture=MSIL">
70+
<HintPath>..\packages\CodeStack.SwEx.Common.0.9.9\lib\net40\SolidWorks.Interop.swpublished.dll</HintPath>
7071
<EmbedInteropTypes>False</EmbedInteropTypes>
7172
</Reference>
7273
<Reference Include="SolidWorksTools, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bd18593873b4686d, processorArchitecture=MSIL">
73-
<HintPath>..\packages\CodeStack.SwEx.Common.0.9.6\lib\net40\SolidWorksTools.dll</HintPath>
74-
<Private>True</Private>
74+
<HintPath>..\packages\CodeStack.SwEx.Common.0.9.9\lib\net40\SolidWorksTools.dll</HintPath>
7575
</Reference>
7676
<Reference Include="System" />
7777
<Reference Include="System.Configuration" />

MyToolbar.Tests/UITests.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
using Microsoft.VisualStudio.TestTools.UnitTesting;
1414
using Moq;
1515
using System;
16+
using System.Collections.Generic;
17+
using System.Linq;
1618

1719
namespace MyToolbar.Tests
1820
{
@@ -32,9 +34,10 @@ public void Setup()
3234

3335
m_Services = new ServicesContainer(
3436
appMock.Object,
37+
new Mock<IToolbarAddIn>().Object,
3538
new Mock<CodeStack.SwEx.Common.Diagnostics.ILogger>().Object);
3639
}
37-
40+
3841
[TestMethod]
3942
public void DisplayCommandManagerView()
4043
{

MyToolbar.Tests/app.config

+12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
1111
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
1212
</dependentAssembly>
13+
<dependentAssembly>
14+
<assemblyIdentity name="SolidWorks.Interop.sldworks" publicKeyToken="7c4797c3e4eeac03" culture="neutral" />
15+
<bindingRedirect oldVersion="0.0.0.0-26.2.0.63" newVersion="26.2.0.63" />
16+
</dependentAssembly>
17+
<dependentAssembly>
18+
<assemblyIdentity name="SolidWorks.Interop.swpublished" publicKeyToken="89a97bdc5284e6d8" culture="neutral" />
19+
<bindingRedirect oldVersion="0.0.0.0-26.2.0.63" newVersion="26.2.0.63" />
20+
</dependentAssembly>
21+
<dependentAssembly>
22+
<assemblyIdentity name="SolidWorks.Interop.swconst" publicKeyToken="19f43e188e4269d8" culture="neutral" />
23+
<bindingRedirect oldVersion="0.0.0.0-26.2.0.63" newVersion="26.2.0.63" />
24+
</dependentAssembly>
1325
</assemblyBinding>
1426
</runtime>
1527
</configuration>

MyToolbar.Tests/packages.config

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Castle.Core" version="4.4.0" targetFramework="net461" />
4-
<package id="CodeStack.SwEx.AddIn" version="0.7.0" targetFramework="net461" />
5-
<package id="CodeStack.SwEx.Common" version="0.9.6" targetFramework="net461" />
4+
<package id="CodeStack.SwEx.AddIn" version="0.8.1" targetFramework="net461" />
5+
<package id="CodeStack.SwEx.Common" version="0.9.9" targetFramework="net461" />
66
<package id="Moq" version="4.11.0" targetFramework="net461" />
7+
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
78
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" />
89
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net461" />
910
</packages>

MyToolbar/Base/CommandGroupInfoSpec.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
//Product URL: https://www.codestack.net/labs/solidworks/my-toolbar/
66
//**********************
77

8+
using CodeStack.Sw.MyToolbar.Enums;
89
using CodeStack.Sw.MyToolbar.Structs;
910
using CodeStack.SwEx.AddIn.Core;
11+
using SolidWorks.Interop.sldworks;
1012
using System;
1113
using System.Linq;
1214

@@ -16,7 +18,7 @@ internal class CommandGroupInfoSpec : CommandGroupSpec
1618
{
1719
public event Action<CommandMacroInfo> MacroCommandClick;
1820

19-
internal CommandGroupInfoSpec(CommandGroupInfo info)
21+
internal CommandGroupInfoSpec(CommandGroupInfo info, ISldWorks app)
2022
{
2123
Id = info.Id;
2224
Title = info.Title;
@@ -25,10 +27,10 @@ internal CommandGroupInfoSpec(CommandGroupInfo info)
2527

2628
if (info.Commands != null)
2729
{
28-
Commands = info.Commands.Select(
30+
Commands = info.Commands.Where(c => c.Triggers.HasFlag(Triggers_e.Button)).Select(
2931
c =>
3032
{
31-
var spec = new CommandItemInfoSpec(c);
33+
var spec = new CommandItemInfoSpec(c, app);
3234
spec.MacroCommandClick += OnMacroCommandClick;
3335
return spec;
3436
}).ToArray();

MyToolbar/Base/CommandItemInfoSpec.cs

+19-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
//Product URL: https://www.codestack.net/labs/solidworks/my-toolbar/
66
//**********************
77

8+
using CodeStack.Sw.MyToolbar.Helpers;
89
using CodeStack.Sw.MyToolbar.Structs;
910
using CodeStack.SwEx.AddIn.Core;
11+
using CodeStack.SwEx.AddIn.Enums;
12+
using SolidWorks.Interop.sldworks;
1013
using System;
1114

1215
namespace CodeStack.Sw.MyToolbar.Base
@@ -16,10 +19,13 @@ internal class CommandItemInfoSpec : CommandSpec
1619
public event Action<CommandMacroInfo> MacroCommandClick;
1720

1821
private readonly CommandMacroInfo m_Info;
22+
private readonly ISldWorks m_App;
1923

20-
internal CommandItemInfoSpec(CommandMacroInfo info)
24+
internal CommandItemInfoSpec(CommandMacroInfo info, ISldWorks app)
2125
{
2226
m_Info = info;
27+
m_App = app;
28+
2329
UserId = info.Id;
2430
Title = info.Title;
2531
Tooltip = info.Description;
@@ -32,5 +38,17 @@ public override void OnClick()
3238
{
3339
MacroCommandClick?.Invoke(m_Info);
3440
}
41+
42+
public override CommandItemEnableState_e OnEnable()
43+
{
44+
if (m_Info.Scope.IsInScope(m_App))
45+
{
46+
return CommandItemEnableState_e.DeselectEnable;
47+
}
48+
else
49+
{
50+
return CommandItemEnableState_e.DeselectDisable;
51+
}
52+
}
3553
}
3654
}

0 commit comments

Comments
 (0)