Consolidate NotifyPropertyChanged ViewModels

This commit is contained in:
pizzaboxer 2023-07-15 22:30:52 +01:00
parent eeeb33fed2
commit 77725ea5d7
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
10 changed files with 24 additions and 33 deletions

View File

@ -9,11 +9,8 @@ using Bloxstrap.Extensions;
namespace Bloxstrap.UI.ViewModels.Bootstrapper
{
public class BootstrapperDialogViewModel : INotifyPropertyChanged
public class BootstrapperDialogViewModel : NotifyPropertyChangedViewModel
{
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
private readonly IBootstrapperDialog _dialog;
public ICommand CancelInstallCommand => new RelayCommand(CancelInstall);

View File

@ -8,7 +8,7 @@ using System.Windows.Media.Imaging;
namespace Bloxstrap.UI.ViewModels.Bootstrapper
{
public class ByfronDialogViewModel : BootstrapperDialogViewModel, INotifyPropertyChanged
public class ByfronDialogViewModel : BootstrapperDialogViewModel
{
// Using dark theme for default values.
public ImageSource ByfronLogoLocation { get; set; } = new BitmapImage(new Uri("pack://application:,,,/Resources/BootstrapperStyles/ByfronDialog/ByfronLogoDark.jpg"));

View File

@ -15,11 +15,8 @@ using Bloxstrap.UI.Menu;
namespace Bloxstrap.UI.ViewModels.Menu
{
public class AppearanceViewModel : INotifyPropertyChanged
public class AppearanceViewModel : NotifyPropertyChangedViewModel
{
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
private readonly Page _page;
public ICommand PreviewBootstrapperCommand => new RelayCommand(PreviewBootstrapper);

View File

@ -12,11 +12,8 @@ using Bloxstrap.Models;
namespace Bloxstrap.UI.ViewModels.Menu
{
public class BehaviourViewModel : INotifyPropertyChanged
public class BehaviourViewModel : NotifyPropertyChangedViewModel
{
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
private bool _manualChannelEntry = !RobloxDeployment.SelectableChannels.Contains(App.Settings.Prop.Channel);
public BehaviourViewModel()

View File

@ -10,11 +10,8 @@ using CommunityToolkit.Mvvm.Input;
namespace Bloxstrap.UI.ViewModels.Menu
{
public class FastFlagsViewModel : INotifyPropertyChanged
public class FastFlagsViewModel : NotifyPropertyChangedViewModel
{
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public ICommand OpenClientSettingsCommand => new RelayCommand(OpenClientSettings);
private void OpenClientSettings() => Utilities.ShellExecute(Path.Combine(Directories.Modifications, "ClientSettings\\ClientAppSettings.json"));

View File

@ -6,11 +6,8 @@ using CommunityToolkit.Mvvm.Input;
namespace Bloxstrap.UI.ViewModels.Menu
{
public class InstallationViewModel : INotifyPropertyChanged
public class InstallationViewModel : NotifyPropertyChangedViewModel
{
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
private string _originalInstallLocation = App.BaseDirectory;
public ICommand BrowseInstallLocationCommand => new RelayCommand(BrowseInstallLocation);

View File

@ -8,11 +8,8 @@ using Bloxstrap.Models;
namespace Bloxstrap.UI.ViewModels.Menu
{
public class IntegrationsViewModel : INotifyPropertyChanged
public class IntegrationsViewModel : NotifyPropertyChangedViewModel
{
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public ICommand AddIntegrationCommand => new RelayCommand(AddIntegration);
public ICommand DeleteIntegrationCommand => new RelayCommand(DeleteIntegration);

View File

@ -16,11 +16,8 @@ using Bloxstrap.UI.Menu.Pages;
namespace Bloxstrap.UI.ViewModels.Menu
{
public class MainWindowViewModel : INotifyPropertyChanged
public class MainWindowViewModel : NotifyPropertyChangedViewModel
{
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
private readonly Window _window;
private readonly IDialogService _dialogService;
private readonly string _originalBaseDirectory = App.BaseDirectory; // we need this to check if the basedirectory changes

View File

@ -15,11 +15,8 @@ using CommunityToolkit.Mvvm.Input;
namespace Bloxstrap.UI.ViewModels.Menu
{
public class ModsViewModel : INotifyPropertyChanged
public class ModsViewModel : NotifyPropertyChangedViewModel
{
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
private void OpenModsFolder() => Process.Start("explorer.exe", Directories.Modifications);
private string _customFontLocation = Path.Combine(Directories.Modifications, "content\\fonts\\CustomFont.ttf");

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Bloxstrap.UI.ViewModels
{
public class NotifyPropertyChangedViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}