Skip to content

Commit 321504f

Browse files
Merge pull request #27 from RuntimeRascal/copilot/add-version-number-settings
Add version display to Settings window footer
2 parents ef3db1e + cb36983 commit 321504f

File tree

7 files changed

+122
-3
lines changed

7 files changed

+122
-3
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88

9+
## v1.0.10
10+
11+
### Added
12+
- **Version Display in Settings Window** - Shows current application version in footer
13+
- Version number appears in bottom-left corner of Settings window
14+
- Formatted as "Version X.Y.Z"
15+
- Retrieved from assembly information for accuracy
16+
- Helps users verify which version they're running
17+
18+
### Changed
19+
- Settings window footer now includes version information for better user awareness
20+
921
## v1.0.9
1022

1123
### Added

Installer/GhostDraw.Installer.wixproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="WixToolset.Sdk/4.0.5">
22
<PropertyGroup>
3-
<Version Condition="'$(Version)' == ''">1.0.9</Version>
3+
<Version Condition="'$(Version)' == ''">1.0.10</Version>
44
<OutputName>GhostDrawSetup-$(Version)</OutputName>
55
<OutputType>Package</OutputType>
66
<Platform>x64</Platform>

Src/GhostDraw/GhostDraw.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<UseWPF>true</UseWPF>
99
<UseWindowsForms>true</UseWindowsForms>
1010
<ApplicationIcon>Assets\favicon.ico</ApplicationIcon>
11-
<Version>1.0.9</Version>
11+
<Version>1.0.10</Version>
1212
<EnableWindowsTargeting>true</EnableWindowsTargeting>
1313
</PropertyGroup>
1414

Src/GhostDraw/ViewModels/SettingsViewModel.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Microsoft.Extensions.Logging;
22
using GhostDraw.Services;
3+
using System.Reflection;
34

45
namespace GhostDraw.ViewModels;
56

@@ -13,6 +14,8 @@ public class SettingsViewModel(
1314
LoggingSettingsService loggingSettings,
1415
ILoggerFactory loggerFactory)
1516
{
17+
private const string DefaultVersion = "v1.0.0";
18+
1619
/// <summary>
1720
/// Service for managing application settings (brush, hotkey, mode, etc.)
1821
/// </summary>
@@ -27,4 +30,16 @@ public class SettingsViewModel(
2730
/// Factory for creating loggers for child controls
2831
/// </summary>
2932
public ILoggerFactory LoggerFactory { get; } = loggerFactory;
33+
34+
/// <summary>
35+
/// Gets the application version from the assembly
36+
/// </summary>
37+
public string Version
38+
{
39+
get
40+
{
41+
var version = Assembly.GetExecutingAssembly().GetName().Version;
42+
return version != null ? $"v{version.Major}.{version.Minor}.{version.Build}" : DefaultVersion;
43+
}
44+
}
3045
}

Src/GhostDraw/Views/SettingsWindow.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,15 @@
187187
<ColumnDefinition Width="Auto"/>
188188
</Grid.ColumnDefinitions>
189189

190+
<!-- Version Number in Bottom-Left -->
191+
<TextBlock Grid.Column="0"
192+
Text="{Binding Version, StringFormat='GhostDraw {0}'}"
193+
FontSize="11"
194+
FontFamily="Consolas"
195+
Foreground="#606060"
196+
VerticalAlignment="Center"
197+
HorizontalAlignment="Left"/>
198+
190199
<Button Grid.Column="1"
191200
Content="RESET"
192201
Click="ResetButton_Click"
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
using GhostDraw.ViewModels;
2+
using GhostDraw.Services;
3+
using Microsoft.Extensions.Logging;
4+
using Microsoft.Extensions.Logging.Abstractions;
5+
using Moq;
6+
7+
namespace GhostDraw.Tests;
8+
9+
public class SettingsViewModelTests
10+
{
11+
private static SettingsViewModel CreateViewModel()
12+
{
13+
var mockLogger = new Mock<ILogger<AppSettingsService>>();
14+
var inMemoryStore = new InMemorySettingsStore();
15+
var appSettingsService = new AppSettingsService(mockLogger.Object, inMemoryStore);
16+
var loggingSettingsService = new LoggingSettingsService(appSettingsService);
17+
var loggerFactory = NullLoggerFactory.Instance;
18+
19+
return new SettingsViewModel(appSettingsService, loggingSettingsService, loggerFactory);
20+
}
21+
22+
[Fact]
23+
public void SettingsViewModel_Version_ShouldReturnValidVersionString()
24+
{
25+
// Arrange
26+
var viewModel = CreateViewModel();
27+
28+
// Act
29+
var version = viewModel.Version;
30+
31+
// Assert
32+
Assert.NotNull(version);
33+
Assert.NotEmpty(version);
34+
Assert.StartsWith("v", version); // Version should start with 'v'
35+
Assert.Matches(@"^v\d+\.\d+\.\d+$", version); // Should match pattern v{Major}.{Minor}.{Build}
36+
}
37+
38+
[Fact]
39+
public void SettingsViewModel_Version_ShouldContainOnlyNumbers()
40+
{
41+
// Arrange
42+
var viewModel = CreateViewModel();
43+
44+
// Act
45+
var version = viewModel.Version;
46+
var versionWithoutPrefix = version.TrimStart('v');
47+
var parts = versionWithoutPrefix.Split('.');
48+
49+
// Assert - Should have exactly 3 parts (Major.Minor.Build)
50+
Assert.Equal(3, parts.Length);
51+
Assert.All(parts, part => Assert.True(int.TryParse(part, out _)));
52+
}
53+
54+
[Fact]
55+
public void SettingsViewModel_AppSettings_ShouldNotBeNull()
56+
{
57+
// Arrange & Act
58+
var viewModel = CreateViewModel();
59+
60+
// Assert
61+
Assert.NotNull(viewModel.AppSettings);
62+
}
63+
64+
[Fact]
65+
public void SettingsViewModel_LoggingSettings_ShouldNotBeNull()
66+
{
67+
// Arrange & Act
68+
var viewModel = CreateViewModel();
69+
70+
// Assert
71+
Assert.NotNull(viewModel.LoggingSettings);
72+
}
73+
74+
[Fact]
75+
public void SettingsViewModel_LoggerFactory_ShouldNotBeNull()
76+
{
77+
// Arrange & Act
78+
var viewModel = CreateViewModel();
79+
80+
// Assert
81+
Assert.NotNull(viewModel.LoggerFactory);
82+
}
83+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ghost-draw",
3-
"version": "1.0.9",
3+
"version": "1.0.10",
44
"description": "Draw directly on your screen with a transparent overlay",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)