From ff395a290dd227b3bf9726b16513471725d17e34 Mon Sep 17 00:00:00 2001 From: TrippSC2 Date: Sun, 13 Feb 2022 17:16:19 -0500 Subject: [PATCH] Reverted a change that was not meant to be committed. Fixed nullability on Serilog and ValueConverter classes. --- OpenTracker.Setup/OpenTracker.Setup.vdproj | 56 +++++++++---------- OpenTracker.Utils/Themes/ThemeManager.cs | 21 +------ OpenTracker/Models/AvaloniaSerilogSink.cs | 15 ++--- .../ValueConverters/BitmapValueConverter.cs | 4 +- 4 files changed, 41 insertions(+), 55 deletions(-) diff --git a/OpenTracker.Setup/OpenTracker.Setup.vdproj b/OpenTracker.Setup/OpenTracker.Setup.vdproj index 31fe9ce6..6795dea6 100644 --- a/OpenTracker.Setup/OpenTracker.Setup.vdproj +++ b/OpenTracker.Setup/OpenTracker.Setup.vdproj @@ -15,37 +15,37 @@ { "Entry" { - "MsmKey" = "8:_4913C9C404594CDBAE9F3117F7A8A99C" + "MsmKey" = "8:_0D875BFCC3AF4A1589F8C7E33357693B" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_975CA38B882C463AA889B74F563350D7" + "MsmKey" = "8:_4913C9C404594CDBAE9F3117F7A8A99C" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_9AE8180EC7284F8CAADB0EB749E44301" + "MsmKey" = "8:_5BB2FE7855FB42E1B6BD9385F7BE35CB" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_9E6FFC26C1B94A308AE37383659B05F8" + "MsmKey" = "8:_85CFBA2DE302467E93A2A484896EB594" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_BB8564D1E1364967B945056E0DE2B87D" + "MsmKey" = "8:_9E6FFC26C1B94A308AE37383659B05F8" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_D4C025E52F6D4B0CBD39712608FCF0CC" + "MsmKey" = "8:_B2E14E312E94461A96BDCEA89020A1F8" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } @@ -136,12 +136,12 @@ } "File" { - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_4913C9C404594CDBAE9F3117F7A8A99C" + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_0D875BFCC3AF4A1589F8C7E33357693B" { - "SourcePath" = "8:..\\OpenTracker\\triforce.ico" - "TargetName" = "8:triforce.ico" + "SourcePath" = "8:..\\OpenTracker\\bin\\Release\\net6.0\\Themes\\Dark.xaml" + "TargetName" = "8:Dark.xaml" "Tag" = "8:" - "Folder" = "8:_B21EA2C01C014AC99A33B72F50C26B5D" + "Folder" = "8:_11221B6B0EEF426CA5A7900FE825EF8D" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" @@ -156,12 +156,12 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_975CA38B882C463AA889B74F563350D7" + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_4913C9C404594CDBAE9F3117F7A8A99C" { - "SourcePath" = "8:..\\OpenTracker\\bin\\Release\\netcoreapp3.1\\Themes\\Dark.xaml" - "TargetName" = "8:Dark.xaml" + "SourcePath" = "8:..\\OpenTracker\\triforce.ico" + "TargetName" = "8:triforce.ico" "Tag" = "8:" - "Folder" = "8:_11221B6B0EEF426CA5A7900FE825EF8D" + "Folder" = "8:_B21EA2C01C014AC99A33B72F50C26B5D" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" @@ -176,12 +176,12 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9AE8180EC7284F8CAADB0EB749E44301" + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_5BB2FE7855FB42E1B6BD9385F7BE35CB" { - "SourcePath" = "8:..\\OpenTracker\\bin\\Release\\netcoreapp3.1\\Themes\\Default.xaml" - "TargetName" = "8:Default.xaml" + "SourcePath" = "8:..\\OpenTracker\\bin\\Release\\net6.0\\runtimes\\win7-x64\\native\\lzma.dll" + "TargetName" = "8:lzma.dll" "Tag" = "8:" - "Folder" = "8:_11221B6B0EEF426CA5A7900FE825EF8D" + "Folder" = "8:_C85AC8B5F1374419BA0D2192D2D360D5" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" @@ -196,9 +196,9 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_BB8564D1E1364967B945056E0DE2B87D" + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_85CFBA2DE302467E93A2A484896EB594" { - "SourcePath" = "8:..\\OpenTracker\\bin\\Release\\netcoreapp3.1\\OpenTracker.deps.json" + "SourcePath" = "8:..\\OpenTracker\\bin\\Release\\net6.0\\OpenTracker.deps.json" "TargetName" = "8:OpenTracker.deps.json" "Tag" = "8:" "Folder" = "8:_B21EA2C01C014AC99A33B72F50C26B5D" @@ -216,12 +216,12 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_D4C025E52F6D4B0CBD39712608FCF0CC" + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B2E14E312E94461A96BDCEA89020A1F8" { - "SourcePath" = "8:..\\OpenTracker\\bin\\Release\\netcoreapp3.1\\runtimes\\win7-x64\\native\\lzma.dll" - "TargetName" = "8:lzma.dll" + "SourcePath" = "8:..\\OpenTracker\\bin\\Release\\net6.0\\Themes\\Default.xaml" + "TargetName" = "8:Default.xaml" "Tag" = "8:" - "Folder" = "8:_C85AC8B5F1374419BA0D2192D2D360D5" + "Folder" = "8:_11221B6B0EEF426CA5A7900FE825EF8D" "Condition" = "8:" "Transitive" = "11:FALSE" "Vital" = "11:TRUE" @@ -347,15 +347,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:OpenTracker" - "ProductCode" = "8:{5EAF757E-FE14-4A69-B5DC-96006B64848A}" - "PackageCode" = "8:{C8BB1096-45C2-456B-BC96-24DA20F06E48}" + "ProductCode" = "8:{6DB73962-5FE7-42A2-8EA6-79DEF608AC05}" + "PackageCode" = "8:{DD037352-9411-41C5-A2B2-807061F138AC}" "UpgradeCode" = "8:{C98C2121-B4C5-473A-9B86-5407FEFFE8F1}" "AspNetVersion" = "8:2.0.50727.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:TRUE" - "ProductVersion" = "8:1.8.2" + "ProductVersion" = "8:1.8.3" "Manufacturer" = "8:OpenTracker" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:" @@ -897,7 +897,7 @@ { "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_9E6FFC26C1B94A308AE37383659B05F8" { - "SourcePath" = "8:..\\OpenTracker\\obj\\Release\\netcoreapp3.1\\apphost.exe" + "SourcePath" = "8:..\\OpenTracker\\obj\\Release\\net6.0\\apphost.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_B21EA2C01C014AC99A33B72F50C26B5D" diff --git a/OpenTracker.Utils/Themes/ThemeManager.cs b/OpenTracker.Utils/Themes/ThemeManager.cs index 1aa5a636..475dee5e 100644 --- a/OpenTracker.Utils/Themes/ThemeManager.cs +++ b/OpenTracker.Utils/Themes/ThemeManager.cs @@ -3,7 +3,6 @@ using System.Diagnostics; using System.IO; using System.Linq; -using System.Reactive.Linq; using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml.Styling; using Avalonia.Styling; @@ -37,13 +36,7 @@ public ThemeManager(ITheme.Factory themeFactory, IStyleHost app, string path) app.Styles.Insert(0, SelectedTheme.Style); var _ = this.WhenAnyValue(x => x.SelectedTheme) - .Where(x => x != null).Subscribe(x => - { - if (x?.Style != null) - { - app.Styles[0] = x.Style; - } - }); + .Subscribe(x => { app.Styles[0] = x.Style; }); } private List GetDefaultThemes() @@ -58,16 +51,10 @@ private List GetDefaultThemes() Source = new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default") }; - var citrus = new StyleInclude(new Uri("resm:Styles?assembly=Citrus.Avalonia.Sandbox")) - { - Source = new Uri("avares://Citrus.Avalonia/Citrus.xaml") - }; - return new List { _themeFactory("Dark", dark), - _themeFactory("Light", light), - _themeFactory("Citrus", citrus) + _themeFactory("Light", light) }; } @@ -109,9 +96,7 @@ private List LoadThemesFromFolder(string path) Debug.Write(e.ToString()); } - themes.AddRange(GetDefaultThemes()); - - return themes; + return themes.Count == 0 ? GetDefaultThemes() : themes; } public void LoadSelectedTheme(string file) diff --git a/OpenTracker/Models/AvaloniaSerilogSink.cs b/OpenTracker/Models/AvaloniaSerilogSink.cs index c88285c4..bfde3f8a 100644 --- a/OpenTracker/Models/AvaloniaSerilogSink.cs +++ b/OpenTracker/Models/AvaloniaSerilogSink.cs @@ -33,13 +33,13 @@ public bool IsEnabled(LogEventLevel level, string area) return _logger.IsEnabled((Serilog.Events.LogEventLevel)level); } - public void Log(LogEventLevel level, string area, object source, string messageTemplate) + public void Log(LogEventLevel level, string area, object? source, string messageTemplate) { Log(level, area, source, messageTemplate, Array.Empty()); } public void Log( - LogEventLevel level, string area, object source, string messageTemplate, T0 propertyValue0) + LogEventLevel level, string area, object? source, string messageTemplate, T0 propertyValue0) { if (propertyValue0 is null) { @@ -50,7 +50,7 @@ public void Log( } public void Log( - LogEventLevel level, string area, object source, string messageTemplate, T0 propertyValue0, + LogEventLevel level, string area, object? source, string messageTemplate, T0 propertyValue0, T1 propertyValue1) { if (propertyValue0 is null) @@ -70,7 +70,7 @@ public void Log( } public void Log( - LogEventLevel level, string area, object source, string messageTemplate, T0 propertyValue0, + LogEventLevel level, string area, object? source, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) { if (propertyValue0 is null) @@ -94,7 +94,7 @@ public void Log( }); } - public void Log(LogEventLevel level, string area, object source, string messageTemplate, params object[] propertyValues) + public void Log(LogEventLevel level, string area, object? source, string messageTemplate, params object?[] propertyValues) { for (var i = 0; i < propertyValues.Length; i++) { @@ -114,7 +114,7 @@ public void Log(LogEventLevel level, string area, object source, string messageT /// /// A string representing the visual hierarchy of the control as an object. /// - private static object GetHierarchy(object source) + private static object? GetHierarchy(object? source) { if (source is not IControl visual) { @@ -128,8 +128,9 @@ private static object GetHierarchy(object source) visualString }; - while ((visual = visual.Parent) is not null) + while (visual.Parent is not null) { + visual = visual.Parent; visualString = visual.ToString() ?? throw new NullReferenceException(); hierarchy.Insert(0, visualString); diff --git a/OpenTracker/ValueConverters/BitmapValueConverter.cs b/OpenTracker/ValueConverters/BitmapValueConverter.cs index cd124a77..c1cf3051 100644 --- a/OpenTracker/ValueConverters/BitmapValueConverter.cs +++ b/OpenTracker/ValueConverters/BitmapValueConverter.cs @@ -40,7 +40,7 @@ public class BitmapValueConverter : IValueConverter try { var assets = AvaloniaLocator.Current.GetService(); - return new Bitmap(assets.Open(uri)); + return new Bitmap(assets?.Open(uri)); } catch (FileNotFoundException ex) { @@ -54,7 +54,7 @@ public class BitmapValueConverter : IValueConverter } } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) { throw new Exception("All bindings should be one-way."); }