From be99ef798a4d30a2e69083d1a5a0377d7075b9a1 Mon Sep 17 00:00:00 2001 From: Ionite Date: Tue, 11 Jul 2023 17:17:07 -0400 Subject: [PATCH] Link Install dialog to package manager --- .../ViewModels/PackageManagerViewModel.cs | 21 ++++++++++++++++--- .../Views/PackageManagerPage.axaml | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/StabilityMatrix.Avalonia/ViewModels/PackageManagerViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/PackageManagerViewModel.cs index 39b0cb24..c35ac00e 100644 --- a/StabilityMatrix.Avalonia/ViewModels/PackageManagerViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/PackageManagerViewModel.cs @@ -10,7 +10,9 @@ using FluentAvalonia.UI.Controls; using Microsoft.Extensions.Logging; using Polly; using StabilityMatrix.Avalonia.Services; +using StabilityMatrix.Avalonia.ViewModels.Dialogs; using StabilityMatrix.Avalonia.Views; +using StabilityMatrix.Avalonia.Views.Dialogs; using StabilityMatrix.Core.Attributes; using StabilityMatrix.Core.Helper; using StabilityMatrix.Core.Helper.Factory; @@ -31,17 +33,19 @@ public partial class PackageManagerViewModel : PageViewModelBase private readonly ISettingsManager settingsManager; private readonly IPackageFactory packageFactory; private readonly INotificationService notificationService; + private readonly ServiceManager dialogFactory; private const int MinutesToWaitForUpdateCheck = 60; public PackageManagerViewModel(ILogger logger, ISettingsManager settingsManager, IPackageFactory packageFactory, - INotificationService notificationService) + INotificationService notificationService, ServiceManager dialogFactory) { this.logger = logger; this.settingsManager = settingsManager; this.packageFactory = packageFactory; this.notificationService = notificationService; + this.dialogFactory = dialogFactory; ProgressText = string.Empty; InstallButtonText = "Launch"; @@ -319,8 +323,19 @@ public partial class PackageManagerViewModel : PageViewModelBase } [RelayCommand] - private async Task ShowInstallWindow() + private async Task ShowInstallDialog() { - + var viewModel = dialogFactory.Get(); + var dialog = new ContentDialog + { + IsPrimaryButtonEnabled = false, + IsSecondaryButtonEnabled = false, + Content = new InstallerDialog + { + DataContext = viewModel + } + }; + + await dialog.ShowAsync(); } } diff --git a/StabilityMatrix.Avalonia/Views/PackageManagerPage.axaml b/StabilityMatrix.Avalonia/Views/PackageManagerPage.axaml index 77fffcd1..20197774 100644 --- a/StabilityMatrix.Avalonia/Views/PackageManagerPage.axaml +++ b/StabilityMatrix.Avalonia/Views/PackageManagerPage.axaml @@ -37,7 +37,7 @@ Orientation="Horizontal">