Browse Source

Link Install dialog to package manager

pull/55/head
Ionite 1 year ago
parent
commit
be99ef798a
No known key found for this signature in database
  1. 19
      StabilityMatrix.Avalonia/ViewModels/PackageManagerViewModel.cs
  2. 2
      StabilityMatrix.Avalonia/Views/PackageManagerPage.axaml

19
StabilityMatrix.Avalonia/ViewModels/PackageManagerViewModel.cs

@ -10,7 +10,9 @@ using FluentAvalonia.UI.Controls;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Polly; using Polly;
using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.Services;
using StabilityMatrix.Avalonia.ViewModels.Dialogs;
using StabilityMatrix.Avalonia.Views; using StabilityMatrix.Avalonia.Views;
using StabilityMatrix.Avalonia.Views.Dialogs;
using StabilityMatrix.Core.Attributes; using StabilityMatrix.Core.Attributes;
using StabilityMatrix.Core.Helper; using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Helper.Factory; using StabilityMatrix.Core.Helper.Factory;
@ -31,17 +33,19 @@ public partial class PackageManagerViewModel : PageViewModelBase
private readonly ISettingsManager settingsManager; private readonly ISettingsManager settingsManager;
private readonly IPackageFactory packageFactory; private readonly IPackageFactory packageFactory;
private readonly INotificationService notificationService; private readonly INotificationService notificationService;
private readonly ServiceManager<ViewModelBase> dialogFactory;
private const int MinutesToWaitForUpdateCheck = 60; private const int MinutesToWaitForUpdateCheck = 60;
public PackageManagerViewModel(ILogger<PackageManagerViewModel> logger, public PackageManagerViewModel(ILogger<PackageManagerViewModel> logger,
ISettingsManager settingsManager, IPackageFactory packageFactory, ISettingsManager settingsManager, IPackageFactory packageFactory,
INotificationService notificationService) INotificationService notificationService, ServiceManager<ViewModelBase> dialogFactory)
{ {
this.logger = logger; this.logger = logger;
this.settingsManager = settingsManager; this.settingsManager = settingsManager;
this.packageFactory = packageFactory; this.packageFactory = packageFactory;
this.notificationService = notificationService; this.notificationService = notificationService;
this.dialogFactory = dialogFactory;
ProgressText = string.Empty; ProgressText = string.Empty;
InstallButtonText = "Launch"; InstallButtonText = "Launch";
@ -319,8 +323,19 @@ public partial class PackageManagerViewModel : PageViewModelBase
} }
[RelayCommand] [RelayCommand]
private async Task ShowInstallWindow() private async Task ShowInstallDialog()
{ {
var viewModel = dialogFactory.Get<InstallerViewModel>();
var dialog = new ContentDialog
{
IsPrimaryButtonEnabled = false,
IsSecondaryButtonEnabled = false,
Content = new InstallerDialog
{
DataContext = viewModel
}
};
await dialog.ShowAsync();
} }
} }

2
StabilityMatrix.Avalonia/Views/PackageManagerPage.axaml

@ -37,7 +37,7 @@
Orientation="Horizontal"> Orientation="Horizontal">
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<Button <Button
Command="{Binding ShowInstallWindowCommand}" Command="{Binding ShowInstallDialogCommand}"
Height="40" Height="40"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
Margin="0,0,0,16" Margin="0,0,0,16"

Loading…
Cancel
Save