From 2009124f8f6f757eec397730155f6c1b7cab90f2 Mon Sep 17 00:00:00 2001 From: Philip Date: Fri, 5 Jan 2024 12:15:39 +0100 Subject: [PATCH] completed renaming new controls --- .../GameSettingsTabVisibilityConverter.cs | 2 +- .../UserControls/CommunityUserControl.xaml.cs | 2 +- .../GameDownloadUserControl.xaml.cs | 2 +- .../GameSettingsUserControl.xaml.cs | 18 +++++++------- ...rControl.xaml => GameViewUserControl.xaml} | 2 +- ...ol.xaml.cs => GameViewUserControl.xaml.cs} | 12 +++++----- ...erControl.xaml => InstallUserControl.xaml} | 2 +- ...rol.xaml.cs => InstallUserControl.xaml.cs} | 24 +++++++++---------- ...erControl.xaml => LibraryUserControl.xaml} | 4 ++-- ...rol.xaml.cs => LibraryUserControl.xaml.cs} | 18 +++++++------- ...eViewViewModel.cs => GameViewViewModel.cs} | 2 +- ...nstallViewModel.cs => InstallViewModel.cs} | 8 +++---- ...ibraryViewModel.cs => LibraryViewModel.cs} | 2 +- gamevault/ViewModels/MainWindowViewModel.cs | 10 ++++---- 14 files changed, 54 insertions(+), 54 deletions(-) rename gamevault/UserControls/{NewGameViewUserControl.xaml => GameViewUserControl.xaml} (99%) rename gamevault/UserControls/{NewGameViewUserControl.xaml.cs => GameViewUserControl.xaml.cs} (93%) rename gamevault/UserControls/{NewInstallUserControl.xaml => InstallUserControl.xaml} (99%) rename gamevault/UserControls/{NewInstallUserControl.xaml.cs => InstallUserControl.xaml.cs} (92%) rename gamevault/UserControls/{NewLibraryUserControl.xaml => LibraryUserControl.xaml} (99%) rename gamevault/UserControls/{NewLibraryUserControl.xaml.cs => LibraryUserControl.xaml.cs} (95%) rename gamevault/ViewModels/{NewGameViewViewModel.cs => GameViewViewModel.cs} (97%) rename gamevault/ViewModels/{NewInstallViewModel.cs => InstallViewModel.cs} (89%) rename gamevault/ViewModels/{NewLibraryViewModel.cs => LibraryViewModel.cs} (97%) diff --git a/gamevault/Converter/GameSettingsTabVisibilityConverter.cs b/gamevault/Converter/GameSettingsTabVisibilityConverter.cs index 6e8790d..27f0df2 100644 --- a/gamevault/Converter/GameSettingsTabVisibilityConverter.cs +++ b/gamevault/Converter/GameSettingsTabVisibilityConverter.cs @@ -20,7 +20,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn return Visibility.Collapsed; if (parameter.ToString() == "local") { - if (NewInstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ((Game)value).ID).Count() > 0) + if (InstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ((Game)value).ID).Count() > 0) { return Visibility.Visible; } diff --git a/gamevault/UserControls/CommunityUserControl.xaml.cs b/gamevault/UserControls/CommunityUserControl.xaml.cs index 13e2739..50adb8c 100644 --- a/gamevault/UserControls/CommunityUserControl.xaml.cs +++ b/gamevault/UserControls/CommunityUserControl.xaml.cs @@ -182,7 +182,7 @@ private void GameImage_MouseLeftButtonUp(object sender, System.Windows.Input.Mou MainWindowViewModel.Instance.AppBarText = "Cannot open unknown game"; return; } - MainWindowViewModel.Instance.SetActiveControl(new NewGameViewUserControl(((Progress)((FrameworkElement)sender).DataContext).Game)); + MainWindowViewModel.Instance.SetActiveControl(new GameViewUserControl(((Progress)((FrameworkElement)sender).DataContext).Game)); } private async void ReloadUser_Clicked(object sender, System.Windows.Input.MouseButtonEventArgs e) { diff --git a/gamevault/UserControls/GameDownloadUserControl.xaml.cs b/gamevault/UserControls/GameDownloadUserControl.xaml.cs index 3e184b6..39803fa 100644 --- a/gamevault/UserControls/GameDownloadUserControl.xaml.cs +++ b/gamevault/UserControls/GameDownloadUserControl.xaml.cs @@ -252,7 +252,7 @@ private void OpenDirectory_MouseLeftButtonUp(object sender, System.Windows.Input private void GameImage_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { - MainWindowViewModel.Instance.SetActiveControl(new NewGameViewUserControl(ViewModel.Game, LoginManager.Instance.IsLoggedIn())); + MainWindowViewModel.Instance.SetActiveControl(new GameViewUserControl(ViewModel.Game, LoginManager.Instance.IsLoggedIn())); } private void ExtractionProgress(object sender, SevenZipProgressEventArgs e) diff --git a/gamevault/UserControls/GameSettingsUserControl.xaml.cs b/gamevault/UserControls/GameSettingsUserControl.xaml.cs index ff73124..efdcd2c 100644 --- a/gamevault/UserControls/GameSettingsUserControl.xaml.cs +++ b/gamevault/UserControls/GameSettingsUserControl.xaml.cs @@ -107,7 +107,7 @@ private void Help_Click(object sender, MouseButtonEventArgs e) } private bool IsGameInstalled(Game game) { - KeyValuePair result = NewInstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == game.ID).FirstOrDefault(); + KeyValuePair result = InstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == game.ID).FirstOrDefault(); if (result.Equals(default(KeyValuePair))) return false; @@ -163,7 +163,7 @@ private async void Uninstall_Click(object sender, MouseButtonEventArgs e) if (Directory.Exists(ViewModel.Directory)) Directory.Delete(ViewModel.Directory, true); - NewInstallViewModel.Instance.InstalledGames.Remove(NewInstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ViewModel.Game.ID).First()); + InstallViewModel.Instance.InstalledGames.Remove(InstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ViewModel.Game.ID).First()); MainWindowViewModel.Instance.ClosePopup(); } catch @@ -209,7 +209,7 @@ private async void Uninstall_Click(object sender, MouseButtonEventArgs e) if (Directory.Exists(ViewModel.Directory)) Directory.Delete(ViewModel.Directory, true); - NewInstallViewModel.Instance.InstalledGames.Remove(NewInstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ViewModel.Game.ID).First()); + InstallViewModel.Instance.InstalledGames.Remove(InstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ViewModel.Game.ID).First()); } catch { } } @@ -237,7 +237,7 @@ private void InitDiskUsagePieChart() long totalDiskSize = drive.TotalSize; long currentGameSize = long.TryParse(ViewModel.Game.Size, out var size) ? size : 0; - long otherGamesSize = NewInstallViewModel.Instance.InstalledGames + long otherGamesSize = InstallViewModel.Instance.InstalledGames .Sum(installedGame => long.TryParse(installedGame.Key.Size, out var gameSize) ? gameSize : 0) - currentGameSize; long unmanagedDiskSize = totalDiskSize - currentGameSize - otherGamesSize - drive.TotalFreeSpace; @@ -353,7 +353,7 @@ public static bool TryPrepareLaunchExecutable(string directory) } private static bool ContainsValueFromIgnoreList(string value) { - return (NewInstallViewModel.Instance.IgnoreList != null && NewInstallViewModel.Instance.IgnoreList.Any(s => Path.GetFileNameWithoutExtension(value).Contains(s, StringComparison.OrdinalIgnoreCase))); + return (InstallViewModel.Instance.IgnoreList != null && InstallViewModel.Instance.IgnoreList.Any(s => Path.GetFileNameWithoutExtension(value).Contains(s, StringComparison.OrdinalIgnoreCase))); } private void ExecutableSelection_Opened(object sender, EventArgs e) { @@ -624,11 +624,11 @@ await Task.Run(() => //Update Data Context for Library. So that the images are also refreshed there directly if (success) { - NewInstallViewModel.Instance.RefreshGame(ViewModel.Game); + InstallViewModel.Instance.RefreshGame(ViewModel.Game); MainWindowViewModel.Instance.NewLibrary.RefreshGame(ViewModel.Game); - if (MainWindowViewModel.Instance.ActiveControl.GetType() == typeof(NewGameViewUserControl)) + if (MainWindowViewModel.Instance.ActiveControl.GetType() == typeof(GameViewUserControl)) { - ((NewGameViewUserControl)MainWindowViewModel.Instance.ActiveControl).RefreshGame(ViewModel.Game); + ((GameViewUserControl)MainWindowViewModel.Instance.ActiveControl).RefreshGame(ViewModel.Game); } } } @@ -750,7 +750,7 @@ await Task.Run(() => MainWindowViewModel.Instance.AppBarText = errMessage; } }); - NewInstallViewModel.Instance.RefreshGame(ViewModel.Game); + InstallViewModel.Instance.RefreshGame(ViewModel.Game); MainWindowViewModel.Instance.NewLibrary.RefreshGame(ViewModel.Game); this.IsEnabled = true; } diff --git a/gamevault/UserControls/NewGameViewUserControl.xaml b/gamevault/UserControls/GameViewUserControl.xaml similarity index 99% rename from gamevault/UserControls/NewGameViewUserControl.xaml rename to gamevault/UserControls/GameViewUserControl.xaml index b054487..b7b6860 100644 --- a/gamevault/UserControls/NewGameViewUserControl.xaml +++ b/gamevault/UserControls/GameViewUserControl.xaml @@ -1,4 +1,4 @@ - /// Interaction logic for NewGameViewUserControl.xaml /// - public partial class NewGameViewUserControl : UserControl + public partial class GameViewUserControl : UserControl { - private NewGameViewViewModel ViewModel { get; set; } + private GameViewViewModel ViewModel { get; set; } private int gameID { get; set; } private bool loaded = false; - public NewGameViewUserControl(Game game, bool reloadGameObject = true) + public GameViewUserControl(Game game, bool reloadGameObject = true) { InitializeComponent(); - ViewModel = new NewGameViewViewModel(); + ViewModel = new GameViewViewModel(); if (false == reloadGameObject) { ViewModel.Game = game; @@ -77,7 +77,7 @@ private bool IsGameInstalled(Game? game) { if (game == null) return false; - KeyValuePair result = NewInstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == game.ID).FirstOrDefault(); + KeyValuePair result = InstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == game.ID).FirstOrDefault(); if (result.Equals(default(KeyValuePair))) return false; @@ -90,7 +90,7 @@ private void Back_Click(object sender, MouseButtonEventArgs e) private void GamePlay_Click(object sender, MouseButtonEventArgs e) { string path = ""; - KeyValuePair result = NewInstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ViewModel.Game.ID).FirstOrDefault(); + KeyValuePair result = InstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ViewModel.Game.ID).FirstOrDefault(); if (!result.Equals(default(KeyValuePair))) { path = result.Value; diff --git a/gamevault/UserControls/NewInstallUserControl.xaml b/gamevault/UserControls/InstallUserControl.xaml similarity index 99% rename from gamevault/UserControls/NewInstallUserControl.xaml rename to gamevault/UserControls/InstallUserControl.xaml index 9316095..c0597db 100644 --- a/gamevault/UserControls/NewInstallUserControl.xaml +++ b/gamevault/UserControls/InstallUserControl.xaml @@ -1,4 +1,4 @@ - m_FileWatcherList = new List(); - public NewInstallUserControl() + public InstallUserControl() { InitializeComponent(); - this.DataContext = NewInstallViewModel.Instance; + this.DataContext = InstallViewModel.Instance; InitTimer(); uiInstalledGames.IsExpanded = Preferences.Get(AppConfigKey.InstalledGamesOpen, AppFilePath.UserFile) == "1" ? true : false; } public async Task RestoreInstalledGames() { - NewInstallViewModel.Instance.IgnoreList = GetIgnoreList(); + InstallViewModel.Instance.IgnoreList = GetIgnoreList(); Dictionary foundGames = new Dictionary(); Game[]? games = await Task.Run(() => { @@ -61,7 +61,7 @@ public async Task RestoreInstalledGames() { int id = GetGameIdByDirectory(dir); if (id == -1) continue; - if (NewInstallViewModel.Instance.InstalledGames.Where(x => x.Key.ID == id).Count() > 0) + if (InstallViewModel.Instance.InstalledGames.Where(x => x.Key.ID == id).Count() > 0) continue; if (!foundGames.ContainsKey(id)) { @@ -140,7 +140,7 @@ public async Task RestoreInstalledGames() Game? game = games.Where(x => x.ID == foundGames.ElementAt(count).Key).FirstOrDefault(); if (game != null) { - NewInstallViewModel.Instance.InstalledGames.Add(new KeyValuePair(game, foundGames.ElementAt(count).Value)); + InstallViewModel.Instance.InstalledGames.Add(new KeyValuePair(game, foundGames.ElementAt(count).Value)); if (LoginManager.Instance.IsLoggedIn()) { if (!Preferences.Exists(game.ID.ToString(), AppFilePath.OfflineCache)) @@ -153,7 +153,7 @@ public async Task RestoreInstalledGames() } catch { } } - NewInstallViewModel.Instance.InstalledGamesFilter = CollectionViewSource.GetDefaultView(NewInstallViewModel.Instance.InstalledGames); + InstallViewModel.Instance.InstalledGamesFilter = CollectionViewSource.GetDefaultView(InstallViewModel.Instance.InstalledGames); } } @@ -182,7 +182,7 @@ private void OnCreated(object sender, FileSystemEventArgs e) if (id == -1) return; - if (NewInstallViewModel.Instance.InstalledGames.Where(x => x.Key.ID == id).Count() > 0) + if (InstallViewModel.Instance.InstalledGames.Where(x => x.Key.ID == id).Count() > 0) return; try @@ -208,7 +208,7 @@ private void OnCreated(object sender, FileSystemEventArgs e) { App.Current.Dispatcher.Invoke((Action)delegate { - NewInstallViewModel.Instance.InstalledGames.Add(new KeyValuePair(game, dir)); + InstallViewModel.Instance.InstalledGames.Add(new KeyValuePair(game, dir)); }); } } @@ -248,7 +248,7 @@ private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation. private void GameCard_Clicked(object sender, System.Windows.Input.MouseButtonEventArgs e) { - MainWindowViewModel.Instance.SetActiveControl(new NewGameViewUserControl(((KeyValuePair)((FrameworkElement)sender).DataContext).Key, LoginManager.Instance.IsLoggedIn())); + MainWindowViewModel.Instance.SetActiveControl(new GameViewUserControl(((KeyValuePair)((FrameworkElement)sender).DataContext).Key, LoginManager.Instance.IsLoggedIn())); } private void Search_TextChanged(object sender, TextChangedEventArgs e) { @@ -259,8 +259,8 @@ private void Search_TextChanged(object sender, TextChangedEventArgs e) private void InputTimerElapsed(object sender, EventArgs e) { inputTimer.Stop(); - if (NewInstallViewModel.Instance.InstalledGamesFilter == null) return; - NewInstallViewModel.Instance.InstalledGamesFilter.Filter = item => + if (InstallViewModel.Instance.InstalledGamesFilter == null) return; + InstallViewModel.Instance.InstalledGamesFilter.Filter = item => { return ((KeyValuePair)item).Key.Title.Contains(inputTimer.Data, StringComparison.OrdinalIgnoreCase); }; diff --git a/gamevault/UserControls/NewLibraryUserControl.xaml b/gamevault/UserControls/LibraryUserControl.xaml similarity index 99% rename from gamevault/UserControls/NewLibraryUserControl.xaml rename to gamevault/UserControls/LibraryUserControl.xaml index a627dd8..718a66a 100644 --- a/gamevault/UserControls/NewLibraryUserControl.xaml +++ b/gamevault/UserControls/LibraryUserControl.xaml @@ -1,4 +1,4 @@ - - + diff --git a/gamevault/UserControls/NewLibraryUserControl.xaml.cs b/gamevault/UserControls/LibraryUserControl.xaml.cs similarity index 95% rename from gamevault/UserControls/NewLibraryUserControl.xaml.cs rename to gamevault/UserControls/LibraryUserControl.xaml.cs index ea82cc8..6e6d98e 100644 --- a/gamevault/UserControls/NewLibraryUserControl.xaml.cs +++ b/gamevault/UserControls/LibraryUserControl.xaml.cs @@ -25,19 +25,19 @@ namespace gamevault.UserControls { /// - /// Interaction logic for NewLibraryUserControl.xaml + /// Interaction logic for LibraryUserControl.xaml /// - public partial class NewLibraryUserControl : UserControl + public partial class LibraryUserControl : UserControl { - private NewLibraryViewModel ViewModel; + private LibraryViewModel ViewModel; private InputTimer inputTimer { get; set; } private bool scrollBlocked = false; private bool loaded = false; - public NewLibraryUserControl() + public LibraryUserControl() { InitializeComponent(); - ViewModel = new NewLibraryViewModel(); + ViewModel = new LibraryViewModel(); this.DataContext = ViewModel; InitTimer(); } @@ -105,7 +105,7 @@ private async Task Search() } } } - public NewInstallUserControl GetGameInstalls() + public InstallUserControl GetGameInstalls() { return uiGameInstalls; } @@ -156,7 +156,7 @@ private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation. private void GameCard_Clicked(object sender, MouseButtonEventArgs e) { - MainWindowViewModel.Instance.SetActiveControl(new NewGameViewUserControl((Game)((FrameworkElement)sender).DataContext)); + MainWindowViewModel.Instance.SetActiveControl(new GameViewUserControl((Game)((FrameworkElement)sender).DataContext)); } private void Filter_Click(object sender, MouseButtonEventArgs e) @@ -289,7 +289,7 @@ private async void RandomGame_Click(object sender, MouseButtonEventArgs e) }); if (result != null) { - MainWindowViewModel.Instance.SetActiveControl(new NewGameViewUserControl(result, true)); + MainWindowViewModel.Instance.SetActiveControl(new GameViewUserControl(result, true)); } ((FrameworkElement)sender).IsEnabled = true; } @@ -297,7 +297,7 @@ private async void RandomGame_Click(object sender, MouseButtonEventArgs e) private void Settings_Click(object sender, MouseButtonEventArgs e) { e.Handled = true; - var installedGame = NewInstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ((Game)((FrameworkElement)sender).DataContext).ID).FirstOrDefault(); + var installedGame = InstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ((Game)((FrameworkElement)sender).DataContext).ID).FirstOrDefault(); MainWindowViewModel.Instance.OpenPopup(new GameSettingsUserControl((Game)((FrameworkElement)sender).DataContext) { Width = 1200, Height = 800, Margin = new Thickness(50) }); } diff --git a/gamevault/ViewModels/NewGameViewViewModel.cs b/gamevault/ViewModels/GameViewViewModel.cs similarity index 97% rename from gamevault/ViewModels/NewGameViewViewModel.cs rename to gamevault/ViewModels/GameViewViewModel.cs index bfbce6f..b09bcaf 100644 --- a/gamevault/ViewModels/NewGameViewViewModel.cs +++ b/gamevault/ViewModels/GameViewViewModel.cs @@ -9,7 +9,7 @@ namespace gamevault.ViewModels { - internal class NewGameViewViewModel : ViewModelBase + internal class GameViewViewModel : ViewModelBase { #region PrivateMembers private Game? game { get; set; } diff --git a/gamevault/ViewModels/NewInstallViewModel.cs b/gamevault/ViewModels/InstallViewModel.cs similarity index 89% rename from gamevault/ViewModels/NewInstallViewModel.cs rename to gamevault/ViewModels/InstallViewModel.cs index e2e81c0..09022af 100644 --- a/gamevault/ViewModels/NewInstallViewModel.cs +++ b/gamevault/ViewModels/InstallViewModel.cs @@ -10,13 +10,13 @@ namespace gamevault.ViewModels { - internal class NewInstallViewModel : ViewModelBase + internal class InstallViewModel : ViewModelBase { #region Singleton - private static NewInstallViewModel instance = null; + private static InstallViewModel instance = null; private static readonly object padlock = new object(); - public static NewInstallViewModel Instance + public static InstallViewModel Instance { get { @@ -24,7 +24,7 @@ public static NewInstallViewModel Instance { if (instance == null) { - instance = new NewInstallViewModel(); + instance = new InstallViewModel(); } return instance; } diff --git a/gamevault/ViewModels/NewLibraryViewModel.cs b/gamevault/ViewModels/LibraryViewModel.cs similarity index 97% rename from gamevault/ViewModels/NewLibraryViewModel.cs rename to gamevault/ViewModels/LibraryViewModel.cs index d0f71a1..5fb78e4 100644 --- a/gamevault/ViewModels/NewLibraryViewModel.cs +++ b/gamevault/ViewModels/LibraryViewModel.cs @@ -9,7 +9,7 @@ namespace gamevault.ViewModels { - internal class NewLibraryViewModel : ViewModelBase + internal class LibraryViewModel : ViewModelBase { #region PrivateMembers private ObservableCollection gameCards { get; set; } diff --git a/gamevault/ViewModels/MainWindowViewModel.cs b/gamevault/ViewModels/MainWindowViewModel.cs index 3a80392..dfcca19 100644 --- a/gamevault/ViewModels/MainWindowViewModel.cs +++ b/gamevault/ViewModels/MainWindowViewModel.cs @@ -28,7 +28,7 @@ public MainWindowViewModel() { m_Settings = new SettingsUserControl(); m_Downloads = new DownloadsUserControl(); - m_NewLibrary = new NewLibraryUserControl(); + m_Library = new LibraryUserControl(); m_Community = new CommunityUserControl(); m_AdminConsole = new AdminConsoleUserControl(); } @@ -96,7 +96,7 @@ public User? UserIcon private UserControl m_Popup { get; set; } private SettingsUserControl m_Settings { get; set; } private DownloadsUserControl m_Downloads { get; set; } - private NewLibraryUserControl m_NewLibrary { get; set; } + private LibraryUserControl m_Library { get; set; } private CommunityUserControl m_Community { get; set; } private AdminConsoleUserControl m_AdminConsole { get; set; } #endregion @@ -157,10 +157,10 @@ internal DownloadsUserControl Downloads get { return m_Downloads; } private set { m_Downloads = value; } } - internal NewLibraryUserControl NewLibrary + internal LibraryUserControl NewLibrary { - get { return m_NewLibrary; } - private set { m_NewLibrary = value; } + get { return m_Library; } + private set { m_Library = value; } } internal CommunityUserControl Community {