diff --git a/MelonLoader.Installer/ViewModels/DetailsViewModel.cs b/MelonLoader.Installer/ViewModels/DetailsViewModel.cs index 1aded3c..0520f4b 100644 --- a/MelonLoader.Installer/ViewModels/DetailsViewModel.cs +++ b/MelonLoader.Installer/ViewModels/DetailsViewModel.cs @@ -3,7 +3,6 @@ public class DetailsViewModel(GameModel game) : ViewModelBase { private bool _installing; - private bool _confirmation; private bool _offline; public GameModel Game => game; @@ -15,33 +14,20 @@ public bool Installing { _installing = value; OnPropertyChanged(); - OnPropertyChanged(nameof(CanInstall)); OnPropertyChanged(nameof(EnableSettings)); } } - public bool Confirmation - { - get => _confirmation; - set - { - _confirmation = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(CanInstall)); - } - } - public bool Offline { get => _offline; set { _offline = value; - OnPropertyChanged(nameof(Confirmation)); + OnPropertyChanged(); OnPropertyChanged(nameof(EnableSettings)); } } - public bool CanInstall => !Installing && !Confirmation; public bool EnableSettings => !Offline && !Installing; } diff --git a/MelonLoader.Installer/ViewModels/DialogBoxModel.cs b/MelonLoader.Installer/ViewModels/DialogBoxModel.cs new file mode 100644 index 0000000..897c853 --- /dev/null +++ b/MelonLoader.Installer/ViewModels/DialogBoxModel.cs @@ -0,0 +1,10 @@ +namespace MelonLoader.Installer.ViewModels; + +public class DialogBoxModel : ViewModelBase +{ + public required string Message { get; init; } + public string ConfirmText { get; init; } = "YES"; + public string CancelText { get; init; } = "NO"; + public bool IsError { get; init; } + public bool IsConfirmation { get; init; } +} diff --git a/MelonLoader.Installer/Views/DetailsView.axaml b/MelonLoader.Installer/Views/DetailsView.axaml index 662f8ad..1d799e3 100644 --- a/MelonLoader.Installer/Views/DetailsView.axaml +++ b/MelonLoader.Installer/Views/DetailsView.axaml @@ -40,7 +40,7 @@ IsVisible="{Binding Game.MLInstalled}" IsChecked="True">Keep mods and settings - + - + diff --git a/MelonLoader.Installer/Views/DetailsView.axaml.cs b/MelonLoader.Installer/Views/DetailsView.axaml.cs index 1b8b628..0daba6c 100644 --- a/MelonLoader.Installer/Views/DetailsView.axaml.cs +++ b/MelonLoader.Installer/Views/DetailsView.axaml.cs @@ -89,8 +89,6 @@ public void UpdateVersionInfo() if (Model == null || VersionCombobox.SelectedItem == null) return; - Model.Confirmation = false; - MelonIcon.Opacity = Model.Game.MLInstalled ? 1 : 0.3; if (Model.Game.MLVersion == null) @@ -139,7 +137,7 @@ private void OnInstallFinished(string? errorMessage) if (Model == null) return; - bool wasReinstall = Model.Game.MLInstalled; + var wasReinstall = Model.Game.MLInstalled; Model.Game.ValidateGame(); Model.Installing = false; @@ -152,7 +150,7 @@ private void OnInstallFinished(string? errorMessage) return; } - DialogBox.ShowNotice("SUCCESS!", $"{(wasReinstall ? "Reinstall" : "Install")} was Successful!"); + DialogBox.ShowNotice("Success!", $"{(wasReinstall ? "Reinstall" : "Install")} was Successful!"); } private void OpenDirHandler(object sender, RoutedEventArgs args) @@ -182,7 +180,7 @@ private void UninstallHandler(object sender, RoutedEventArgs args) } Model.Game.ValidateGame(); - DialogBox.ShowNotice("SUCCESS!", "Uninstall was Successful!"); + DialogBox.ShowNotice("Success!", "Uninstall was Successful!"); } private async void SelectZipHandler(object sender, TappedEventArgs args) diff --git a/MelonLoader.Installer/Views/DialogBox.axaml b/MelonLoader.Installer/Views/DialogBox.axaml index 6d2813b..8640116 100644 --- a/MelonLoader.Installer/Views/DialogBox.axaml +++ b/MelonLoader.Installer/Views/DialogBox.axaml @@ -2,8 +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:MelonLoader.Installer.ViewModels" mc:Ignorable="d" x:Class="MelonLoader.Installer.Views.DialogBox" + x:DataType="vm:DialogBoxModel" Title="NOTICE" Icon="/Assets/icon.ico" WindowStartupLocation="CenterScreen" @@ -14,14 +16,15 @@ SizeToContent="WidthAndHeight" RenderOptions.BitmapInterpolationMode="HighQuality"> - - - - + + + + + - - - + +