Skip to content

Commit

Permalink
completed renaming new controls
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelo420 committed Jan 5, 2024
1 parent f5be05b commit 2009124
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 54 deletions.
2 changes: 1 addition & 1 deletion gamevault/Converter/GameSettingsTabVisibilityConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion gamevault/UserControls/CommunityUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion gamevault/UserControls/GameDownloadUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 9 additions & 9 deletions gamevault/UserControls/GameSettingsUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private void Help_Click(object sender, MouseButtonEventArgs e)
}
private bool IsGameInstalled(Game game)
{
KeyValuePair<Game, string> result = NewInstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == game.ID).FirstOrDefault();
KeyValuePair<Game, string> result = InstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == game.ID).FirstOrDefault();
if (result.Equals(default(KeyValuePair<Game, string>)))
return false;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 { }
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl x:Class="gamevault.UserControls.NewGameViewUserControl"
<UserControl x:Class="gamevault.UserControls.GameViewUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ namespace gamevault.UserControls
/// <summary>
/// Interaction logic for NewGameViewUserControl.xaml
/// </summary>
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;
Expand Down Expand Up @@ -77,7 +77,7 @@ private bool IsGameInstalled(Game? game)
{
if (game == null)
return false;
KeyValuePair<Game, string> result = NewInstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == game.ID).FirstOrDefault();
KeyValuePair<Game, string> result = InstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == game.ID).FirstOrDefault();
if (result.Equals(default(KeyValuePair<Game, string>)))
return false;

Expand All @@ -90,7 +90,7 @@ private void Back_Click(object sender, MouseButtonEventArgs e)
private void GamePlay_Click(object sender, MouseButtonEventArgs e)
{
string path = "";
KeyValuePair<Game, string> result = NewInstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ViewModel.Game.ID).FirstOrDefault();
KeyValuePair<Game, string> result = InstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ViewModel.Game.ID).FirstOrDefault();
if (!result.Equals(default(KeyValuePair<Game, string>)))
{
path = result.Value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl x:Class="gamevault.UserControls.NewInstallUserControl"
<UserControl x:Class="gamevault.UserControls.InstallUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@

namespace gamevault.UserControls
{
public partial class NewInstallUserControl : UserControl
public partial class InstallUserControl : UserControl
{
private InputTimer inputTimer { get; set; }
private List<FileSystemWatcher> m_FileWatcherList = new List<FileSystemWatcher>();

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<int, string> foundGames = new Dictionary<int, string>();
Game[]? games = await Task<Game[]>.Run(() =>
{
Expand All @@ -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))
{
Expand Down Expand Up @@ -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, string>(game, foundGames.ElementAt(count).Value));
InstallViewModel.Instance.InstalledGames.Add(new KeyValuePair<Game, string>(game, foundGames.ElementAt(count).Value));
if (LoginManager.Instance.IsLoggedIn())
{
if (!Preferences.Exists(game.ID.ToString(), AppFilePath.OfflineCache))
Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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
Expand All @@ -208,7 +208,7 @@ private void OnCreated(object sender, FileSystemEventArgs e)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
NewInstallViewModel.Instance.InstalledGames.Add(new KeyValuePair<Game, string>(game, dir));
InstallViewModel.Instance.InstalledGames.Add(new KeyValuePair<Game, string>(game, dir));
});
}
}
Expand Down Expand Up @@ -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<Game, string>)((FrameworkElement)sender).DataContext).Key, LoginManager.Instance.IsLoggedIn()));
MainWindowViewModel.Instance.SetActiveControl(new GameViewUserControl(((KeyValuePair<Game, string>)((FrameworkElement)sender).DataContext).Key, LoginManager.Instance.IsLoggedIn()));
}
private void Search_TextChanged(object sender, TextChangedEventArgs e)
{
Expand All @@ -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<Game, string>)item).Key.Title.Contains(inputTimer.Data, StringComparison.OrdinalIgnoreCase);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl x:Class="gamevault.UserControls.NewLibraryUserControl"
<UserControl x:Class="gamevault.UserControls.LibraryUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand All @@ -24,7 +24,7 @@
<ScrollViewer x:Name="uiMainScrollBar" Grid.Row="1" VerticalScrollBarVisibility="Auto">
<StackPanel>
<Viewbox>
<local:NewInstallUserControl x:Name="uiGameInstalls" Width="2000"/>
<local:InstallUserControl x:Name="uiGameInstalls" Width="2000"/>
</Viewbox>
<Viewbox>
<Expander x:Name="uiExpanderGameCards" Width="2000" Margin="10,0,10,10" mah:ExpanderHelper.HeaderDownStyle="{StaticResource CustomExpanderToggleButton}" BorderBrush="{x:Null}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@
namespace gamevault.UserControls
{
/// <summary>
/// Interaction logic for NewLibraryUserControl.xaml
/// Interaction logic for LibraryUserControl.xaml
/// </summary>
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();
}
Expand Down Expand Up @@ -105,7 +105,7 @@ private async Task Search()
}
}
}
public NewInstallUserControl GetGameInstalls()
public InstallUserControl GetGameInstalls()
{
return uiGameInstalls;
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -289,15 +289,15 @@ 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;
}

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

namespace gamevault.ViewModels
{
internal class NewGameViewViewModel : ViewModelBase
internal class GameViewViewModel : ViewModelBase
{
#region PrivateMembers
private Game? game { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@

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
{
lock (padlock)
{
if (instance == null)
{
instance = new NewInstallViewModel();
instance = new InstallViewModel();
}
return instance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace gamevault.ViewModels
{
internal class NewLibraryViewModel : ViewModelBase
internal class LibraryViewModel : ViewModelBase
{
#region PrivateMembers
private ObservableCollection<Game> gameCards { get; set; }
Expand Down
Loading

0 comments on commit 2009124

Please sign in to comment.