|
|
@ -5,26 +5,29 @@ using StabilityMatrix.Helper; |
|
|
|
using StabilityMatrix.Models; |
|
|
|
using StabilityMatrix.Models; |
|
|
|
using System.ComponentModel; |
|
|
|
using System.ComponentModel; |
|
|
|
using System.Diagnostics; |
|
|
|
using System.Diagnostics; |
|
|
|
using System.Dynamic; |
|
|
|
|
|
|
|
using System.IO; |
|
|
|
using System.IO; |
|
|
|
using System.IO.Compression; |
|
|
|
using System.IO.Compression; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
using StabilityMatrix.Models.Packages; |
|
|
|
using StabilityMatrix.Models.Packages; |
|
|
|
using System.Linq; |
|
|
|
using System.Linq; |
|
|
|
using System.Windows; |
|
|
|
using System.Windows; |
|
|
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel; |
|
|
|
using CommunityToolkit.Mvvm.Input; |
|
|
|
using CommunityToolkit.Mvvm.Input; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
|
|
|
|
|
|
|
|
namespace StabilityMatrix.ViewModels; |
|
|
|
namespace StabilityMatrix.ViewModels; |
|
|
|
|
|
|
|
|
|
|
|
public class InstallerViewModel : INotifyPropertyChanged |
|
|
|
public partial class InstallerViewModel : ObservableObject |
|
|
|
{ |
|
|
|
{ |
|
|
|
private readonly ILogger<InstallerViewModel> logger; |
|
|
|
private readonly ILogger<InstallerViewModel> logger; |
|
|
|
private readonly ISettingsManager settingsManager; |
|
|
|
private readonly ISettingsManager settingsManager; |
|
|
|
private string installedText; |
|
|
|
|
|
|
|
private int progressValue; |
|
|
|
private int progressValue; |
|
|
|
private bool isIndeterminate; |
|
|
|
|
|
|
|
private BasePackage selectedPackage; |
|
|
|
private BasePackage selectedPackage; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty] |
|
|
|
|
|
|
|
private string installedText; |
|
|
|
|
|
|
|
[ObservableProperty] |
|
|
|
|
|
|
|
private bool isIndeterminate; |
|
|
|
|
|
|
|
|
|
|
|
public InstallerViewModel(ILogger<InstallerViewModel> logger, ISettingsManager settingsManager) |
|
|
|
public InstallerViewModel(ILogger<InstallerViewModel> logger, ISettingsManager settingsManager) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -47,16 +50,9 @@ public class InstallerViewModel : INotifyPropertyChanged |
|
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<BasePackage> Packages { get; } |
|
|
|
public ObservableCollection<BasePackage> Packages { get; } |
|
|
|
|
|
|
|
|
|
|
|
public string InstalledText |
|
|
|
|
|
|
|
{ |
|
|
|
[ObservableProperty] |
|
|
|
get => installedText; |
|
|
|
private Visibility packageInstalledVisibility; |
|
|
|
private set |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (value == installedText) return; |
|
|
|
|
|
|
|
installedText = value; |
|
|
|
|
|
|
|
OnPropertyChanged(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int ProgressValue |
|
|
|
public int ProgressValue |
|
|
|
{ |
|
|
|
{ |
|
|
@ -70,17 +66,6 @@ public class InstallerViewModel : INotifyPropertyChanged |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public bool IsIndeterminate |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
get => isIndeterminate; |
|
|
|
|
|
|
|
set |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (value == isIndeterminate) return; |
|
|
|
|
|
|
|
isIndeterminate = value; |
|
|
|
|
|
|
|
OnPropertyChanged(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BasePackage SelectedPackage |
|
|
|
public BasePackage SelectedPackage |
|
|
|
{ |
|
|
|
{ |
|
|
|
get => selectedPackage; |
|
|
|
get => selectedPackage; |
|
|
@ -88,6 +73,11 @@ public class InstallerViewModel : INotifyPropertyChanged |
|
|
|
{ |
|
|
|
{ |
|
|
|
selectedPackage = value; |
|
|
|
selectedPackage = value; |
|
|
|
OnPropertyChanged(); |
|
|
|
OnPropertyChanged(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PackageInstalledVisibility = |
|
|
|
|
|
|
|
settingsManager.Settings.InstalledPackages.Any(p => p.Name == selectedPackage.Name) |
|
|
|
|
|
|
|
? Visibility.Visible |
|
|
|
|
|
|
|
: Visibility.Collapsed; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -222,9 +212,4 @@ public class InstallerViewModel : INotifyPropertyChanged |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged; |
|
|
|
public event PropertyChangedEventHandler PropertyChanged; |
|
|
|
|
|
|
|
|
|
|
|
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|