Skip to content

Commit

Permalink
Consolidate NotifyPropertyChanged ViewModels
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaboxer committed Jul 15, 2023
1 parent eeeb33f commit 77725ea
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

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"));
Expand Down
5 changes: 1 addition & 4 deletions Bloxstrap/UI/ViewModels/Menu/AppearanceViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@

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);
Expand Down
5 changes: 1 addition & 4 deletions Bloxstrap/UI/ViewModels/Menu/BehaviourViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@

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()
Expand Down
5 changes: 1 addition & 4 deletions Bloxstrap/UI/ViewModels/Menu/FastFlagsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@

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"));
Expand Down
5 changes: 1 addition & 4 deletions Bloxstrap/UI/ViewModels/Menu/InstallationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@

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);
Expand Down
5 changes: 1 addition & 4 deletions Bloxstrap/UI/ViewModels/Menu/IntegrationsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@

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);

Expand Down
5 changes: 1 addition & 4 deletions Bloxstrap/UI/ViewModels/Menu/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@

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
Expand Down
5 changes: 1 addition & 4 deletions Bloxstrap/UI/ViewModels/Menu/ModsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@

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");
Expand Down
15 changes: 15 additions & 0 deletions Bloxstrap/UI/ViewModels/NotifyPropertyChangedViewModel.cs
Original file line number Diff line number Diff line change
@@ -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));
}
}

0 comments on commit 77725ea

Please sign in to comment.