Browse Source

Nullability and using fixes

pull/55/head
Ionite 1 year ago
parent
commit
bf263f141b
No known key found for this signature in database
  1. 1
      StabilityMatrix.Avalonia/Controls/BetterAdvancedImage.cs
  2. 1
      StabilityMatrix.Avalonia/Controls/BetterContentDialog.cs
  3. 1
      StabilityMatrix.Avalonia/Controls/FASymbolIconSource.cs
  4. 14
      StabilityMatrix.Avalonia/Controls/ProgressRing.cs
  5. 2
      StabilityMatrix.Avalonia/Controls/RefreshBadge.axaml
  6. 4
      StabilityMatrix.Avalonia/Controls/UserControlBase.cs
  7. 4
      StabilityMatrix.Avalonia/Converters/LaunchOptionConverter.cs
  8. 5
      StabilityMatrix.Avalonia/Converters/ValueConverterGroup.cs
  9. 5
      StabilityMatrix.Avalonia/DesignData/MockHttpClientFactory.cs
  10. 8
      StabilityMatrix.Avalonia/DesignData/MockLiteDbContext.cs
  11. 7
      StabilityMatrix.Avalonia/DialogHelper.cs
  12. 1
      StabilityMatrix.Avalonia/Models/ObservableDictionary.cs
  13. 4
      StabilityMatrix.Avalonia/Program.cs
  14. 3
      StabilityMatrix.Avalonia/Services/INotificationService.cs
  15. 3
      StabilityMatrix.Avalonia/Services/NavigationService.cs
  16. 2
      StabilityMatrix.Avalonia/Services/ServiceManager.cs
  17. 4
      StabilityMatrix.Avalonia/Styles/ProgressRing.axaml
  18. 3
      StabilityMatrix.Avalonia/ViewModels/CheckpointBrowserViewModel.cs
  19. 3
      StabilityMatrix.Avalonia/ViewModels/CheckpointFile.cs
  20. 4
      StabilityMatrix.Avalonia/ViewModels/CheckpointsPageViewModel.cs
  21. 1
      StabilityMatrix.Avalonia/ViewModels/Dialogs/InstallerViewModel.cs
  22. 3
      StabilityMatrix.Avalonia/ViewModels/Dialogs/LaunchOptionsViewModel.cs
  23. 2
      StabilityMatrix.Avalonia/ViewModels/LaunchPageViewModel.cs
  24. 2
      StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs
  25. 1
      StabilityMatrix.Avalonia/ViewModels/PageViewModelBase.cs
  26. 4
      StabilityMatrix.Avalonia/ViewModels/ProgressManagerViewModel.cs
  27. 3
      StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs
  28. 3
      StabilityMatrix.Avalonia/Views/CheckpointBrowserPage.axaml.cs
  29. 2
      StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml
  30. 3
      StabilityMatrix.Avalonia/Views/Dialogs/InstallerDialog.axaml
  31. 2
      StabilityMatrix.Avalonia/Views/Dialogs/LaunchOptionsDialog.axaml
  32. 3
      StabilityMatrix.Avalonia/Views/Dialogs/LaunchOptionsDialog.axaml.cs
  33. 1
      StabilityMatrix.Avalonia/Views/Dialogs/OneClickInstallDialog.axaml
  34. 3
      StabilityMatrix.Avalonia/Views/Dialogs/OneClickInstallDialog.axaml.cs
  35. 1
      StabilityMatrix.Avalonia/Views/Dialogs/SelectDataDirectoryDialog.axaml
  36. 1
      StabilityMatrix.Avalonia/Views/Dialogs/SelectModelVersionDialog.axaml
  37. 2
      StabilityMatrix.Avalonia/Views/Dialogs/UpdateDialog.axaml
  38. 3
      StabilityMatrix.Avalonia/Views/Dialogs/UpdateDialog.axaml.cs
  39. 2
      StabilityMatrix.Avalonia/Views/MainWindow.axaml
  40. 4
      StabilityMatrix.Avalonia/Views/ProgressManagerPage.axaml.cs
  41. 2
      StabilityMatrix.Core/Helper/Factory/IPackageFactory.cs
  42. 5
      StabilityMatrix.Core/Helper/Factory/PackageFactory.cs
  43. 8
      StabilityMatrix.Core/Models/Packages/BaseGitPackage.cs
  44. 2
      StabilityMatrix.Core/Models/Packages/BasePackage.cs

1
StabilityMatrix.Avalonia/Controls/BetterAdvancedImage.cs

@ -9,6 +9,7 @@ using Avalonia.Media;
namespace StabilityMatrix.Avalonia.Controls;
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public class BetterAdvancedImage : AdvancedImage
{
#region Reflection Shenanigans to access private parent fields

1
StabilityMatrix.Avalonia/Controls/BetterContentDialog.cs

@ -5,7 +5,6 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Interactivity;
using Avalonia.Styling;
using Avalonia.Threading;
using FluentAvalonia.UI.Controls;
using StabilityMatrix.Avalonia.ViewModels;

1
StabilityMatrix.Avalonia/Controls/FASymbolIconSource.cs

@ -1,6 +1,5 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Avalonia;

14
StabilityMatrix.Avalonia/Controls/ProgressRing.cs

@ -20,10 +20,10 @@ public class ProgressRing : RangeBase
AvaloniaProperty.Register<ProgressRing, bool>(nameof(PreserveAspect), true);
public static readonly StyledProperty<double> ValueAngleProperty =
AvaloniaProperty.Register<ProgressRing, double>(nameof(ValueAngle), 0);
AvaloniaProperty.Register<ProgressRing, double>(nameof(ValueAngle));
public static readonly StyledProperty<double> StartAngleProperty =
AvaloniaProperty.Register<ProgressRing, double>(nameof(StartAngle), 0);
AvaloniaProperty.Register<ProgressRing, double>(nameof(StartAngle));
public static readonly StyledProperty<double> EndAngleProperty =
AvaloniaProperty.Register<ProgressRing, double>(nameof(EndAngle), 360);
@ -105,26 +105,26 @@ public class ProgressRing : RangeBase
private static void OnMinimumPropertyChanged(ProgressRing sender, AvaloniaPropertyChangedEventArgs e)
{
sender.Minimum = (double)e.NewValue;
sender.Minimum = (double) e.NewValue!;
}
private static void OnMaximumPropertyChanged(ProgressRing sender, AvaloniaPropertyChangedEventArgs e)
{
sender.Maximum = (double)e.NewValue;
sender.Maximum = (double) e.NewValue!;
}
private static void OnValuePropertyChanged(ProgressRing sender, AvaloniaPropertyChangedEventArgs e)
{
sender.ValueAngle = ((double)e.NewValue - sender.Minimum) * (sender.EndAngle - sender.StartAngle) / (sender.Maximum - sender.Minimum);
sender.ValueAngle = ((double) e.NewValue! - sender.Minimum) * (sender.EndAngle - sender.StartAngle) / (sender.Maximum - sender.Minimum);
}
private static void OnStartAnglePropertyChanged(ProgressRing sender, AvaloniaPropertyChangedEventArgs e)
{
sender.StartAngle = (double)e.NewValue;
sender.StartAngle = (double) e.NewValue!;
}
private static void OnEndAnglePropertyChanged(ProgressRing sender, AvaloniaPropertyChangedEventArgs e)
{
sender.EndAngle = (double)e.NewValue;
sender.EndAngle = (double) e.NewValue!;
}
}

2
StabilityMatrix.Avalonia/Controls/RefreshBadge.axaml

@ -11,7 +11,7 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="StabilityMatrix.Avalonia.Controls.RefreshBadge">
<Grid>
<TextBlock Text="Test"></TextBlock>
<TextBlock Text="Test" />
<Button
BorderThickness="0"
Command="{Binding RefreshCommand}"

4
StabilityMatrix.Avalonia/Controls/UserControlBase.cs

@ -1,6 +1,4 @@
using System.Threading.Tasks;
using AsyncAwaitBestPractices;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Threading;
using StabilityMatrix.Avalonia.ViewModels;

4
StabilityMatrix.Avalonia/Converters/LaunchOptionConverter.cs

@ -24,7 +24,7 @@ public class LaunchOptionConverter : IValueConverter
{
return null;
}
return double.TryParse(value?.ToString(), out var doubleValue) ? doubleValue : 0;
return double.TryParse(value.ToString(), out var doubleValue) ? doubleValue : 0;
}
if (targetType == typeof(int?))
@ -33,7 +33,7 @@ public class LaunchOptionConverter : IValueConverter
{
return null;
}
return int.TryParse(value?.ToString(), out var intValue) ? intValue : 0;
return int.TryParse(value.ToString(), out var intValue) ? intValue : 0;
}
throw new ArgumentException("Unsupported type");

5
StabilityMatrix.Avalonia/Converters/ValueConverterGroup.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Avalonia.Data.Converters;
@ -7,12 +8,12 @@ namespace StabilityMatrix.Avalonia.Converters;
public class ValueConverterGroup : List<IValueConverter>, IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return this.Aggregate(value, (current, converter) => converter.Convert(current, targetType, parameter, culture));
}
public object ConvertBack(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo culture)
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}

5
StabilityMatrix.Avalonia/DesignData/MockHttpClientFactory.cs

@ -1,4 +1,5 @@
using System.Net.Http;
using System;
using System.Net.Http;
namespace StabilityMatrix.Avalonia.DesignData;
@ -6,6 +7,6 @@ public class MockHttpClientFactory : IHttpClientFactory
{
public HttpClient CreateClient(string name)
{
throw new System.NotImplementedException();
throw new NotImplementedException();
}
}

8
StabilityMatrix.Avalonia/DesignData/MockLiteDbContext.cs

@ -9,10 +9,10 @@ namespace StabilityMatrix.Avalonia.DesignData;
public class MockLiteDbContext : ILiteDbContext
{
public LiteDatabaseAsync Database { get; }
public ILiteCollectionAsync<CivitModel> CivitModels { get; }
public ILiteCollectionAsync<CivitModelVersion> CivitModelVersions { get; }
public ILiteCollectionAsync<CivitModelQueryCacheEntry> CivitModelQueryCache { get; }
public LiteDatabaseAsync Database => throw new NotImplementedException();
public ILiteCollectionAsync<CivitModel> CivitModels => throw new NotImplementedException();
public ILiteCollectionAsync<CivitModelVersion> CivitModelVersions => throw new NotImplementedException();
public ILiteCollectionAsync<CivitModelQueryCacheEntry> CivitModelQueryCache => throw new NotImplementedException();
public Task<(CivitModel?, CivitModelVersion?)> FindCivitModelFromFileHashAsync(string hashBlake3)
{
return Task.FromResult<(CivitModel?, CivitModelVersion?)>((null, null));

7
StabilityMatrix.Avalonia/DialogHelper.cs

@ -3,12 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Threading;
@ -75,7 +70,7 @@ public static class DialogHelper
stackPanel.Children.Add(textBox);
// When IsValid property changes, update invalid count and primary button
field.PropertyChanged += (sender, args) =>
field.PropertyChanged += (_, args) =>
{
if (args.PropertyName == nameof(TextBoxField.IsValid))
{

1
StabilityMatrix.Avalonia/Models/ObservableDictionary.cs

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
namespace StabilityMatrix.Avalonia.Models;

4
StabilityMatrix.Avalonia/Program.cs

@ -1,6 +1,6 @@
using Avalonia;
using System;
using System;
using System.Diagnostics.CodeAnalysis;
using Avalonia;
using Projektanker.Icons.Avalonia;
using Projektanker.Icons.Avalonia.FontAwesome;

3
StabilityMatrix.Avalonia/Services/INotificationService.cs

@ -1,5 +1,4 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls.Notifications;
using StabilityMatrix.Core.Models;

3
StabilityMatrix.Avalonia/Services/NavigationService.cs

@ -2,6 +2,7 @@
using Avalonia.Controls;
using FluentAvalonia.UI.Controls;
using FluentAvalonia.UI.Media.Animation;
using FluentAvalonia.UI.Navigation;
namespace StabilityMatrix.Avalonia.Services;
@ -34,7 +35,7 @@ public class NavigationService
public void NavigateFromContext(object dataContext, NavigationTransitionInfo transitionInfo = null)
{
_frame.NavigateFromObject(dataContext,
new FluentAvalonia.UI.Navigation.FrameNavigationOptions
new FrameNavigationOptions
{
IsNavigationStackEnabled = true,
TransitionInfoOverride = transitionInfo ?? new SuppressNavigationTransitionInfo()

2
StabilityMatrix.Avalonia/Services/ServiceManager.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
namespace StabilityMatrix.Avalonia.Services;
@ -77,6 +78,7 @@ public class ServiceManager<T>
/// <summary>
/// Get a view model instance
/// </summary>
[SuppressMessage("ReSharper", "InconsistentlySynchronizedField")]
public TService Get<TService>() where TService : T
{
if (instances.TryGetValue(typeof(TService), out var instance))

4
StabilityMatrix.Avalonia/Styles/ProgressRing.axaml

@ -7,10 +7,10 @@
<Design.PreviewWith>
<StackPanel>
<Border Padding="20">
<controls:ProgressRing StartAngle="90" EndAngle="270" Value="50" Foreground="Red" BorderThickness="5" Width="100" Height="100"></controls:ProgressRing>
<controls:ProgressRing StartAngle="90" EndAngle="270" Value="50" Foreground="Red" BorderThickness="5" Width="100" Height="100" />
</Border>
<Border Padding="20">
<controls:ProgressRing IsIndeterminate="True" BorderThickness="10" Width="100" Height="100"></controls:ProgressRing>
<controls:ProgressRing IsIndeterminate="True" BorderThickness="10" Width="100" Height="100" />
</Border>
</StackPanel>
</Design.PreviewWith>

3
StabilityMatrix.Avalonia/ViewModels/CheckpointBrowserViewModel.cs

@ -12,8 +12,8 @@ using Avalonia.Controls.Notifications;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using FluentAvalonia.UI.Controls;
using FluentAvalonia.UI.Data;
using NLog;
using Refit;
using StabilityMatrix.Avalonia.Services;
using StabilityMatrix.Avalonia.Views;
using StabilityMatrix.Core.Api;
@ -25,7 +25,6 @@ using StabilityMatrix.Core.Models;
using StabilityMatrix.Core.Models.Api;
using StabilityMatrix.Core.Models.Settings;
using StabilityMatrix.Core.Services;
using ApiException = Refit.ApiException;
using Symbol = FluentIcons.Common.Symbol;
using SymbolIconSource = FluentIcons.FluentAvalonia.SymbolIconSource;

3
StabilityMatrix.Avalonia/ViewModels/CheckpointFile.cs

@ -50,7 +50,7 @@ public partial class CheckpointFile : ViewModelBase
[ObservableProperty] private bool isLoading;
public string FileName => Path.GetFileName((string?) FilePath);
public string FileName => Path.GetFileName(FilePath);
public ObservableCollection<string> Badges { get; set; } = new();
@ -147,6 +147,7 @@ public partial class CheckpointFile : ViewModelBase
[RelayCommand]
private void OpenOnCivitAi()
{
if (ConnectedModel?.ModelId == null) return;
ProcessRunner.OpenUrl($"https://civitai.com/models/{ConnectedModel.ModelId}");
}

4
StabilityMatrix.Avalonia/ViewModels/CheckpointsPageViewModel.cs

@ -1,12 +1,10 @@
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using FluentAvalonia.UI.Controls;

1
StabilityMatrix.Avalonia/ViewModels/Dialogs/InstallerViewModel.cs

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

3
StabilityMatrix.Avalonia/ViewModels/Dialogs/LaunchOptionsViewModel.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using CommunityToolkit.Mvvm.ComponentModel;
using FuzzySharp;
using StabilityMatrix.Avalonia.Views.Dialogs;
using StabilityMatrix.Core.Attributes;
using StabilityMatrix.Core.Helper.Cache;
@ -50,7 +51,7 @@ public partial class LaunchOptionsViewModel : ContentDialogViewModelBase
Options = Array.Empty<LaunchOption>()
};
var extracted = FuzzySharp.Process
var extracted = Process
.ExtractTop(searchCard, Cards, c => c.Title.ToLowerInvariant());
var results = extracted
.Where(r => r.Score > 40)

2
StabilityMatrix.Avalonia/ViewModels/LaunchPageViewModel.cs

@ -5,9 +5,9 @@ using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Avalonia.Controls.Notifications;
using System.Threading.Tasks.Dataflow;
using Avalonia;
using Avalonia.Controls.Notifications;
using Avalonia.Controls.Primitives;
using Avalonia.Threading;
using AvaloniaEdit.Document;

2
StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs

@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls.Primitives;
using CommunityToolkit.Mvvm.ComponentModel;
using FluentAvalonia.UI.Controls;

1
StabilityMatrix.Avalonia/ViewModels/PageViewModelBase.cs

@ -1,5 +1,4 @@
using FluentAvalonia.UI.Controls;
using Symbol = FluentIcons.Common.Symbol;
namespace StabilityMatrix.Avalonia.ViewModels;

4
StabilityMatrix.Avalonia/ViewModels/ProgressManagerViewModel.cs

@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using CommunityToolkit.Mvvm.ComponentModel;
using FluentAvalonia.UI.Controls;
using FluentIcons.FluentAvalonia;
using Python.Runtime;
using StabilityMatrix.Avalonia.Models;
using StabilityMatrix.Avalonia.Views;
using StabilityMatrix.Core.Attributes;
using StabilityMatrix.Core.Helper;

3
StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs

@ -1,7 +1,6 @@
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Avalonia;
@ -54,7 +53,7 @@ public partial class SettingsViewModel : PageViewModelBase
// In case design / tests
if (Application.Current is null) return;
// Change theme
Application.Current!.RequestedThemeVariant = value switch
Application.Current.RequestedThemeVariant = value switch
{
"Dark" => ThemeVariant.Dark,
"Light" => ThemeVariant.Light,

3
StabilityMatrix.Avalonia/Views/CheckpointBrowserPage.axaml.cs

@ -1,5 +1,4 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Markup.Xaml;
using StabilityMatrix.Avalonia.Controls;
namespace StabilityMatrix.Avalonia.Views;

2
StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml

@ -4,8 +4,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
xmlns:idd="clr-namespace:Avalonia.Xaml.Interactions.DragAndDrop;assembly=Avalonia.Xaml.Interactions.DragAndDrop"
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
xmlns:system="clr-namespace:System;assembly=System.Runtime"

3
StabilityMatrix.Avalonia/Views/Dialogs/InstallerDialog.axaml

@ -3,11 +3,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
xmlns:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:md="https://github.com/whistyun/Markdown.Avalonia"
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
xmlns:dialogs="clr-namespace:StabilityMatrix.Avalonia.ViewModels.Dialogs"
xmlns:packages="clr-namespace:StabilityMatrix.Core.Models.Packages;assembly=StabilityMatrix.Core"
xmlns:models="clr-namespace:StabilityMatrix.Core.Models;assembly=StabilityMatrix.Core"

2
StabilityMatrix.Avalonia/Views/Dialogs/LaunchOptionsDialog.axaml

@ -2,14 +2,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels"
xmlns:dialogs="clr-namespace:StabilityMatrix.Avalonia.ViewModels.Dialogs"
xmlns:models="clr-namespace:StabilityMatrix.Core.Models;assembly=StabilityMatrix.Core"
xmlns:converters="clr-namespace:StabilityMatrix.Avalonia.Converters"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
d:DataContext="{x:Static mocks:DesignData.LaunchOptionsViewModel}"
x:DataType="dialogs:LaunchOptionsViewModel"
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="650"

3
StabilityMatrix.Avalonia/Views/Dialogs/LaunchOptionsDialog.axaml.cs

@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace StabilityMatrix.Avalonia.Views.Dialogs;

1
StabilityMatrix.Avalonia/Views/Dialogs/OneClickInstallDialog.axaml

@ -5,7 +5,6 @@
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
xmlns:dialogs="clr-namespace:StabilityMatrix.Avalonia.ViewModels.Dialogs"
xmlns:designData="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:fa="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:packages="clr-namespace:StabilityMatrix.Core.Models.Packages;assembly=StabilityMatrix.Core"
mc:Ignorable="d" d:DesignWidth="700" d:DesignHeight="700"
x:DataType="dialogs:OneClickInstallViewModel"

3
StabilityMatrix.Avalonia/Views/Dialogs/OneClickInstallDialog.axaml.cs

@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace StabilityMatrix.Avalonia.Views.Dialogs;

1
StabilityMatrix.Avalonia/Views/Dialogs/SelectDataDirectoryDialog.axaml

@ -6,7 +6,6 @@
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
d:DataContext="{x:Static mocks:DesignData.SelectDataDirectoryViewModel}"
x:DataType="dialogs:SelectDataDirectoryViewModel"
x:CompileBindings="True"

1
StabilityMatrix.Avalonia/Views/Dialogs/SelectModelVersionDialog.axaml

@ -6,7 +6,6 @@
xmlns:api="clr-namespace:StabilityMatrix.Core.Models.Api;assembly=StabilityMatrix.Core"
xmlns:dialogs="clr-namespace:StabilityMatrix.Avalonia.ViewModels.Dialogs"
xmlns:designData="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:controls1="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="dialogs:SelectModelVersionViewModel"
d:DataContext="{x:Static designData:DesignData.SelectModelVersionViewModel}"

2
StabilityMatrix.Avalonia/Views/Dialogs/UpdateDialog.axaml

@ -2,12 +2,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels"
xmlns:dialogs="clr-namespace:StabilityMatrix.Avalonia.ViewModels.Dialogs"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
xmlns:mdxaml="https://github.com/whistyun/Markdown.Avalonia.Tight"
d:DataContext="{x:Static mocks:DesignData.UpdateViewModel}"
x:DataType="dialogs:UpdateViewModel"

3
StabilityMatrix.Avalonia/Views/Dialogs/UpdateDialog.axaml.cs

@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace StabilityMatrix.Avalonia.Views.Dialogs;

2
StabilityMatrix.Avalonia/Views/MainWindow.axaml

@ -6,8 +6,6 @@
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
xmlns:process="clr-namespace:StabilityMatrix.Core.Processes;assembly=StabilityMatrix.Core"
xmlns:fluentAvalonia="clr-namespace:FluentIcons.FluentAvalonia;assembly=FluentIcons.FluentAvalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="550"
d:DataContext="{x:Static mocks:DesignData.MainWindowViewModel}"
x:DataType="vm:MainWindowViewModel"

4
StabilityMatrix.Avalonia/Views/ProgressManagerPage.axaml.cs

@ -1,6 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Markup.Xaml;
using StabilityMatrix.Avalonia.Controls;
namespace StabilityMatrix.Avalonia.Views;

2
StabilityMatrix.Core/Helper/Factory/IPackageFactory.cs

@ -5,5 +5,5 @@ namespace StabilityMatrix.Core.Helper.Factory;
public interface IPackageFactory
{
IEnumerable<BasePackage> GetAllAvailablePackages();
BasePackage? FindPackageByName(string packageName);
BasePackage? FindPackageByName(string? packageName);
}

5
StabilityMatrix.Core/Helper/Factory/PackageFactory.cs

@ -19,8 +19,9 @@ public class PackageFactory : IPackageFactory
return basePackages.Values;
}
public BasePackage? FindPackageByName(string packageName)
public BasePackage? FindPackageByName(string? packageName)
{
return basePackages.GetValueOrDefault(packageName);
return packageName == null ? null :
basePackages.GetValueOrDefault(packageName);
}
}

8
StabilityMatrix.Core/Models/Packages/BaseGitPackage.cs

@ -157,12 +157,10 @@ public abstract class BaseGitPackage : BasePackage
return Task.CompletedTask;
}
public override async Task<bool> CheckForUpdates(string installedPackageName)
public override async Task<bool> CheckForUpdates(InstalledPackage package)
{
var package =
SettingsManager.Settings.InstalledPackages.FirstOrDefault(x => x.DisplayName == installedPackageName);
var currentVersion = package?.PackageVersion;
if (package == null || string.IsNullOrWhiteSpace(currentVersion))
var currentVersion = package.PackageVersion;
if (string.IsNullOrWhiteSpace(currentVersion))
{
return false;
}

2
StabilityMatrix.Core/Models/Packages/BasePackage.cs

@ -23,7 +23,7 @@ public abstract class BasePackage
public abstract Task InstallPackage(IProgress<ProgressReport>? progress = null);
public abstract Task RunPackage(string installedPackagePath, string arguments);
public abstract Task Shutdown();
public abstract Task<bool> CheckForUpdates(string installedPackageName);
public abstract Task<bool> CheckForUpdates(InstalledPackage package);
public abstract Task<string> Update(InstalledPackage installedPackage, IProgress<ProgressReport>? progress = null);
public abstract Task<IOrderedEnumerable<Release>> GetReleaseTags();

Loading…
Cancel
Save