Skip to content

Commit

Permalink
switch to using buildprops for icon and readme on packages
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlm committed Dec 6, 2024
1 parent 5367c73 commit fec0387
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 44 deletions.
6 changes: 5 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@
<PropertyGroup>
<AvaloniaVersion>11.2.1</AvaloniaVersion>
</PropertyGroup>
</Project>
<ItemGroup Condition="'$(IsPackable)' != 'false'">
<None Include="$(SolutionDir)/../Icon.png" Pack="True" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
5 changes: 0 additions & 5 deletions src/Consolonia.Core/Consolonia.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,4 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup>
<None Include="../../Icon.png" Pack="True" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>
5 changes: 0 additions & 5 deletions src/Consolonia.Designer/Consolonia.Designer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,4 @@
<ProjectReference Include="..\Tools\Consolonia.PreviewHost\Consolonia.PreviewHost.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="../../Icon.png" Pack="True" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>
25 changes: 17 additions & 8 deletions src/Consolonia.Gallery/View/ControlsListView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Controls.Primitives;
using Avalonia.Styling;
using CommunityToolkit.Mvvm.ComponentModel;
using Consolonia.Gallery.Gallery;
using Consolonia.Themes;
Expand Down Expand Up @@ -88,16 +90,23 @@ private void Exit_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
this.Close();
}

private void ComboBox_SelectionChanged(object? sender, Avalonia.Controls.SelectionChangedEventArgs e)
private void ComboBox_SelectionChanged(object sender, Avalonia.Controls.SelectionChangedEventArgs e)
{
Styles[0] = ((ComboBoxItem)ThemeCombo.SelectedItem).Content.ToString() switch
if (ThemeCombo?.SelectedItem is not ComboBoxItem selectedItem ||
selectedItem.Content is not string themeName ||
!Enum.TryParse<Themes>(themeName, out var selectedTheme))
{
nameof (Themes.Material) => new MaterialTheme(),
nameof (Themes.Fluent) => new FluentTheme(),
nameof (Themes.TurboVision) => new TurboVisionTheme(),
nameof (Themes.TurboVisionDark) => new TurboVisionDarkTheme(),
nameof (Themes.TurboVisionBlack) => new TurboVisionBlackTheme(),
_ => throw new ArgumentOutOfRangeException()
return;
}

Styles[0] = selectedTheme switch
{
Themes.Material => new MaterialTheme(),
Themes.Fluent => new FluentTheme(),
Themes.TurboVision => new TurboVisionTheme(),
Themes.TurboVisionDark => new TurboVisionDarkTheme(),
Themes.TurboVisionBlack => new TurboVisionBlackTheme(),
_ => throw new ArgumentOutOfRangeException(nameof(selectedTheme))
};
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/Consolonia.NUnit/Consolonia.NUnit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,4 @@
<ProjectReference Include="..\Consolonia.Core\Consolonia.Core.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="../../Icon.png" Pack="True" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
</ProjectReference>
</ItemGroup>

<ItemGroup>
<None Include="../../Icon.png" Pack="True" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<!--
see https://josef.codes/dotnet-pack-include-referenced-projects/ for information on how
this is including Consolonia.GuiCS.dll as an asset and not a package references
Expand Down
5 changes: 0 additions & 5 deletions src/Consolonia.Themes/Consolonia.Themes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
<ProjectReference Include="..\Consolonia.Core\Consolonia.Core.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="../../Icon.png" Pack="True" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<Compile Update="Templates\Controls\DialogWrap.axaml.cs">
<DependentUpon>DialogWrap.axaml</DependentUpon>
Expand Down
5 changes: 0 additions & 5 deletions src/Consolonia/Consolonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,4 @@
<ProjectReference Include="..\Consolonia.Themes\Consolonia.Themes.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="../../Icon.png" Pack="True" PackagePath="\" />
<None Include="README.md" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
<ToolCommandName>Consolonia.PreviewHost</ToolCommandName>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\Icon.png" Pack="True" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Consolonia\Consolonia.csproj" />
</ItemGroup>
Expand Down

0 comments on commit fec0387

Please sign in to comment.