diff --git a/src/Nullinside.TwitchStreamingTools/Controls/Keybind.axaml b/src/Nullinside.TwitchStreamingTools/Controls/Keybind.axaml
index b5359e0..0c6c042 100644
--- a/src/Nullinside.TwitchStreamingTools/Controls/Keybind.axaml
+++ b/src/Nullinside.TwitchStreamingTools/Controls/Keybind.axaml
@@ -8,13 +8,13 @@
x:Class="Nullinside.TwitchStreamingTools.Controls.Keybind"
x:DataType="viewModels:KeybindViewModel">
-
-
Press a key...
diff --git a/src/Nullinside.TwitchStreamingTools/Controls/ViewModels/KeybindViewModel.cs b/src/Nullinside.TwitchStreamingTools/Controls/ViewModels/KeybindViewModel.cs
index 2796cec..507304e 100644
--- a/src/Nullinside.TwitchStreamingTools/Controls/ViewModels/KeybindViewModel.cs
+++ b/src/Nullinside.TwitchStreamingTools/Controls/ViewModels/KeybindViewModel.cs
@@ -1,8 +1,10 @@
using System.Reactive;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+
using Nullinside.TwitchStreamingTools.Models;
using Nullinside.TwitchStreamingTools.Services;
-using Nullinside.TwitchStreamingTools.ViewModels;
using ReactiveUI;
@@ -11,7 +13,7 @@ namespace Nullinside.TwitchStreamingTools.Controls.ViewModels;
///
/// Handles storing information required to visualize a keybind.
///
-public class KeybindViewModel : ViewModelBase {
+public partial class KeybindViewModel : ObservableObject {
///
/// The listener for keystrokes on the keyboard.
///
@@ -20,12 +22,12 @@ public class KeybindViewModel : ViewModelBase {
///
/// The keybind, if set.
///
- private Keybind? _keybind;
+ [ObservableProperty] private Keybind? _keybind;
///
/// True if listening for keystrokes, false otherwise.
///
- private bool _listening;
+ [ObservableProperty] private bool _listening;
///
/// Initializes a new instance of the class.
@@ -33,33 +35,12 @@ public class KeybindViewModel : ViewModelBase {
/// The listener for keystrokes on the keyboard.
public KeybindViewModel(IGlobalKeyPressService service) {
_service = service;
- ListenForKeystroke = ReactiveCommand.Create(StartListenKeystroke);
}
- ///
- /// The keybind.
- ///
- public Keybind? Keybind {
- get => _keybind;
- set => this.RaiseAndSetIfChanged(ref _keybind, value);
- }
-
- ///
- /// True if listening for keystrokes, false otherwise.
- ///
- public bool Listening {
- get => _listening;
- set => this.RaiseAndSetIfChanged(ref _listening, value);
- }
-
- ///
- /// Listens for keystrokes.
- ///
- public ReactiveCommand ListenForKeystroke { get; }
-
///
/// Starts listening for keystrokes.
///
+ [RelayCommand]
private void StartListenKeystroke() {
Listening = true;
_service.OnKeystroke -= OnKeystroke;
diff --git a/src/Nullinside.TwitchStreamingTools/Controls/ViewModels/TwoListViewModel.cs b/src/Nullinside.TwitchStreamingTools/Controls/ViewModels/TwoListViewModel.cs
index 1ba310f..caee3c0 100644
--- a/src/Nullinside.TwitchStreamingTools/Controls/ViewModels/TwoListViewModel.cs
+++ b/src/Nullinside.TwitchStreamingTools/Controls/ViewModels/TwoListViewModel.cs
@@ -1,16 +1,16 @@
using System;
using System.Collections.ObjectModel;
-using Nullinside.TwitchStreamingTools.ViewModels;
+using CommunityToolkit.Mvvm.ComponentModel;
-using ReactiveUI;
+using Nullinside.TwitchStreamingTools.ViewModels;
namespace Nullinside.TwitchStreamingTools.Controls.ViewModels;
///
/// Handles maintaining two lists and moving items between them.
///
-public class TwoListViewModel : ViewModelBase {
+public partial class TwoListViewModel : ViewModelBase {
///
/// The behavior to maintain when double clicking
///
@@ -26,44 +26,50 @@ public enum DoubleClickBehavior {
DELETE_FROM_LIST
}
- private string? _leftHeader;
+ ///
+ /// The header on the left list.
+ ///
+ [ObservableProperty] private string? _leftHeader;
///
/// The collection of items in the left list.
///
- private ObservableCollection _leftList;
+ [ObservableProperty] private ObservableCollection _leftList;
///
/// The method to call when an item in the left list is double clicked.
///
- private Action? _onLeftDoubleClick;
+ [ObservableProperty] private Action? _onLeftDoubleClick;
///
/// The method to call when an item in the right list is double clicked.
///
- private Action? _onRightDoubleClick;
+ [ObservableProperty] private Action? _onRightDoubleClick;
- private string? _rightHeader;
+ ///
+ /// The header on the right list.
+ ///
+ [ObservableProperty] private string? _rightHeader;
///
/// The collection of items in the right list.
///
- private ObservableCollection _rightList;
+ [ObservableProperty] private ObservableCollection _rightList;
///
/// The behavior of how to handle double clicking on items in the right list.
///
- private DoubleClickBehavior _rightListBehavior;
+ [ObservableProperty] private DoubleClickBehavior _rightListBehavior;
///
/// A value indicating whether the left list should be sorted.
///
- private bool _sortLeftList;
+ [ObservableProperty] private bool _sortLeftList;
///
/// A value indicating whether the right list should be sorted.
///
- private bool _sortRightList;
+ [ObservableProperty] private bool _sortRightList;
///
/// Initializes a new instance of the class.
@@ -75,78 +81,6 @@ public TwoListViewModel() {
OnRightDoubleClick += OnRightDoubleClicked;
}
- ///
- /// Gets or sets the collection of items in the left list.
- ///
- public ObservableCollection LeftList {
- get => _leftList;
- set => this.RaiseAndSetIfChanged(ref _leftList, value);
- }
-
- ///
- /// Gets or sets the collection of items in the right list.
- ///
- public Action? OnLeftDoubleClick {
- get => _onLeftDoubleClick;
- set => this.RaiseAndSetIfChanged(ref _onLeftDoubleClick, value);
- }
-
- ///
- /// Gets or sets the method to call when an item in the left list is double clicked.
- ///
- public Action? OnRightDoubleClick {
- get => _onRightDoubleClick;
- set => this.RaiseAndSetIfChanged(ref _onRightDoubleClick, value);
- }
-
- ///
- /// Gets or sets the method to call when an item in the right list is double clicked.
- ///
- public ObservableCollection RightList {
- get => _rightList;
- set => this.RaiseAndSetIfChanged(ref _rightList, value);
- }
-
- ///
- /// Gets or sets the behavior of how to handle double clicking on items in the right list.
- ///
- public DoubleClickBehavior RightListBehavior {
- get => _rightListBehavior;
- set => this.RaiseAndSetIfChanged(ref _rightListBehavior, value);
- }
-
- ///
- /// Gets or sets a value indicating whether the left list should be sorted.
- ///
- public bool SortLeftList {
- get => _sortLeftList;
- set => this.RaiseAndSetIfChanged(ref _sortLeftList, value);
- }
-
- ///
- /// Gets or sets a value indicating whether the right list should be sorted.
- ///
- public bool SortRightList {
- get => _sortRightList;
- set => this.RaiseAndSetIfChanged(ref _sortRightList, value);
- }
-
- ///
- /// The left header.
- ///
- public string? LeftHeader {
- get => _leftHeader;
- set => this.RaiseAndSetIfChanged(ref _leftHeader, value);
- }
-
- ///
- /// The right header.
- ///
- public string? RightHeader {
- get => _rightHeader;
- set => this.RaiseAndSetIfChanged(ref _rightHeader, value);
- }
-
///
/// Adds an item to the left list.
///
diff --git a/src/Nullinside.TwitchStreamingTools/Models/PhoneticWord.cs b/src/Nullinside.TwitchStreamingTools/Models/PhoneticWord.cs
index bdaec62..0587460 100644
--- a/src/Nullinside.TwitchStreamingTools/Models/PhoneticWord.cs
+++ b/src/Nullinside.TwitchStreamingTools/Models/PhoneticWord.cs
@@ -1,14 +1,14 @@
-using Nullinside.TwitchStreamingTools.ViewModels;
-using Nullinside.TwitchStreamingTools.ViewModels.Pages.SettingsView;
+using CommunityToolkit.Mvvm.ComponentModel;
-using ReactiveUI;
+using Nullinside.TwitchStreamingTools.ViewModels;
+using Nullinside.TwitchStreamingTools.ViewModels.Pages.SettingsView;
namespace Nullinside.TwitchStreamingTools.Models;
///
/// A representation of a word that needs to be pronounced phonetically.
///
-public class PhoneticWord : ViewModelBase {
+public partial class PhoneticWord : ViewModelBase {
///
/// The view model that owns this object.
///
@@ -17,12 +17,12 @@ public class PhoneticWord : ViewModelBase {
///
/// The phonetic pronunciation of the word.
///
- private string _phonetic;
+ [ObservableProperty] private string _phonetic;
///
/// The word to pronounce phonetically.
///
- private string _word;
+ [ObservableProperty] private string _word;
///
/// Initializes a new instance of the class.
@@ -36,33 +36,17 @@ public PhoneticWord(TtsPhoneticWordsViewModel viewModel, string word, string pho
_phonetic = phonetic;
}
- ///
- /// Gets or sets the phonetic pronunciation of the word.
- ///
- public string Phonetic {
- get => _phonetic;
- set => this.RaiseAndSetIfChanged(ref _phonetic, value);
- }
-
- ///
- /// Gets or sets the word to pronounce phonetically.
- ///
- public string Word {
- get => _word;
- set => this.RaiseAndSetIfChanged(ref _word, value);
- }
-
///
/// Deletes this word from the list.
///
public void DeletePhonetic() {
- _viewModel.DeletePhonetic(_word);
+ _viewModel.DeletePhonetic(Word);
}
///
/// Edits this word in the list.
///
public void EditPhonetic() {
- _viewModel.EditPhonetic(_word);
+ _viewModel.EditPhonetic(Word);
}
}
\ No newline at end of file
diff --git a/src/Nullinside.TwitchStreamingTools/Nullinside.TwitchStreamingTools.csproj b/src/Nullinside.TwitchStreamingTools/Nullinside.TwitchStreamingTools.csproj
index ed2bb2a..df6b169 100644
--- a/src/Nullinside.TwitchStreamingTools/Nullinside.TwitchStreamingTools.csproj
+++ b/src/Nullinside.TwitchStreamingTools/Nullinside.TwitchStreamingTools.csproj
@@ -60,6 +60,7 @@
+
@@ -67,8 +68,6 @@
-
-
diff --git a/src/Nullinside.TwitchStreamingTools/ViewModels/MainWindowViewModel.cs b/src/Nullinside.TwitchStreamingTools/ViewModels/MainWindowViewModel.cs
index 9843b62..0a4a475 100644
--- a/src/Nullinside.TwitchStreamingTools/ViewModels/MainWindowViewModel.cs
+++ b/src/Nullinside.TwitchStreamingTools/ViewModels/MainWindowViewModel.cs
@@ -4,6 +4,8 @@
using System.Linq;
using System.Reactive;
+using CommunityToolkit.Mvvm.ComponentModel;
+
using DynamicData;
using Microsoft.Extensions.DependencyInjection;
@@ -19,7 +21,7 @@ namespace Nullinside.TwitchStreamingTools.ViewModels;
///
/// The view model for the main UI.
///
-public class MainWindowViewModel : ViewModelBase {
+public partial class MainWindowViewModel : ViewModelBase {
///
/// The dependency injection service provider.
///
@@ -28,22 +30,22 @@ public class MainWindowViewModel : ViewModelBase {
///
/// A flag indicating whether the menu is open.
///
- private bool _isMenuOpen = true;
+ [ObservableProperty] private bool _isMenuOpen = true;
///
/// True if the application is updating, false otherwise.
///
- private bool _isUpdating;
+ [ObservableProperty] private bool _isUpdating;
///
/// The open page.
///
- private ViewModelBase _page;
+ [ObservableProperty] private ViewModelBase _page;
///
/// The currently selected page.
///
- private MenuItem _selectedMenuItem;
+ [ObservableProperty] private MenuItem _selectedMenuItem;
///
/// Initializes a new instance of the class.
@@ -77,43 +79,11 @@ public MainWindowViewModel(IServiceProvider provider) {
///
public ObservableCollection MenuItems { get; set; }
- ///
- /// A flag indicating whether the menu is open.
- ///
- public bool IsMenuOpen {
- get => _isMenuOpen;
- set => this.RaiseAndSetIfChanged(ref _isMenuOpen, value);
- }
-
///
/// Called when toggling the menu open and close.
///
public ReactiveCommand OnToggleMenu { get; }
- ///
- /// The open page.
- ///
- public ViewModelBase Page {
- get => _page;
- set => this.RaiseAndSetIfChanged(ref _page, value);
- }
-
- ///
- /// The currently selected page.
- ///
- public MenuItem SelectedMenuItem {
- get => _selectedMenuItem;
- set => this.RaiseAndSetIfChanged(ref _selectedMenuItem, value);
- }
-
- ///
- /// True if the application is updating, false otherwise.
- ///
- public bool IsUpdating {
- get => _isUpdating;
- set => this.RaiseAndSetIfChanged(ref _isUpdating, value);
- }
-
///
/// Initializes the menu items.
///
diff --git a/src/Nullinside.TwitchStreamingTools/ViewModels/NewVersionWindowViewModel.cs b/src/Nullinside.TwitchStreamingTools/ViewModels/NewVersionWindowViewModel.cs
index 0e6d839..eb1ee91 100644
--- a/src/Nullinside.TwitchStreamingTools/ViewModels/NewVersionWindowViewModel.cs
+++ b/src/Nullinside.TwitchStreamingTools/ViewModels/NewVersionWindowViewModel.cs
@@ -1,25 +1,25 @@
using System.Diagnostics;
using System.Threading.Tasks;
-using System.Windows.Input;
using Avalonia.Controls;
using Avalonia.Threading;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+
using Nullinside.Api.Common.Desktop;
using Nullinside.TwitchStreamingTools.Views;
-using ReactiveUI;
-
namespace Nullinside.TwitchStreamingTools.ViewModels;
///
/// The view model for the class.
///
-public class NewVersionWindowViewModel : ViewModelBase {
+public partial class NewVersionWindowViewModel : ViewModelBase {
///
/// True if updating the application currently, false otherwise.
///
- private bool _isUpdating;
+ [ObservableProperty] private bool _isUpdating;
///
/// The local version of the software.
@@ -34,15 +34,12 @@ public class NewVersionWindowViewModel : ViewModelBase {
///
/// The version of the application on the GitHub server.
///
- private string? _serverVersion;
+ [ObservableProperty] private string? _serverVersion;
///
/// Initializes a new instance of the class.
///
public NewVersionWindowViewModel() {
- UpdateSoftware = ReactiveCommand.Create(StartUpdateSoftware);
- CloseWindow = ReactiveCommand.Create(CloseWindowCommand);
-
// asynchronously determine the current version number.
Task.Factory.StartNew(async () => {
GithubLatestReleaseJson? version =
@@ -65,43 +62,19 @@ public string? LocalVersion {
set => _localVersion = value;
}
- ///
- /// The version of the software on the GitHub server.
- ///
- public string? ServerVersion {
- get => _serverVersion;
- set => this.RaiseAndSetIfChanged(ref _serverVersion, value);
- }
-
- ///
- /// True if updating the application currently, false otherwise.
- ///
- public bool IsUpdating {
- get => _isUpdating;
- set => this.RaiseAndSetIfChanged(ref _isUpdating, value);
- }
-
- ///
- /// A command to update the software.
- ///
- public ICommand UpdateSoftware { get; }
-
- ///
- /// A command to close the current window.
- ///
- public ICommand CloseWindow { get; }
-
///
/// A command to close the current window.
///
/// The reference to our own window.
- private void CloseWindowCommand(Window self) {
+ [RelayCommand]
+ private void CloseWindow(Window self) {
self.Close();
}
///
/// Launches the web browser at the new release page.
///
+ [RelayCommand]
private void StartUpdateSoftware() {
IsUpdating = true;
GitHubUpdateManager.PrepareUpdate()
diff --git a/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/AccountViewModel.cs b/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/AccountViewModel.cs
index 5e559d9..1f56455 100644
--- a/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/AccountViewModel.cs
+++ b/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/AccountViewModel.cs
@@ -3,12 +3,14 @@
using System.IO;
using System.Net.Http;
using System.Net.WebSockets;
-using System.Reactive;
using System.Threading;
using System.Threading.Tasks;
using Avalonia.Media.Imaging;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+
using log4net;
using Newtonsoft.Json;
@@ -19,8 +21,6 @@
using Nullinside.TwitchStreamingTools.Services;
using Nullinside.TwitchStreamingTools.Utilities;
-using ReactiveUI;
-
using TwitchLib.Api.Helix.Models.Users.GetUsers;
namespace Nullinside.TwitchStreamingTools.ViewModels.Pages;
@@ -28,7 +28,7 @@ namespace Nullinside.TwitchStreamingTools.ViewModels.Pages;
///
/// Handles binding your account to the application.
///
-public class AccountViewModel : PageViewModelBase, IDisposable {
+public partial class AccountViewModel : PageViewModelBase {
///
/// The path to the folder containing cached profile images.
///
@@ -58,27 +58,27 @@ public class AccountViewModel : PageViewModelBase, IDisposable {
///
/// True if currently downloading the logged in user's profile photo, false otherwise.
///
- private bool _downloadingProfileImage;
+ [ObservableProperty] private bool _downloadingProfileImage;
///
/// True if we have a valid OAuth token, false otherwise.
///
- private bool _hasValidOAuthToken;
+ [ObservableProperty] private bool _hasValidOAuthToken;
///
/// True if currently in the logging in process, false otherwise.
///
- private bool _loggingIn;
+ [ObservableProperty] private bool _loggingIn;
///
/// The profile image of the logged in user.
///
- private Bitmap? _profileImage;
+ [ObservableProperty] private Bitmap? _profileImage;
///
/// The authenticated user's twitch username.
///
- private string? _twitchUsername;
+ [ObservableProperty] private string? _twitchUsername;
///
/// Initializes a new instance of the class.
@@ -90,78 +90,20 @@ public AccountViewModel(ITwitchAccountService twitchAccountService, IConfigurati
_twitchAccountService.OnCredentialsStatusChanged += OnCredentialsStatusChanged;
_twitchAccountService.OnCredentialsChanged += OnCredentialsChanged;
_configuration = configuration;
- OnPerformLogin = ReactiveCommand.Create(PerformLogin);
- OnLogout = ReactiveCommand.Create(ClearCredentials);
// Set the initial state of the ui
HasValidOAuthToken = _twitchAccountService.CredentialsAreValid;
TwitchUsername = _twitchAccountService.TwitchUsername;
}
- ///
- /// The profile image of the logged in user.
- ///
- public Bitmap? ProfileImage {
- get => _profileImage;
- set => this.RaiseAndSetIfChanged(ref _profileImage, value);
- }
-
///
public override string IconResourceKey { get; } = "InprivateAccountRegular";
- ///
- /// Called when the user clicks the login button.
- ///
- public ReactiveCommand OnPerformLogin { get; }
-
- ///
- /// Called when logging out the current user.
- ///
- public ReactiveCommand OnLogout { get; }
-
- ///
- /// True if currently in the logging in process, false otherwise.
- ///
- public bool LoggingIn {
- get => _loggingIn;
- set => this.RaiseAndSetIfChanged(ref _loggingIn, value);
- }
-
- ///
- /// True if currently downloading the logged in user's profile photo, false otherwise.
- ///
- public bool DownloadingProfileImage {
- get => _downloadingProfileImage;
- set => this.RaiseAndSetIfChanged(ref _downloadingProfileImage, value);
- }
-
- ///
- /// True if we have a valid OAuth token, false otherwise.
- ///
- public bool HasValidOAuthToken {
- get => _hasValidOAuthToken;
- set => this.RaiseAndSetIfChanged(ref _hasValidOAuthToken, value);
- }
-
- ///
- /// The authenticated user's twitch username.
- ///
- public string? TwitchUsername {
- get => _twitchUsername;
- set => this.RaiseAndSetIfChanged(ref _twitchUsername, value);
- }
-
///
/// The application version number.
///
public string? Version => Constants.APP_VERSION;
- ///
- public void Dispose() {
- OnPerformLogin.Dispose();
- OnLogout.Dispose();
- }
-
///
/// Loads the profile image when the UI loads.
///
@@ -240,7 +182,8 @@ private void OnCredentialsStatusChanged(bool valid) {
///
/// Launches the computer's default browser to generate an OAuth token.
///
- private async void PerformLogin() {
+ [RelayCommand]
+ private async Task PerformLogin() {
LoggingIn = true;
try {
CancellationToken token = CancellationToken.None;
@@ -289,6 +232,7 @@ private async void PerformLogin() {
///
/// Clears the credentials out (logging out).
///
+ [RelayCommand]
private void ClearCredentials() {
_twitchAccountService.DeleteCredentials();
}
diff --git a/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/ChatViewModel.cs b/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/ChatViewModel.cs
index df2b8a2..fb9c627 100644
--- a/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/ChatViewModel.cs
+++ b/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/ChatViewModel.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
-using System.Reactive;
using System.Text;
using System.Threading.Tasks;
@@ -10,12 +9,13 @@
using Avalonia.Controls;
using Avalonia.Media;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+
using Nullinside.Api.Common.Twitch;
using Nullinside.TwitchStreamingTools.Models;
using Nullinside.TwitchStreamingTools.Utilities;
-using ReactiveUI;
-
using TwitchLib.Client.Events;
namespace Nullinside.TwitchStreamingTools.ViewModels.Pages;
@@ -23,7 +23,7 @@ namespace Nullinside.TwitchStreamingTools.ViewModels.Pages;
///
/// Handles settings up and viewing chat.
///
-public class ChatViewModel : PageViewModelBase, IDisposable {
+public partial class ChatViewModel : PageViewModelBase, IDisposable {
///
/// The application configuration;
///
@@ -42,22 +42,22 @@ public class ChatViewModel : PageViewModelBase, IDisposable {
///
/// The list of chat names selected in the list.
///
- private ObservableCollection _selectedTwitchChatNames = [];
+ [ObservableProperty] private ObservableCollection _selectedTwitchChatNames = [];
///
/// The current position of the cursor for the text box showing our chat logs, increment to move down.
///
- private int _textBoxCursorPosition;
+ [ObservableProperty] private int _textBoxCursorPosition;
///
/// The current twitch chat.
///
- private string? _twitchChat = string.Empty;
+ [ObservableProperty] private string? _twitchChat = string.Empty;
///
/// The current twitch chat name entered by the user.
///
- private string? _twitchChatName;
+ [ObservableProperty] private string? _twitchChatName;
///
/// Initializes a new instance of the class.
@@ -70,9 +70,6 @@ public ChatViewModel(ITwitchClientProxy twitchClient, IConfiguration configurati
_twitchClient = twitchClient;
_configuration = configuration;
- OnAddChat = ReactiveCommand.Create(OnAddChatCommand);
- OnRemoveChat = ReactiveCommand.Create(OnRemoveChatCommand);
-
Application.Current!.TryFindResource("DeleteRegular", out object? icon);
DeleteIcon = (StreamGeometry)icon!;
}
@@ -85,48 +82,6 @@ public ChatViewModel(ITwitchClientProxy twitchClient, IConfiguration configurati
///
public StreamGeometry DeleteIcon { get; set; }
- ///
- /// Called when adding a chat.
- ///
- public ReactiveCommand OnAddChat { get; }
-
- ///
- /// Called when removing a chat.
- ///
- public ReactiveCommand OnRemoveChat { get; }
-
- ///
- /// The current twitch chat name entered by the user.
- ///
- public string? TwitchChatName {
- get => _twitchChatName;
- set => this.RaiseAndSetIfChanged(ref _twitchChatName, value);
- }
-
- ///
- /// The current twitch chat.
- ///
- public string? TwitchChat {
- get => _twitchChat;
- set => this.RaiseAndSetIfChanged(ref _twitchChat, value);
- }
-
- ///
- /// The list of chat names selected in the list.
- ///
- public ObservableCollection ChatItems {
- get => _selectedTwitchChatNames;
- set => this.RaiseAndSetIfChanged(ref _selectedTwitchChatNames, value);
- }
-
- ///
- /// The current position of the cursor for the text box showing our chat logs, increment to move down.
- ///
- public int TextBoxCursorPosition {
- get => _textBoxCursorPosition;
- set => this.RaiseAndSetIfChanged(ref _textBoxCursorPosition, value);
- }
-
///
public void Dispose() {
foreach (TwitchChatConfiguration channel in _configuration.TwitchChats ?? []) {
@@ -136,23 +91,20 @@ public void Dispose() {
_twitchClient.RemoveMessageCallback(channel.TwitchChannel, OnChatMessage);
}
-
- OnAddChat.Dispose();
- OnRemoveChat.Dispose();
}
///
/// Handles adding a new chat to monitor.
///
- private void OnAddChatCommand() {
+ [RelayCommand]
+ private void AddChat() {
// Ensure we have a username
string? username = TwitchChatName?.Trim();
- if (string.IsNullOrWhiteSpace(username) || _selectedTwitchChatNames.Contains(username)) {
+ if (string.IsNullOrWhiteSpace(username) || SelectedTwitchChatNames.Contains(username)) {
return;
}
- // Add it to the list.
- _selectedTwitchChatNames.Add(username);
+ SelectedTwitchChatNames.Add(username);
// Add the callback, we don't need to wait for it to return it can run in the background.
_ = _twitchClient.AddMessageCallback(username, OnChatMessage);
@@ -162,7 +114,7 @@ private void OnAddChatCommand() {
// Update and write the configuration
_configuration.TwitchChats = (
- from user in _selectedTwitchChatNames
+ from user in SelectedTwitchChatNames
select new TwitchChatConfiguration {
TwitchChannel = user,
OutputDevice = Configuration.GetDefaultAudioDevice(),
@@ -178,16 +130,16 @@ from user in _selectedTwitchChatNames
/// Handles removing a chat we were monitoring.
///
/// The chat to remove.
- private void OnRemoveChatCommand(string channel) {
- // Remove it from the list
- _selectedTwitchChatNames.Remove(channel);
+ [RelayCommand]
+ private void RemoveChat(string channel) {
+ SelectedTwitchChatNames.Remove(channel);
// Remove the callback
_twitchClient.RemoveMessageCallback(channel, OnChatMessage);
// Update and write the configuration
_configuration.TwitchChats = (
- from user in _selectedTwitchChatNames
+ from user in SelectedTwitchChatNames
select new TwitchChatConfiguration {
TwitchChannel = user,
OutputDevice = Configuration.GetDefaultAudioDevice(),
@@ -204,7 +156,7 @@ from user in _selectedTwitchChatNames
///
/// The message received.
private void OnChatMessage(OnMessageReceivedArgs msg) {
- if (_selectedTwitchChatNames.Count > 1) {
+ if (SelectedTwitchChatNames.Count > 1) {
TwitchChat = (TwitchChat + FormatChatMessage(msg.ChatMessage.Username, msg.ChatMessage.Message, msg.GetTimestamp() ?? DateTime.UtcNow, msg.ChatMessage.Channel)).Trim();
}
else {
@@ -275,7 +227,7 @@ private void InitializeTwitchChatConnections() {
continue;
}
- _selectedTwitchChatNames.Add(channel.TwitchChannel);
+ SelectedTwitchChatNames.Add(channel.TwitchChannel);
Task.Run(() => _twitchClient.AddMessageCallback(channel.TwitchChannel, OnChatMessage));
}
}
diff --git a/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/PageViewModelBase.cs b/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/PageViewModelBase.cs
index bfb4b78..26d53e7 100644
--- a/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/PageViewModelBase.cs
+++ b/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/PageViewModelBase.cs
@@ -1,5 +1,7 @@
using System.Reactive;
+using CommunityToolkit.Mvvm.Input;
+
using ReactiveUI;
namespace Nullinside.TwitchStreamingTools.ViewModels.Pages;
@@ -7,13 +9,11 @@ namespace Nullinside.TwitchStreamingTools.ViewModels.Pages;
///
/// A base class for all pages of the application that are navigable through the left nav of the application.
///
-public abstract class PageViewModelBase : ViewModelBase {
+public abstract partial class PageViewModelBase : ViewModelBase {
///
/// Initializes a new instance of the class.
///
protected PageViewModelBase() {
- OnLoadedCommand = ReactiveCommand.Create(OnLoaded);
- OnUnloadedCommand = ReactiveCommand.Create(OnUnloaded);
}
///
@@ -21,19 +21,10 @@ protected PageViewModelBase() {
///
public abstract string IconResourceKey { get; }
- ///
- /// Called when the UI is loaded.
- ///
- public ReactiveCommand OnLoadedCommand { protected set; get; }
-
- ///
- /// Called when the UI is unloaded.
- ///
- public ReactiveCommand OnUnloadedCommand { protected set; get; }
-
///
/// Called then Ui is loaded.
///
+ [RelayCommand]
public virtual void OnLoaded() {
// Just exist to be overridden.
}
@@ -41,6 +32,7 @@ public virtual void OnLoaded() {
///
/// Called when the Ui is unloaded.
///
+ [RelayCommand]
public virtual void OnUnloaded() {
}
}
\ No newline at end of file
diff --git a/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/SettingsView/SettingsViewModel.cs b/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/SettingsView/SettingsViewModel.cs
index 68a9e83..7bf2ff7 100644
--- a/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/SettingsView/SettingsViewModel.cs
+++ b/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/SettingsView/SettingsViewModel.cs
@@ -1,10 +1,13 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.ComponentModel;
using System.Linq;
using System.Reactive;
using System.Speech.Synthesis;
+using CommunityToolkit.Mvvm.ComponentModel;
+
using Nullinside.TwitchStreamingTools.Controls.ViewModels;
using Nullinside.TwitchStreamingTools.Models;
using Nullinside.TwitchStreamingTools.Utilities;
@@ -16,7 +19,7 @@ namespace Nullinside.TwitchStreamingTools.ViewModels.Pages.SettingsView;
///
/// Handles binding your application settings.
///
-public class SettingsViewModel : PageViewModelBase {
+public partial class SettingsViewModel : PageViewModelBase {
///
/// The application configuration.
///
@@ -35,7 +38,7 @@ public class SettingsViewModel : PageViewModelBase {
///
/// The list of possible output devices that exist on the machine.
///
- private ObservableCollection _outputDevices;
+ [ObservableProperty] private ObservableCollection _outputDevices;
///
/// Change sound pitch by n semitones (-60 to +60 semitones)
@@ -70,17 +73,17 @@ public class SettingsViewModel : PageViewModelBase {
///
/// True if the advanced Text-to-Speech (TTS) settings are displayed.
///
- private bool _showAdvancedTts;
+ [ObservableProperty] private bool _showAdvancedTts;
///
/// The keybind for skipping all TTS messages.
///
- private KeybindViewModel _skipAllTtsKeyBinding;
+ [ObservableProperty] private KeybindViewModel _skipAllTtsKeyBinding;
///
/// The keybind for skipping TTS messages.
///
- private KeybindViewModel _skipTtsKeyBinding;
+ [ObservableProperty] private KeybindViewModel _skipTtsKeyBinding;
///
/// The speed (as a multiplicative).
@@ -95,17 +98,17 @@ public class SettingsViewModel : PageViewModelBase {
///
/// The view model for the phonetic words list.
///
- private TtsPhoneticWordsViewModel _ttsPhoneticWordsViewModel;
+ [ObservableProperty] private TtsPhoneticWordsViewModel _ttsPhoneticWordsViewModel;
///
/// The control responsible for managing the list of usernames to skip.
///
- private TtsSkipUsernamesViewModel _ttsSkipUsernamesViewModel;
+ [ObservableProperty] private TtsSkipUsernamesViewModel _ttsSkipUsernamesViewModel;
///
/// The list of installed TTS voices on the machine.
///
- private ObservableCollection _ttsVoices;
+ [ObservableProperty] private ObservableCollection _ttsVoices;
///
/// The volume to play the TTS messages at.
@@ -142,10 +145,10 @@ public SettingsViewModel(IConfiguration configuration, TtsPhoneticWordsViewModel
_sayUsernameWithMessage = _configuration.SayUsernameWithMessage;
_skipTtsKeyBinding = keybindViewModel;
_skipTtsKeyBinding.Keybind = _configuration.SkipTtsKey;
- _skipTtsKeyBinding.Changed.Subscribe(OnSkipTtsKeybindChanged);
+ _skipTtsKeyBinding.PropertyChanged += OnSkipTtsKeybindChanged;
_skipAllTtsKeyBinding = keybindAllViewModel;
_skipAllTtsKeyBinding.Keybind = _configuration.SkipAllTtsKey;
- _skipAllTtsKeyBinding.Changed.Subscribe(OnSkipAllTtsKeybindChanged);
+ _skipAllTtsKeyBinding.PropertyChanged += OnSkipAllTtsKeybindChanged;
ToggleAdvancedTtsCommand = ReactiveCommand.Create(() => ShowAdvancedTts = !ShowAdvancedTts);
@@ -174,21 +177,13 @@ public SettingsViewModel(IConfiguration configuration, TtsPhoneticWordsViewModel
///
public override string IconResourceKey { get; } = "SettingsRegular";
- ///
- /// The list of output devices available on the machine.
- ///
- public ObservableCollection OutputDevices {
- get => _outputDevices;
- set => this.RaiseAndSetIfChanged(ref _outputDevices, value);
- }
-
///
/// The selected output device that audio will be sent to.
///
public string? SelectedOutputDevice {
get => _selectedOutputDevice;
set {
- this.RaiseAndSetIfChanged(ref _selectedOutputDevice, value);
+ SetProperty(ref _selectedOutputDevice, value);
// Go through each twitch chat and update their property
foreach (TwitchChatConfiguration chat in _configuration.TwitchChats ?? []) {
@@ -199,21 +194,13 @@ public string? SelectedOutputDevice {
}
}
- ///
- /// The list of TTS voices available on the machine.
- ///
- public ObservableCollection TtsVoices {
- get => _ttsVoices;
- set => this.RaiseAndSetIfChanged(ref _ttsVoices, value);
- }
-
///
/// The selected TTS voice will be used.
///
public string? SelectedTtsVoice {
get => _selectedTtsVoice;
set {
- this.RaiseAndSetIfChanged(ref _selectedTtsVoice, value);
+ SetProperty(ref _selectedTtsVoice, value);
// Go through each twitch chat and update their property
foreach (TwitchChatConfiguration chat in _configuration.TwitchChats ?? []) {
@@ -231,7 +218,7 @@ public string? SelectedTtsVoice {
public uint TtsVolume {
get => _ttsVolume;
set {
- this.RaiseAndSetIfChanged(ref _ttsVolume, value);
+ SetProperty(ref _ttsVolume, value);
// Go through each twitch chat and update their property
foreach (TwitchChatConfiguration chat in _configuration.TwitchChats ?? []) {
@@ -242,29 +229,13 @@ public uint TtsVolume {
}
}
- ///
- /// Gets or sets the view model for the phonetic words list.
- ///
- public TtsPhoneticWordsViewModel TtsPhoneticWordsViewModel {
- get => _ttsPhoneticWordsViewModel;
- set => this.RaiseAndSetIfChanged(ref _ttsPhoneticWordsViewModel, value);
- }
-
- ///
- /// Gets or sets the view responsible for managing the list of usernames to skip.
- ///
- public TtsSkipUsernamesViewModel TtsSkipUsernamesViewModel {
- get => _ttsSkipUsernamesViewModel;
- set => this.RaiseAndSetIfChanged(ref _ttsSkipUsernamesViewModel, value);
- }
-
///
/// Change sound tempo by n percents (-95 to +5000 %)
///
public int Tempo {
get => _tempo;
set {
- this.RaiseAndSetIfChanged(ref _tempo, value);
+ SetProperty(ref _tempo, value);
if (_configuration.SoundStretchArgs != null) {
_configuration.SoundStretchArgs.Tempo = value;
_configuration.WriteConfiguration();
@@ -278,7 +249,7 @@ public int Tempo {
public int Pitch {
get => _pitch;
set {
- this.RaiseAndSetIfChanged(ref _pitch, value);
+ SetProperty(ref _pitch, value);
if (_configuration.SoundStretchArgs != null) {
_configuration.SoundStretchArgs.Pitch = value;
_configuration.WriteConfiguration();
@@ -292,7 +263,7 @@ public int Pitch {
public int Rate {
get => _rate;
set {
- this.RaiseAndSetIfChanged(ref _rate, value);
+ SetProperty(ref _rate, value);
if (_configuration.SoundStretchArgs != null) {
_configuration.SoundStretchArgs.Rate = value;
_configuration.WriteConfiguration();
@@ -306,7 +277,7 @@ public int Rate {
public int Bpm {
get => _bpm;
set {
- this.RaiseAndSetIfChanged(ref _bpm, value);
+ SetProperty(ref _bpm, value);
if (_configuration.SoundStretchArgs != null) {
_configuration.SoundStretchArgs.Bpm = value;
_configuration.WriteConfiguration();
@@ -320,7 +291,7 @@ public int Bpm {
public bool Quick {
get => _quick;
set {
- this.RaiseAndSetIfChanged(ref _quick, value);
+ SetProperty(ref _quick, value);
if (_configuration.SoundStretchArgs != null) {
_configuration.SoundStretchArgs.Quick = value;
_configuration.WriteConfiguration();
@@ -334,7 +305,7 @@ public bool Quick {
public bool AntiAliasingOff {
get => _antiAliasingOff;
set {
- this.RaiseAndSetIfChanged(ref _antiAliasingOff, value);
+ SetProperty(ref _antiAliasingOff, value);
if (_configuration.SoundStretchArgs != null) {
_configuration.SoundStretchArgs.AntiAliasingOff = value;
_configuration.WriteConfiguration();
@@ -348,7 +319,7 @@ public bool AntiAliasingOff {
public bool TurnOnSpeech {
get => _turnOnSpeech;
set {
- this.RaiseAndSetIfChanged(ref _turnOnSpeech, value);
+ SetProperty(ref _turnOnSpeech, value);
if (_configuration.SoundStretchArgs != null) {
_configuration.SoundStretchArgs.TurnOnSpeech = value;
_configuration.WriteConfiguration();
@@ -356,14 +327,6 @@ public bool TurnOnSpeech {
}
}
- ///
- /// True if we are displaying the advanced TTS settings, false otherwise.
- ///
- public bool ShowAdvancedTts {
- get => _showAdvancedTts;
- set => this.RaiseAndSetIfChanged(ref _showAdvancedTts, value);
- }
-
///
/// Called when the show advanced settings is clicked.
///
@@ -375,7 +338,7 @@ public bool ShowAdvancedTts {
public double Speed {
get => _speed;
set {
- this.RaiseAndSetIfChanged(ref _speed, value);
+ SetProperty(ref _speed, value);
// In terms of tempo, 50 is 100% faster (2x speed). Scaling that equation linearly, we get:
double tempo = (value - 1.0) * 50;
@@ -394,52 +357,38 @@ public double Speed {
public bool SayUsernameWithMessage {
get => _sayUsernameWithMessage;
set {
- this.RaiseAndSetIfChanged(ref _sayUsernameWithMessage, value);
+ SetProperty(ref _sayUsernameWithMessage, value);
_configuration.SayUsernameWithMessage = value;
_configuration.WriteConfiguration();
}
}
- ///
- /// The keybind to use to skip TTS messages.
- ///
- public KeybindViewModel SkipTtsKeyBinding {
- get => _skipTtsKeyBinding;
- set => this.RaiseAndSetIfChanged(ref _skipTtsKeyBinding, value);
- }
-
- ///
- /// The keybind to use to skip all TTS messages.
- ///
- public KeybindViewModel SkipAllTtsKeyBinding {
- get => _skipAllTtsKeyBinding;
- set => this.RaiseAndSetIfChanged(ref _skipAllTtsKeyBinding, value);
- }
-
///
/// Handles updating the configuration when the skip TTS keybind changes.
///
- /// The arguments about the properties that changed.
- private void OnSkipTtsKeybindChanged(IReactivePropertyChangedEventArgs args) {
- if (!nameof(_skipTtsKeyBinding.Keybind).Equals(args.PropertyName)) {
+ /// Unused sender argument.
+ /// The arguments about the properties that changed.
+ private void OnSkipTtsKeybindChanged(object? _, PropertyChangedEventArgs e) {
+ if (!nameof(SkipTtsKeyBinding.Keybind).Equals(e.PropertyName)) {
return;
}
- _configuration.SkipTtsKey = _skipTtsKeyBinding.Keybind;
+ _configuration.SkipTtsKey = SkipTtsKeyBinding.Keybind;
_configuration.WriteConfiguration();
}
///
/// Handles updating the configuration when the skip all TTS keybind changes.
///
- /// The arguments about the properties that changed.
- private void OnSkipAllTtsKeybindChanged(IReactivePropertyChangedEventArgs args) {
- if (!nameof(_skipAllTtsKeyBinding.Keybind).Equals(args.PropertyName)) {
+ /// Unused sender argument.
+ /// The arguments about the properties that changed.
+ private void OnSkipAllTtsKeybindChanged(object? _, PropertyChangedEventArgs e) {
+ if (!nameof(SkipAllTtsKeyBinding.Keybind).Equals(e.PropertyName)) {
return;
}
- _configuration.SkipAllTtsKey = _skipAllTtsKeyBinding.Keybind;
+ _configuration.SkipAllTtsKey = SkipAllTtsKeyBinding.Keybind;
_configuration.WriteConfiguration();
}
}
\ No newline at end of file
diff --git a/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/SettingsView/TtsPhoneticWordsViewModel.cs b/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/SettingsView/TtsPhoneticWordsViewModel.cs
index 38a3a4b..89b5a4c 100644
--- a/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/SettingsView/TtsPhoneticWordsViewModel.cs
+++ b/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/SettingsView/TtsPhoneticWordsViewModel.cs
@@ -3,16 +3,16 @@
using System.Collections.ObjectModel;
using System.Linq;
-using Nullinside.TwitchStreamingTools.Models;
+using CommunityToolkit.Mvvm.ComponentModel;
-using ReactiveUI;
+using Nullinside.TwitchStreamingTools.Models;
namespace Nullinside.TwitchStreamingTools.ViewModels.Pages.SettingsView;
///
/// The view responsible for maintaining the list of phonetic words.
///
-public class TtsPhoneticWordsViewModel : ViewModelBase {
+public partial class TtsPhoneticWordsViewModel : ViewModelBase {
///
/// The application configuration.
///
@@ -26,17 +26,17 @@ public class TtsPhoneticWordsViewModel : ViewModelBase {
///
/// The user entered phonetic pronunciation of the word.
///
- private string? _userEnteredPhonetic;
+ [ObservableProperty] private string? _userEnteredPhonetic;
///
/// The user entered word to pronounce phonetically.
///
- private string? _userEnteredWord;
+ [ObservableProperty] private string? _userEnteredWord;
///
/// The collection of all phonetic words.
///
- private ObservableCollection _wordsToPhonetics = new();
+ [ObservableProperty] private ObservableCollection _wordsToPhonetics = new();
///
/// Initializes a new instance of the class.
@@ -53,30 +53,6 @@ public TtsPhoneticWordsViewModel(IConfiguration configuration) {
}
}
- ///
- /// Gets or sets the user entered phonetic pronunciation of the word.
- ///
- public string? UserEnteredPhonetic {
- get => _userEnteredPhonetic;
- set => this.RaiseAndSetIfChanged(ref _userEnteredPhonetic, value);
- }
-
- ///
- /// Gets or sets the user entered word to pronounce phonetically.
- ///
- public string? UserEnteredWord {
- get => _userEnteredWord;
- set => this.RaiseAndSetIfChanged(ref _userEnteredWord, value);
- }
-
- ///
- /// Gets or sets the list of words/usernames and their phonetic pronunciations.
- ///
- public ObservableCollection WordsToPhonetics {
- get => _wordsToPhonetics;
- set => this.RaiseAndSetIfChanged(ref _wordsToPhonetics, value);
- }
-
///
/// Cancels the editing of the current word.
///
@@ -95,12 +71,12 @@ public void DeletePhonetic(string word) {
return;
}
- PhoneticWord? entry = _wordsToPhonetics.FirstOrDefault(w => word.Equals(w.Word));
+ PhoneticWord? entry = WordsToPhonetics.FirstOrDefault(w => word.Equals(w.Word));
if (null == entry) {
return;
}
- _wordsToPhonetics.Remove(entry);
+ WordsToPhonetics.Remove(entry);
RemoveFromConfig(word);
}
@@ -113,7 +89,7 @@ public void EditPhonetic(string word) {
return;
}
- PhoneticWord? entry = _wordsToPhonetics.FirstOrDefault(w => word.Equals(w.Word));
+ PhoneticWord? entry = WordsToPhonetics.FirstOrDefault(w => word.Equals(w.Word));
if (null == entry) {
return;
}
@@ -134,14 +110,13 @@ public void SaveEntry() {
// If we are not currently editing.
if (null == _editingPhonetic) {
// If the word already exists in the list and this would be a duplicate then change the existing word.
- PhoneticWord? existing = _wordsToPhonetics.FirstOrDefault(w => UserEnteredWord.Equals(w.Word, StringComparison.InvariantCultureIgnoreCase));
+ PhoneticWord? existing = WordsToPhonetics.FirstOrDefault(w => UserEnteredWord.Equals(w.Word, StringComparison.InvariantCultureIgnoreCase));
if (null != existing) {
existing.Word = UserEnteredWord;
existing.Phonetic = UserEnteredPhonetic;
}
else {
- // Otherwise, make a new word.
- _wordsToPhonetics.Add(new PhoneticWord(this, UserEnteredWord, UserEnteredPhonetic));
+ WordsToPhonetics.Add(new PhoneticWord(this, UserEnteredWord, UserEnteredPhonetic));
}
}
else {
diff --git a/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/SettingsView/TtsSkipUsernamesViewModel.cs b/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/SettingsView/TtsSkipUsernamesViewModel.cs
index 93a3e32..62b2f89 100644
--- a/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/SettingsView/TtsSkipUsernamesViewModel.cs
+++ b/src/Nullinside.TwitchStreamingTools/ViewModels/Pages/SettingsView/TtsSkipUsernamesViewModel.cs
@@ -4,14 +4,14 @@
using System.Linq;
using System.Timers;
+using CommunityToolkit.Mvvm.ComponentModel;
+
using log4net;
using Nullinside.TwitchStreamingTools.Controls.ViewModels;
using Nullinside.TwitchStreamingTools.Models;
using Nullinside.TwitchStreamingTools.Utilities;
-using ReactiveUI;
-
using TwitchLib.Api.Core.Exceptions;
using TwitchLib.Api.Helix.Models.Chat.GetChatters;
using TwitchLib.Api.Helix.Models.Users.GetUsers;
@@ -23,7 +23,7 @@ namespace Nullinside.TwitchStreamingTools.ViewModels.Pages.SettingsView;
///
/// Handles managing the list of users to skip in TTS.
///
-public class TtsSkipUsernamesViewModel : ViewModelBase {
+public partial class TtsSkipUsernamesViewModel : ViewModelBase {
///
/// The logger.
///
@@ -47,12 +47,12 @@ public class TtsSkipUsernamesViewModel : ViewModelBase {
///
/// The view model that handles the two column control.
///
- private TwoListViewModel _twoListViewModel;
+ [ObservableProperty] private TwoListViewModel _twoListViewModel;
///
/// The user entered username to add to the skip list.
///
- private string? _userToAdd;
+ [ObservableProperty] private string? _userToAdd;
///
/// Initializes a new instance of the class.
@@ -80,22 +80,6 @@ public TtsSkipUsernamesViewModel(IConfiguration configuration) {
_userListRefreshTimer.Start();
}
- ///
- /// Gets or sets the view model that handles the two column control.
- ///
- public TwoListViewModel TwoListViewModel {
- get => _twoListViewModel;
- set => this.RaiseAndSetIfChanged(ref _twoListViewModel, value);
- }
-
- ///
- /// Gets or sets the user entered username to add to the skip list.
- ///
- public string? UserToAdd {
- get => _userToAdd;
- set => this.RaiseAndSetIfChanged(ref _userToAdd, value);
- }
-
///
/// Handles adding the to the skip list.
///
diff --git a/src/Nullinside.TwitchStreamingTools/ViewModels/ViewModelBase.cs b/src/Nullinside.TwitchStreamingTools/ViewModels/ViewModelBase.cs
index cff65b3..7dbd399 100644
--- a/src/Nullinside.TwitchStreamingTools/ViewModels/ViewModelBase.cs
+++ b/src/Nullinside.TwitchStreamingTools/ViewModels/ViewModelBase.cs
@@ -1,9 +1,9 @@
-using ReactiveUI;
+using CommunityToolkit.Mvvm.ComponentModel;
namespace Nullinside.TwitchStreamingTools.ViewModels;
///
/// A base class for all view models.
///
-public class ViewModelBase : ReactiveObject {
+public class ViewModelBase : ObservableObject {
}
\ No newline at end of file
diff --git a/src/Nullinside.TwitchStreamingTools/Views/NewVersionWindow.axaml b/src/Nullinside.TwitchStreamingTools/Views/NewVersionWindow.axaml
index 06f5b81..0cdbc08 100644
--- a/src/Nullinside.TwitchStreamingTools/Views/NewVersionWindow.axaml
+++ b/src/Nullinside.TwitchStreamingTools/Views/NewVersionWindow.axaml
@@ -33,8 +33,8 @@
- Install New Version
- Install New Version
+
Close
diff --git a/src/Nullinside.TwitchStreamingTools/Views/Pages/AccountView.axaml b/src/Nullinside.TwitchStreamingTools/Views/Pages/AccountView.axaml
index 49c718f..8542f42 100644
--- a/src/Nullinside.TwitchStreamingTools/Views/Pages/AccountView.axaml
+++ b/src/Nullinside.TwitchStreamingTools/Views/Pages/AccountView.axaml
@@ -28,7 +28,7 @@
Login
@@ -47,7 +47,7 @@
User:
-
Logout
diff --git a/src/Nullinside.TwitchStreamingTools/Views/Pages/ChatView.axaml b/src/Nullinside.TwitchStreamingTools/Views/Pages/ChatView.axaml
index 47d5e1a..78fd766 100644
--- a/src/Nullinside.TwitchStreamingTools/Views/Pages/ChatView.axaml
+++ b/src/Nullinside.TwitchStreamingTools/Views/Pages/ChatView.axaml
@@ -29,12 +29,12 @@
Twitch Channel:
-
+
Twitch Channels
Chat Log
-
+
@@ -45,7 +45,7 @@