Skip to content

Commit 90ed263

Browse files
committed
fix(WPF): add MahApps.Metro, ControlzEx, and XamlBehaviorsWpf as submodules and update references
- Completely fix conflict resource on different dll version - Introduced new submodules for MahApps.Metro, ControlzEx, and XamlBehaviorsWpf. - Updated Directory.Packages.props to remove direct MahApps.Metro reference and adjusted resource loading paths. - Refactored XAML files to use the new DevTools namespace for MahApps.Metro components. - Enhanced project structure in RevitDevTool.slnx to include new libraries.
1 parent 3b95b6e commit 90ed263

28 files changed

+188
-149
lines changed

.gitmodules

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[submodule "libs/XamlBehaviorsWpf"]
2+
path = libs/XamlBehaviorsWpf
3+
url = git@github.com:trgiangv/XamlBehaviorsWpf.git
4+
branch = devtools/main
5+
[submodule "libs/ControlzEx"]
6+
path = libs/ControlzEx
7+
url = git@github.com:trgiangv/ControlzEx.git
8+
branch = devtools/main
9+
[submodule "libs/MahApps.Metro"]
10+
path = libs/MahApps.Metro
11+
url = git@github.com:trgiangv/MahApps.Metro.git
12+
branch = devtools/main

Directory.Packages.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
<!--Console-->
2727
<PackageVersion Include="CliWrap" Version="3.10.0"/>
2828
<!--UI-->
29-
<PackageVersion Include="MahApps.Metro" Version="3.0.0-rc0529"/>
3029
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
3130
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.3800.47"/>
3231
<!--Build Tools-->

RevitDevTool.slnx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,42 @@
142142
</Project>
143143
<Project Path="source/RevitDevTool.Core/RevitDevTool.Core.csproj" />
144144
<Project Path="source/RevitDevTool/RevitDevTool.csproj" />
145+
<Folder Name="/Libs/">
146+
<Project Path="libs/MahApps.Metro/src/MahApps.Metro/MahApps.Metro.csproj">
147+
<BuildType Solution="Debug.Autodesk.2022|*" Project="Debug" />
148+
<BuildType Solution="Debug.Autodesk.2023|*" Project="Debug" />
149+
<BuildType Solution="Debug.Autodesk.2024|*" Project="Debug" />
150+
<BuildType Solution="Debug.Autodesk.2025|*" Project="Debug" />
151+
<BuildType Solution="Debug.Autodesk.2026|*" Project="Debug" />
152+
<BuildType Solution="Release.Autodesk.2022|*" Project="Release" />
153+
<BuildType Solution="Release.Autodesk.2023|*" Project="Release" />
154+
<BuildType Solution="Release.Autodesk.2024|*" Project="Release" />
155+
<BuildType Solution="Release.Autodesk.2025|*" Project="Release" />
156+
<BuildType Solution="Release.Autodesk.2026|*" Project="Release" />
157+
</Project>
158+
<Project Path="libs/ControlzEx/src/ControlzEx/ControlzEx.csproj">
159+
<BuildType Solution="Debug.Autodesk.2022|*" Project="Debug" />
160+
<BuildType Solution="Debug.Autodesk.2023|*" Project="Debug" />
161+
<BuildType Solution="Debug.Autodesk.2024|*" Project="Debug" />
162+
<BuildType Solution="Debug.Autodesk.2025|*" Project="Debug" />
163+
<BuildType Solution="Debug.Autodesk.2026|*" Project="Debug" />
164+
<BuildType Solution="Release.Autodesk.2022|*" Project="Release" />
165+
<BuildType Solution="Release.Autodesk.2023|*" Project="Release" />
166+
<BuildType Solution="Release.Autodesk.2024|*" Project="Release" />
167+
<BuildType Solution="Release.Autodesk.2025|*" Project="Release" />
168+
<BuildType Solution="Release.Autodesk.2026|*" Project="Release" />
169+
</Project>
170+
<Project Path="libs/XamlBehaviorsWpf/src/Microsoft.Xaml.Behaviors/Microsoft.Xaml.Behaviors.csproj">
171+
<BuildType Solution="Debug.Autodesk.2022|*" Project="Debug" />
172+
<BuildType Solution="Debug.Autodesk.2023|*" Project="Debug" />
173+
<BuildType Solution="Debug.Autodesk.2024|*" Project="Debug" />
174+
<BuildType Solution="Debug.Autodesk.2025|*" Project="Debug" />
175+
<BuildType Solution="Debug.Autodesk.2026|*" Project="Debug" />
176+
<BuildType Solution="Release.Autodesk.2022|*" Project="Release" />
177+
<BuildType Solution="Release.Autodesk.2023|*" Project="Release" />
178+
<BuildType Solution="Release.Autodesk.2024|*" Project="Release" />
179+
<BuildType Solution="Release.Autodesk.2025|*" Project="Release" />
180+
<BuildType Solution="Release.Autodesk.2026|*" Project="Release" />
181+
</Project>
182+
</Folder>
145183
</Solution>

libs/ControlzEx

Submodule ControlzEx added at d6fc4bc

libs/MahApps.Metro

Submodule MahApps.Metro added at ece6362

libs/XamlBehaviorsWpf

Submodule XamlBehaviorsWpf added at 0d6ba46

source/DevTools.Utilities/DevTools.Utilities.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="MahApps.Metro"/>
1514
<PackageReference Include="JetBrains.Annotations" PrivateAssets="All" />
1615
<PackageReference Include="PolySharp" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
1716
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Condition="$(TargetFramework.StartsWith('net4'))" />

source/DevTools.Utilities/ResourceUtils.cs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.ObjectModel;
22
using System.Windows;
3-
using MahApps.Metro.Controls;
43
// ReSharper disable ConvertToExtensionBlock
54

65
namespace DevTools.Utilities;
@@ -21,30 +20,19 @@ private static ResourceDictionary GetResource(string assemblyName, string resour
2120
return new ResourceDictionary { Source = uri };
2221
}
2322

24-
public static ResourceDictionary GetResource(Type type, string resourcePath)
25-
{
26-
var assembly = type.Assembly;
27-
var assemblyName = assembly.GetName();
28-
29-
var version = assemblyName.Version?.ToString(3);
30-
var uri = new Uri($"pack://application:,,,/{assemblyName.Name};v{version};component/{resourcePath}", UriKind.Absolute);
31-
32-
return new ResourceDictionary { Source = uri };
33-
}
34-
3523
public static ResourceDictionary GetMahAppsControls()
3624
{
37-
return _mahAppsControls ??= GetResource(typeof(HamburgerMenu), "Styles/Controls.xaml");
25+
return _mahAppsControls ??= GetResource("DevTools.MahApps.Metro", "Styles/Controls.xaml");
3826
}
3927

4028
public static ResourceDictionary GetMahAppsLightTheme()
4129
{
42-
return _mahAppsLightTheme ??= GetResource(typeof(HamburgerMenu), "Styles/Themes/Light.Blue.xaml");
30+
return _mahAppsLightTheme ??= GetResource("DevTools.MahApps.Metro", "Styles/Themes/Light.Blue.xaml");
4331
}
4432

4533
public static ResourceDictionary GetMahAppsDarkTheme()
4634
{
47-
return _mahAppsDarkTheme ??= GetResource(typeof(HamburgerMenu), "Styles/Themes/Dark.Blue.xaml");
35+
return _mahAppsDarkTheme ??= GetResource("DevTools.MahApps.Metro", "Styles/Themes/Dark.Blue.xaml");
4836
}
4937

5038
public static void RemoveIfNotNull(this Collection<ResourceDictionary> mergedDictionaries, ResourceDictionary? item)

source/RevitDevTool/RevitDevTool.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<PropertyGroup>
1212
<IsRepackable>true</IsRepackable>
1313
<RepackBinariesExcludes>
14-
MahApps.Metro.dll;
15-
ControlzEx.dll;
16-
Microsoft.Xaml.Behaviors.dll;
14+
DevTools.MahApps.Metro.dll;
15+
DevTools.ControlzEx.dll;
16+
DevTools.Microsoft.Xaml.Behaviors.dll;
1717
FSharp.Core.dll;
1818
</RepackBinariesExcludes>
1919
</PropertyGroup>
@@ -24,7 +24,6 @@
2424

2525
<!--UI-->
2626
<PackageReference Include="CommunityToolkit.Mvvm"/>
27-
<PackageReference Include="MahApps.Metro"/>
2827
<PackageReference Include="Microsoft.Web.WebView2" Condition="$(RevitVersion) &lt; 2024"/>
2928

3029
<!--Python-->
@@ -58,6 +57,7 @@
5857
</ItemGroup>
5958

6059
<ItemGroup>
60+
<ProjectReference Include="..\..\libs\MahApps.Metro\src\MahApps.Metro\MahApps.Metro.csproj" />
6161
<ProjectReference Include="..\DevTools.Utilities\DevTools.Utilities.csproj" />
6262
<ProjectReference Include="..\DevTools.Logging\DevTools.Logging.csproj" />
6363
<ProjectReference Include="..\RevitDevTool.McpParser\RevitDevTool.McpParser.csproj" />
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
22
<ResourceDictionary.MergedDictionaries>
3-
<ResourceDictionary Source="/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
4-
<ResourceDictionary Source="/MahApps.Metro;component/Styles/Controls.xaml" />
3+
<ResourceDictionary Source="/DevTools.MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
4+
<ResourceDictionary Source="/DevTools.MahApps.Metro;component/Styles/Controls.xaml" />
55
</ResourceDictionary.MergedDictionaries>
66
</ResourceDictionary>

0 commit comments

Comments
 (0)