Skip to content

Commit 1f743a4

Browse files
committed
Feature: Add About dialog and application metadata enhancements.
1 parent 2848b6a commit 1f743a4

12 files changed

+158
-42
lines changed

CodeIngest.Desktop/App.axaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
44
xmlns:themes="clr-namespace:Material.Styles.Themes;assembly=Material.Styles"
55
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
6+
xmlns:viewModels="clr-namespace:CodeIngest.Desktop"
67
x:Class="CodeIngest.Desktop.App"
7-
RequestedThemeVariant="Default">
8-
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
8+
RequestedThemeVariant="Default"
9+
Name="Code Ingest"
10+
x:DataType="viewModels:AppViewModel">
911
<Application.Styles>
1012
<FluentTheme />
1113
<themes:MaterialTheme BaseTheme="Dark" PrimaryColor="BlueGrey" SecondaryColor="Lime" />
@@ -19,4 +21,10 @@
1921
<Setter Property="Focusable" Value="False" />
2022
</Style>
2123
</Application.Styles>
24+
25+
<NativeMenu.Menu>
26+
<NativeMenu>
27+
<NativeMenuItem Header="About Code Ingest" Command="{CompiledBinding AboutCommand}" />
28+
</NativeMenu>
29+
</NativeMenu.Menu>
2230
</Application>

CodeIngest.Desktop/App.axaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@
1111
using Avalonia;
1212
using Avalonia.Controls.ApplicationLifetimes;
1313
using Avalonia.Markup.Xaml;
14+
using CodeIngest.Desktop.Views;
1415
using CSharp.Core.UI;
1516

1617
namespace CodeIngest.Desktop;
1718

1819
public class App : Application
1920
{
21+
public App()
22+
{
23+
DataContext = new AppViewModel();
24+
}
25+
2026
public override void Initialize() =>
2127
AvaloniaXamlLoader.Load(this);
2228

CodeIngest.Desktop/AppViewModel.cs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Code authored by Dean Edis (DeanTheCoder).
2+
// Anyone is free to copy, modify, use, compile, or distribute this software,
3+
// either in source code form or as a compiled binary, for any non-commercial
4+
// purpose.
5+
//
6+
// If you modify the code, please retain this copyright header,
7+
// and consider contributing back to the repository or letting us know
8+
// about your modifications. Your contributions are valued!
9+
//
10+
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND.
11+
using System.Windows.Input;
12+
using Avalonia;
13+
using CodeIngest.Desktop.Views;
14+
using CSharp.Core.Commands;
15+
using CSharp.Core.Extensions;
16+
using CSharp.Core.ViewModels;
17+
18+
namespace CodeIngest.Desktop;
19+
20+
public class AppViewModel : ViewModelBase
21+
{
22+
public ICommand AboutCommand { get; }
23+
24+
public AppViewModel()
25+
{
26+
var isOpen = false;
27+
AboutCommand = new RelayCommand(
28+
_ =>
29+
{
30+
if (isOpen)
31+
return;
32+
var dialog = new AboutDialog();
33+
dialog.Opened += (_, _) => isOpen = true;
34+
dialog.Closed += (_, _) => isOpen = false;
35+
36+
var window = Application.Current?.GetMainWindow();
37+
if (window != null)
38+
dialog.ShowDialog(window);
39+
});
40+
}
41+
}

CodeIngest.Desktop/Assets/app.ico

32.2 KB
Binary file not shown.

CodeIngest.Desktop/CodeIngest.Desktop.csproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
<ApplicationManifest>app.manifest</ApplicationManifest>
88
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
99
<Company>Dean Edis (DeanTheCoder)</Company>
10+
<ApplicationIcon>Assets/app.ico</ApplicationIcon>
11+
<AssemblyName>CodeIngest</AssemblyName>
12+
<ApplicationTitle>Code Ingest</ApplicationTitle>
1013
</PropertyGroup>
1114

1215
<ItemGroup>
@@ -26,4 +29,19 @@
2629
<ProjectReference Include="..\CodeIngestLib\CodeIngestLib.csproj" />
2730
<ProjectReference Include="..\DTC.Core\CSharp.Core\CSharp.Core.csproj" />
2831
</ItemGroup>
32+
33+
<ItemGroup>
34+
<AvaloniaResource Include="Assets\app.ico" />
35+
</ItemGroup>
36+
37+
<ItemGroup>
38+
<Compile Update="Views\App.axaml.cs">
39+
<DependentUpon>App.axaml</DependentUpon>
40+
<SubType>Code</SubType>
41+
</Compile>
42+
<Compile Update="Views\MainWindow.axaml.cs">
43+
<DependentUpon>MainWindow.axaml</DependentUpon>
44+
<SubType>Code</SubType>
45+
</Compile>
46+
</ItemGroup>
2947
</Project>

CodeIngest.Desktop/MainWindow.axaml.cs

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Window xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:views="clr-namespace:CodeIngest.Desktop.Views"
6+
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
7+
x:Class="CodeIngest.Desktop.Views.AboutDialog"
8+
Icon="/Assets/app.ico"
9+
Title="About"
10+
MaxWidth="350" MaxHeight="240"
11+
CanResize="False">
12+
<views:AboutDialogContent />
13+
</Window>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Code authored by Dean Edis (DeanTheCoder).
2+
// Anyone is free to copy, modify, use, compile, or distribute this software,
3+
// either in source code form or as a compiled binary, for any non-commercial
4+
// purpose.
5+
//
6+
// If you modify the code, please retain this copyright header,
7+
// and consider contributing back to the repository or letting us know
8+
// about your modifications. Your contributions are valued!
9+
//
10+
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND.
11+
using Avalonia.Controls;
12+
13+
namespace CodeIngest.Desktop.Views;
14+
15+
public partial class AboutDialog : Window
16+
{
17+
public AboutDialog()
18+
{
19+
InitializeComponent();
20+
}
21+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<UserControl xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
6+
Background="Transparent"
7+
x:Class="CodeIngest.Desktop.Views.AboutDialogContent">
8+
<StackPanel>
9+
<StackPanel.Styles>
10+
<Style Selector="TextBlock">
11+
<Setter Property="HorizontalAlignment" Value="Center" />
12+
<Setter Property="FontSize" Value="12" />
13+
</Style>
14+
</StackPanel.Styles>
15+
16+
<Image Source="/Assets/app.ico" Width="90" Height="90" Margin="16" />
17+
18+
<TextBlock Text="Code Ingest" FontSize="30" />
19+
20+
<TextBlock x:Name="AppVersion" FontSize="12" />
21+
<TextBlock Text="Copyright © 2025 Dean Edis (DeanTheCoder)." Margin="0,16,0,0" />
22+
<TextBlock Text="All rights reserved." Margin="4" />
23+
</StackPanel>
24+
</UserControl>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Code authored by Dean Edis (DeanTheCoder).
2+
// Anyone is free to copy, modify, use, compile, or distribute this software,
3+
// either in source code form or as a compiled binary, for any non-commercial
4+
// purpose.
5+
//
6+
// If you modify the code, please retain this copyright header,
7+
// and consider contributing back to the repository or letting us know
8+
// about your modifications. Your contributions are valued!
9+
//
10+
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND.
11+
using Avalonia.Controls;
12+
13+
namespace CodeIngest.Desktop.Views;
14+
15+
public partial class AboutDialogContent : UserControl
16+
{
17+
public AboutDialogContent()
18+
{
19+
InitializeComponent();
20+
}
21+
}

0 commit comments

Comments
 (0)