Merge branch 'main' into develop

This commit is contained in:
Stone_Red
2025-02-14 18:15:35 +01:00
3 changed files with 11 additions and 16 deletions
+9 -11
View File
@@ -10,7 +10,7 @@ public class OutlinedTextBlock : FrameworkElement, IAddChild
{ {
#region Private Fields #region Private Fields
private Geometry _textGeometry; private Geometry? _textGeometry;
#endregion Private Fields #endregion Private Fields
@@ -38,12 +38,12 @@ public class OutlinedTextBlock : FrameworkElement, IAddChild
FontStyle fontStyle = FontStyles.Normal; FontStyle fontStyle = FontStyles.Normal;
FontWeight fontWeight = FontWeights.Medium; FontWeight fontWeight = FontWeights.Medium;
if (Bold == true) if (Bold)
{ {
fontWeight = FontWeights.Bold; fontWeight = FontWeights.Bold;
} }
if (Italic == true) if (Italic)
{ {
fontStyle = FontStyles.Italic; fontStyle = FontStyles.Italic;
} }
@@ -55,13 +55,12 @@ public class OutlinedTextBlock : FrameworkElement, IAddChild
FlowDirection.LeftToRight, FlowDirection.LeftToRight,
new Typeface(Font, fontStyle, fontWeight, FontStretches.Normal), new Typeface(Font, fontStyle, fontWeight, FontStretches.Normal),
FontSize, FontSize,
Brushes.Black // This brush does not matter since we use the geometry of the text. Brushes.Black, // This brush does not matter since we use the geometry of the text.
); 1);
// Build the geometry object that represents the text. // Build the geometry object that represents the text.
_textGeometry = formattedText.BuildGeometry(new Point(0, 0)); _textGeometry = formattedText.BuildGeometry(new Point(0, 0));
//set the size of the custome control based on the size of the text
MinWidth = formattedText.Width; MinWidth = formattedText.Width;
MinHeight = formattedText.Height; MinHeight = formattedText.Height;
} }
@@ -73,7 +72,6 @@ public class OutlinedTextBlock : FrameworkElement, IAddChild
protected override void OnRender(DrawingContext drawingContext) protected override void OnRender(DrawingContext drawingContext)
{ {
CreateText(); CreateText();
// Draw the outline based on the properties that are set.
drawingContext.DrawGeometry(Fill, new Pen(Stroke, StrokeThickness), _textGeometry); drawingContext.DrawGeometry(Fill, new Pen(Stroke, StrokeThickness), _textGeometry);
} }
@@ -252,7 +250,7 @@ public class OutlinedTextBlock : FrameworkElement, IAddChild
} }
/// <summary> /// <summary>
/// Specifies the brush to use for the stroke and optional hightlight of the formatted text. /// Specifies the brush to use for the stroke and optional highlight of the formatted text.
/// </summary> /// </summary>
public Brush Stroke public Brush Stroke
{ {
@@ -262,7 +260,7 @@ public class OutlinedTextBlock : FrameworkElement, IAddChild
} }
/// <summary> /// <summary>
/// The stroke thickness of the font. /// The stroke thickness of the font.
/// </summary> /// </summary>
public ushort StrokeThickness public ushort StrokeThickness
{ {
@@ -285,9 +283,9 @@ public class OutlinedTextBlock : FrameworkElement, IAddChild
{ {
} }
public void AddText(string value) public void AddText(string text)
{ {
Text = value; Text = text;
} }
#endregion DependencyProperties #endregion DependencyProperties
@@ -11,9 +11,6 @@ internal partial class MainWindowDataContext(Func<LockWindow?> lockWindowAccesso
#if DEBUG #if DEBUG
public string Title => $"{App.AppName} - Dev {AppVersion}"; public string Title => $"{App.AppName} - Dev {AppVersion}";
#else #else
public event PropertyChangedEventHandler? PropertyChanged;
public string Title => $"{App.AppName} - {AppVersion}"; public string Title => $"{App.AppName} - {AppVersion}";
#endif #endif
+2 -2
View File
@@ -18,8 +18,8 @@
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="CuteUtils" Version="1.0.0" /> <PackageReference Include="CuteUtils" Version="1.0.0" />
<PackageReference Include="SharpHook" Version="5.3.8" /> <PackageReference Include="SharpHook" Version="5.3.8" />
<PackageReference Include="WPF-UI" Version="3.0.5" /> <PackageReference Include="WPF-UI" Version="4.0.0" />
<PackageReference Include="WPF-UI.Tray" Version="3.0.5" /> <PackageReference Include="WPF-UI.Tray" Version="4.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>