From bf6ba0ef8a38a0e651f472fdec28e5e676a472f4 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Fri, 14 Feb 2025 18:15:13 +0100 Subject: [PATCH] Fix multiple warnings and update libraries --- src/InvLock/Controls/OutlinedTextBlock.cs | 20 +++++++++---------- .../DataContexts/MainWindowDataContext.cs | 3 --- src/InvLock/InvLock.csproj | 4 ++-- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/InvLock/Controls/OutlinedTextBlock.cs b/src/InvLock/Controls/OutlinedTextBlock.cs index d603efb..f120129 100644 --- a/src/InvLock/Controls/OutlinedTextBlock.cs +++ b/src/InvLock/Controls/OutlinedTextBlock.cs @@ -10,7 +10,7 @@ public class OutlinedTextBlock : FrameworkElement, IAddChild { #region Private Fields - private Geometry _textGeometry; + private Geometry? _textGeometry; #endregion Private Fields @@ -38,12 +38,12 @@ public class OutlinedTextBlock : FrameworkElement, IAddChild FontStyle fontStyle = FontStyles.Normal; FontWeight fontWeight = FontWeights.Medium; - if (Bold == true) + if (Bold) { fontWeight = FontWeights.Bold; } - if (Italic == true) + if (Italic) { fontStyle = FontStyles.Italic; } @@ -55,13 +55,12 @@ public class OutlinedTextBlock : FrameworkElement, IAddChild FlowDirection.LeftToRight, new Typeface(Font, fontStyle, fontWeight, FontStretches.Normal), 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. _textGeometry = formattedText.BuildGeometry(new Point(0, 0)); - //set the size of the custome control based on the size of the text MinWidth = formattedText.Width; MinHeight = formattedText.Height; } @@ -73,7 +72,6 @@ public class OutlinedTextBlock : FrameworkElement, IAddChild protected override void OnRender(DrawingContext drawingContext) { CreateText(); - // Draw the outline based on the properties that are set. drawingContext.DrawGeometry(Fill, new Pen(Stroke, StrokeThickness), _textGeometry); } @@ -252,7 +250,7 @@ public class OutlinedTextBlock : FrameworkElement, IAddChild } /// - /// 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. /// public Brush Stroke { @@ -262,7 +260,7 @@ public class OutlinedTextBlock : FrameworkElement, IAddChild } /// - /// The stroke thickness of the font. + /// The stroke thickness of the font. /// 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 diff --git a/src/InvLock/DataContexts/MainWindowDataContext.cs b/src/InvLock/DataContexts/MainWindowDataContext.cs index 93c1d3d..2de8097 100644 --- a/src/InvLock/DataContexts/MainWindowDataContext.cs +++ b/src/InvLock/DataContexts/MainWindowDataContext.cs @@ -11,9 +11,6 @@ internal partial class MainWindowDataContext(Func lockWindowAccesso #if DEBUG public string Title => $"{App.AppName} - Dev {AppVersion}"; #else - - public event PropertyChangedEventHandler? PropertyChanged; - public string Title => $"{App.AppName} - {AppVersion}"; #endif diff --git a/src/InvLock/InvLock.csproj b/src/InvLock/InvLock.csproj index 8e16378..37ee1ae 100644 --- a/src/InvLock/InvLock.csproj +++ b/src/InvLock/InvLock.csproj @@ -18,8 +18,8 @@ - - + +