Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

refactor(bar): extend `ViewModelBase` in view models

Lars Berger31255ce7d603
diff --git a/GlazeWM.Bar/BarViewModel.cs b/GlazeWM.Bar/BarViewModel.cs
index e9de941b..4a81ba62 100644
--- a/GlazeWM.Bar/BarViewModel.cs
+++ b/GlazeWM.Bar/BarViewModel.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
-using System.ComponentModel;
using System.Linq;
using System.Reactive.Linq;
using System.Windows.Threading;
@@ -14,9 +13,8 @@ using GlazeWM.Infrastructure.Bussing;
namespace GlazeWM.Bar
{
- public class BarViewModel : INotifyPropertyChanged
+ public class BarViewModel : ViewModelBase
{
- public event PropertyChangedEventHandler PropertyChanged;
public ObservableCollection<Workspace> Workspaces { get; set; } = new ObservableCollection<Workspace>();
public string Background { get; set; }
public string FontFamily { get; set; }
@@ -93,10 +91,5 @@ namespace GlazeWM.Bar
Workspaces.Add(workspace as Workspace);
});
}
-
- private void OnPropertyChanged(string propertyName)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
}
}
diff --git a/GlazeWM.Bar/Components/WorkspacesComponentViewModel.cs b/GlazeWM.Bar/Components/WorkspacesComponentViewModel.cs
index a39646bb..e5bab110 100644
--- a/GlazeWM.Bar/Components/WorkspacesComponentViewModel.cs
+++ b/GlazeWM.Bar/Components/WorkspacesComponentViewModel.cs
@@ -1,14 +1,14 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows.Threading;
+using GlazeWM.Bar.Common;
using GlazeWM.Domain.Monitors;
using GlazeWM.Domain.Workspaces;
namespace GlazeWM.Bar
{
- public class WorkspacesComponentViewModel : INotifyPropertyChanged
+ public class WorkspacesComponentViewModel : ViewModelBase
{
- public event PropertyChangedEventHandler PropertyChanged;
public ObservableCollection<Workspace> Workspaces { get; set; } = new ObservableCollection<Workspace>();
private readonly BarViewModel _barViewModel;
private readonly WorkspaceService _workspaceService;
@@ -36,10 +36,5 @@ namespace GlazeWM.Bar
Workspaces.Add(workspace as Workspace);
});
}
-
- private void OnPropertyChanged(string propertyName)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
}
}