From 7a233345a9d460d26c1b255d6160178572f82561 Mon Sep 17 00:00:00 2001
From: Zagrthos <36556009+Zagrthos@users.noreply.github.com>
Date: Wed, 21 Aug 2024 23:35:28 +0200
Subject: [PATCH 01/13] Add new setting to hide non-downloaded DLSS versions
---
src/Pages/SettingsPage.xaml | 10 ++++++++++
src/Pages/SettingsPage.xaml.cs | 14 +++++++++++++-
src/Settings.cs | 18 +++++++++++++++++-
3 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/src/Pages/SettingsPage.xaml b/src/Pages/SettingsPage.xaml
index ab1ffbf..cf7a482 100644
--- a/src/Pages/SettingsPage.xaml
+++ b/src/Pages/SettingsPage.xaml
@@ -64,6 +64,16 @@
+
+
+
+
+ This setting will hide not downloaded DLSS versions in the selector.
+
+
Date: Wed, 21 Aug 2024 23:37:59 +0200
Subject: [PATCH 02/13] Implement the new setting inside the selector
---
src/UserControls/DLSSPickerControl.xaml.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/UserControls/DLSSPickerControl.xaml.cs b/src/UserControls/DLSSPickerControl.xaml.cs
index be9d6a2..f001c40 100644
--- a/src/UserControls/DLSSPickerControl.xaml.cs
+++ b/src/UserControls/DLSSPickerControl.xaml.cs
@@ -28,7 +28,8 @@ public sealed partial class DLSSPickerControl : UserControl
public DLSSPickerControl(Game game)
{
_game = game;
- DLSSRecords.AddRange(App.CurrentApp.MainWindow.CurrentDLSSRecords);
+ bool hideNotDownloaded = Settings.Instance.HideNotDownloadedVersions;
+ DLSSRecords.AddRange(App.CurrentApp.MainWindow.CurrentDLSSRecords.Where(r => r.LocalRecord.IsDownloaded == hideNotDownloaded));
this.InitializeComponent();
DataContext = this;
From 9630971653cec610efa271be69ef23ab7b6c8b74 Mon Sep 17 00:00:00 2001
From: Zagrthos <36556009+Zagrthos@users.noreply.github.com>
Date: Wed, 21 Aug 2024 23:38:11 +0200
Subject: [PATCH 03/13] Add a new dialog if no DLSS files are downloaded
---
src/Pages/GameGridPage.xaml.cs | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/Pages/GameGridPage.xaml.cs b/src/Pages/GameGridPage.xaml.cs
index a3018e3..bc863c3 100644
--- a/src/Pages/GameGridPage.xaml.cs
+++ b/src/Pages/GameGridPage.xaml.cs
@@ -237,6 +237,21 @@ async void MainGridView_SelectionChanged(object sender, SelectionChangedEventArg
DefaultButton = ContentDialogButton.Primary,
Content = $"DLSS was not detected in {game.Title}.",
};
+
+ await dialog.ShowAsync();
+ return;
+ }
+
+ if (Settings.Instance.HideNotDownloadedVersions && App.CurrentApp.MainWindow.CurrentDLSSRecords.Where(static r => r.LocalRecord.IsDownloaded).Count() is 0)
+ {
+ dialog = new(XamlRoot)
+ {
+ Title = "Error",
+ PrimaryButtonText = "Okay",
+ DefaultButton = ContentDialogButton.Primary,
+ Content = "You have not downloaded any DLSS version. Please download one from the library page.",
+ };
+
await dialog.ShowAsync();
return;
}
From 2485c74afd0f72f37409ae760a276298a61a37b1 Mon Sep 17 00:00:00 2001
From: Zagrthos <36556009+Zagrthos@users.noreply.github.com>
Date: Wed, 21 Aug 2024 23:38:41 +0200
Subject: [PATCH 04/13] Formatting of Setting.cs
---
src/Settings.cs | 40 ++++++++++++++++++----------------------
1 file changed, 18 insertions(+), 22 deletions(-)
diff --git a/src/Settings.cs b/src/Settings.cs
index a679849..aa47aa0 100644
--- a/src/Settings.cs
+++ b/src/Settings.cs
@@ -1,5 +1,5 @@
-using Microsoft.UI.Xaml;
-using System;
+using System;
+using Microsoft.UI.Xaml;
namespace DLSS_Swapper
{
@@ -10,9 +10,9 @@ public class Settings
public static Settings Instance => _instance ??= Settings.FromJson();
// We default this to false to prevent saves firing when loading from json.
- bool _autoSave = false;
+ private bool _autoSave = false;
- bool _hasShownWarning = false;
+ private bool _hasShownWarning = false;
public bool HasShownWarning
{
get { return _hasShownWarning; }
@@ -29,7 +29,7 @@ public bool HasShownWarning
}
}
- bool _hasShownMultiplayerWarning = false;
+ private bool _hasShownMultiplayerWarning = false;
public bool HasShownMultiplayerWarning
{
get { return _hasShownMultiplayerWarning; }
@@ -46,7 +46,7 @@ public bool HasShownMultiplayerWarning
}
}
- bool _hideNonDLSSGames = true;
+ private bool _hideNonDLSSGames = true;
public bool HideNonDLSSGames
{
get { return _hideNonDLSSGames; }
@@ -63,8 +63,7 @@ public bool HideNonDLSSGames
}
}
-
- bool _groupGameLibrariesTogether = false;
+ private bool _groupGameLibrariesTogether = false;
public bool GroupGameLibrariesTogether
{
get { return _groupGameLibrariesTogether; }
@@ -81,7 +80,7 @@ public bool GroupGameLibrariesTogether
}
}
- ElementTheme _appTheme = ElementTheme.Default;
+ private ElementTheme _appTheme = ElementTheme.Default;
public ElementTheme AppTheme
{
get { return _appTheme; }
@@ -98,7 +97,7 @@ public ElementTheme AppTheme
}
}
- bool _allowExperimental = false;
+ private bool _allowExperimental = false;
public bool AllowExperimental
{
get { return _allowExperimental; }
@@ -115,8 +114,7 @@ public bool AllowExperimental
}
}
-
- bool _allowUntrusted = false;
+ private bool _allowUntrusted = false;
public bool AllowUntrusted
{
get { return _allowUntrusted; }
@@ -150,6 +148,7 @@ public bool HideNotDownloadedVersions
}
}
+ private DateTimeOffset _lastRecordsRefresh = DateTimeOffset.MinValue;
public DateTimeOffset LastRecordsRefresh
{
get { return _lastRecordsRefresh; }
@@ -166,8 +165,7 @@ public DateTimeOffset LastRecordsRefresh
}
}
-
- ulong _lastPromptWasForVersion = 0L;
+ private ulong _lastPromptWasForVersion = 0L;
public ulong LastPromptWasForVersion
{
get { return _lastPromptWasForVersion; }
@@ -184,9 +182,8 @@ public ulong LastPromptWasForVersion
}
}
-
// Don't forget to change this back to off.
- LoggingLevel _loggingLevel = LoggingLevel.Error;
+ private LoggingLevel _loggingLevel = LoggingLevel.Error;
public LoggingLevel LoggingLevel
{
get { return _loggingLevel; }
@@ -203,7 +200,7 @@ public LoggingLevel LoggingLevel
}
}
- uint _enabledGameLibraries = uint.MaxValue;
+ private uint _enabledGameLibraries = uint.MaxValue;
public uint EnabledGameLibraries
{
get { return _enabledGameLibraries; }
@@ -220,8 +217,7 @@ public uint EnabledGameLibraries
}
}
-
- bool _wasLoadingGames = false;
+ private bool _wasLoadingGames = false;
public bool WasLoadingGames
{
get { return _wasLoadingGames; }
@@ -238,18 +234,18 @@ public bool WasLoadingGames
}
}
- void SaveJson()
+ private void SaveJson()
{
AsyncHelper.RunSync(() => Storage.SaveSettingsJsonAsync(this));
}
- static Settings FromJson()
+ private static Settings FromJson()
{
Settings settings = null;
var settingsFromJson = AsyncHelper.RunSync(() => Storage.LoadSettingsJsonAsync());
// If we couldn't load settings then save the defaults.
- if (settingsFromJson == null)
+ if (settingsFromJson is null)
{
settings = new Settings();
settings.SaveJson();
From 3e3cf27853e98c043447103f23815948f156c9dc Mon Sep 17 00:00:00 2001
From: Zagrthos <36556009+Zagrthos@users.noreply.github.com>
Date: Wed, 21 Aug 2024 23:39:20 +0200
Subject: [PATCH 05/13] Restructure the hotpath of DLSSPickerControl ctor
---
src/UserControls/DLSSPickerControl.xaml.cs | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/UserControls/DLSSPickerControl.xaml.cs b/src/UserControls/DLSSPickerControl.xaml.cs
index f001c40..a967916 100644
--- a/src/UserControls/DLSSPickerControl.xaml.cs
+++ b/src/UserControls/DLSSPickerControl.xaml.cs
@@ -34,16 +34,13 @@ public DLSSPickerControl(Game game)
this.InitializeComponent();
DataContext = this;
- // TODO: If you select an imported DLSS
var detectedVersion = DLSSRecords.FirstOrDefault(v => v.MD5Hash == game.CurrentDLSSHash);
- if (detectedVersion == null)
- {
-
- }
- else
+ if (detectedVersion is not null)
{
DLSSRecordsListView.SelectedItem = detectedVersion;
}
+ // TODO: If you select an imported DLSS
+ // else { }
}
internal DLSSRecord GetSelectedDLSSRecord()
From 80505c52b200c33dbc5b54c534c5b44c9b7c4fd8 Mon Sep 17 00:00:00 2001
From: Zagrthos <36556009+Zagrthos@users.noreply.github.com>
Date: Wed, 21 Aug 2024 23:39:38 +0200
Subject: [PATCH 06/13] Formatting of DLSSPickerControl
---
src/UserControls/DLSSPickerControl.xaml.cs | 22 +++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)
diff --git a/src/UserControls/DLSSPickerControl.xaml.cs b/src/UserControls/DLSSPickerControl.xaml.cs
index a967916..2275d2f 100644
--- a/src/UserControls/DLSSPickerControl.xaml.cs
+++ b/src/UserControls/DLSSPickerControl.xaml.cs
@@ -1,19 +1,7 @@
-using DLSS_Swapper.Data;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Controls.Primitives;
-using Microsoft.UI.Xaml.Data;
-using Microsoft.UI.Xaml.Input;
-using Microsoft.UI.Xaml.Media;
-using Microsoft.UI.Xaml.Navigation;
-using MvvmHelpers;
-using System;
-using System.Collections.Generic;
-using System.IO;
+using System.Collections.Generic;
using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
+using DLSS_Swapper.Data;
+using Microsoft.UI.Xaml.Controls;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
@@ -22,8 +10,8 @@ namespace DLSS_Swapper.UserControls
{
public sealed partial class DLSSPickerControl : UserControl
{
- Game _game;
- public List DLSSRecords { get; } = new List();
+ private readonly Game _game;
+ public List DLSSRecords { get; } = [];
public DLSSPickerControl(Game game)
{
From b3837b4b7d6c5aa37cc0d296c139c5064e65c0e1 Mon Sep 17 00:00:00 2001
From: Zagrthos <36556009+Zagrthos@users.noreply.github.com>
Date: Wed, 21 Aug 2024 23:39:53 +0200
Subject: [PATCH 07/13] Formatting and improving of SettingsPage.xaml.cs
---
src/Pages/SettingsPage.xaml.cs | 53 +++++++++++++---------------------
1 file changed, 20 insertions(+), 33 deletions(-)
diff --git a/src/Pages/SettingsPage.xaml.cs b/src/Pages/SettingsPage.xaml.cs
index c9c2417..ea3b5bc 100644
--- a/src/Pages/SettingsPage.xaml.cs
+++ b/src/Pages/SettingsPage.xaml.cs
@@ -1,27 +1,14 @@
-using CommunityToolkit.WinUI.UI.Controls;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Controls.Primitives;
-using Microsoft.UI.Xaml.Data;
-using Microsoft.UI.Xaml.Documents;
-using Microsoft.UI.Xaml.Input;
-using Microsoft.UI.Xaml.Media;
-using Microsoft.UI.Xaml.Navigation;
-using MvvmHelpers.Commands;
-using MvvmHelpers.Interfaces;
-using System;
+using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.IO;
using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
-using Windows.Foundation.Diagnostics;
-using Windows.System;
-using Windows.UI.ViewManagement;
-using System.Diagnostics;
using DLSS_Swapper.UserControls;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Documents;
+using MvvmHelpers.Commands;
namespace DLSS_Swapper.Pages
{
@@ -32,7 +19,6 @@ public sealed partial class SettingsPage : Page
{
//https://github.com/microsoft/Xaml-Controls-Gallery/blob/6450265cc94da5b2fac5e1e22d1be35dc66c402e/XamlControlsGallery/Navigation/NavigationRootPage.xaml.cs#L32
-
public string Version => App.CurrentApp.GetVersionString();
private AsyncCommand _checkForUpdateCommand;
@@ -60,11 +46,10 @@ public SettingsPage()
{
this.InitializeComponent();
-
// Initilize defaults.
- LightThemeRadioButton.IsChecked = Settings.Instance.AppTheme == ElementTheme.Light;
- DarkThemeRadioButton.IsChecked = Settings.Instance.AppTheme == ElementTheme.Dark;
- DefaultThemeRadioButton.IsChecked = Settings.Instance.AppTheme == ElementTheme.Default;
+ LightThemeRadioButton.IsChecked = Settings.Instance.AppTheme is ElementTheme.Light;
+ DarkThemeRadioButton.IsChecked = Settings.Instance.AppTheme is ElementTheme.Dark;
+ DefaultThemeRadioButton.IsChecked = Settings.Instance.AppTheme is ElementTheme.Default;
AllowUntrustedToggleSwitch.IsOn = Settings.Instance.AllowUntrusted;
AllowExperimentalToggleSwitch.IsOn = Settings.Instance.AllowExperimental;
@@ -74,9 +59,9 @@ public SettingsPage()
DataContext = this;
}
- void ThemeRadioButton_Checked(object sender, RoutedEventArgs e)
+ private void ThemeRadioButton_Checked(object sender, RoutedEventArgs e)
{
- if (DataContext == null)
+ if (DataContext is null)
{
return;
}
@@ -98,9 +83,9 @@ void ThemeRadioButton_Checked(object sender, RoutedEventArgs e)
}
}
- void AllowExperimental_Toggled(object sender, RoutedEventArgs e)
+ private void AllowExperimental_Toggled(object sender, RoutedEventArgs e)
{
- if (DataContext == null)
+ if (DataContext is null)
{
return;
}
@@ -112,9 +97,9 @@ void AllowExperimental_Toggled(object sender, RoutedEventArgs e)
}
}
- void AllowUntrusted_Toggled(object sender, RoutedEventArgs e)
+ private void AllowUntrusted_Toggled(object sender, RoutedEventArgs e)
{
- if (DataContext == null)
+ if (DataContext is null)
{
return;
}
@@ -138,19 +123,21 @@ private void HideNotDownloaded_Toggled(object sender, RoutedEventArgs e)
Settings.Instance.HideNotDownloadedVersions = toggleSwitch.IsOn;
}
}
+
+ private async Task CheckForUpdatesAsync()
{
IsCheckingForUpdates = true;
var githubUpdater = new Data.GitHub.GitHubUpdater();
var newUpdate = await githubUpdater.CheckForNewGitHubRelease();
- if (newUpdate == null)
+ if (newUpdate is null)
{
-
var dialog = new EasyContentDialog(XamlRoot)
{
CloseButtonText = "Okay",
DefaultButton = ContentDialogButton.Close,
Content = "No new updates are available.",
};
+
await dialog.ShowAsync();
IsCheckingForUpdates = false;
@@ -164,7 +151,7 @@ private void HideNotDownloaded_Toggled(object sender, RoutedEventArgs e)
private void LoggingComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- if (DataContext == null)
+ if (DataContext is null)
{
return;
}
From 004c662958f4b555fc74cb57b239731b7a4e0cca Mon Sep 17 00:00:00 2001
From: Zagrthos <36556009+Zagrthos@users.noreply.github.com>
Date: Wed, 21 Aug 2024 23:40:06 +0200
Subject: [PATCH 08/13] Formatting and improving of SettingsPage.xaml
---
src/Pages/SettingsPage.xaml | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/Pages/SettingsPage.xaml b/src/Pages/SettingsPage.xaml
index cf7a482..9a93f55 100644
--- a/src/Pages/SettingsPage.xaml
+++ b/src/Pages/SettingsPage.xaml
@@ -1,12 +1,10 @@
@@ -32,7 +30,6 @@
-
-
-
-
You can suggest a feature or report a problem or on the DLSS Swapper
- GitHub repository.
+ GitHub repository .
-
contributors
and the people who have filed
feedback to help improve the product.
- (also NVIDIA for DLSS 😊)
+ (also NVIDIA for DLSS 😊)
-
+
From bb294a36ff4aad90b1f827d87b7108c474e028e2 Mon Sep 17 00:00:00 2001
From: Zagrthos <36556009+Zagrthos@users.noreply.github.com>
Date: Wed, 21 Aug 2024 23:40:17 +0200
Subject: [PATCH 09/13] Formatting and improving of GameGridPage.xaml.cs
---
src/Pages/GameGridPage.xaml.cs | 109 ++++++++++++++-------------------
1 file changed, 46 insertions(+), 63 deletions(-)
diff --git a/src/Pages/GameGridPage.xaml.cs b/src/Pages/GameGridPage.xaml.cs
index bc863c3..29cdd9e 100644
--- a/src/Pages/GameGridPage.xaml.cs
+++ b/src/Pages/GameGridPage.xaml.cs
@@ -1,33 +1,14 @@
-using DLSS_Swapper.Data;
-using DLSS_Swapper.Data.EpicGamesStore;
-using DLSS_Swapper.Data.GOG;
-using DLSS_Swapper.Data.Steam;
-using DLSS_Swapper.Data.UbisoftConnect;
-using DLSS_Swapper.Data.Xbox;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using DLSS_Swapper.Data;
using DLSS_Swapper.Interfaces;
using DLSS_Swapper.UserControls;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Documents;
-using Microsoft.UI.Xaml.Input;
-using Microsoft.UI.Xaml.Media;
-using Microsoft.UI.Xaml.Navigation;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Net.Http;
-using System.Runtime.InteropServices.WindowsRuntime;
-using System.Security.Principal;
-using System.Text.Json;
-using System.Threading.Tasks;
-using System.Windows.Input;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
@@ -39,19 +20,17 @@ namespace DLSS_Swapper.Pages
///
public sealed partial class GameGridPage : Page
{
- public List GameLibraries { get; } = new List();
+ public List GameLibraries { get; } = [];
- bool _loadingGamesAndDlls = false;
+ private bool _loadingGamesAndDlls = false;
public GameGridPage()
{
this.InitializeComponent();
DataContext = this;
-
}
-
- async Task LoadGamesAsync()
+ private async Task LoadGamesAsync()
{
// Added this check so if we get to here and this is true we probably crashed loading games last time and we should prompt for that.
if (Settings.Instance.WasLoadingGames)
@@ -63,7 +42,7 @@ async Task LoadGamesAsync()
};
paragraph.Inlines.Add(new Run()
{
- Text = "DLSS Swapper had an issue loading game libraries. Please try disabling a game library below. You can re-enable these options later in the settings.",
+ Text = "DLSS Swapper had an issue loading game libraries. Please try disabling a game library below. You can re-enable these options later in the settings.",
});
richTextBlock.Blocks.Add(paragraph);
paragraph = new Paragraph()
@@ -92,24 +71,20 @@ async Task LoadGamesAsync()
-
var grid = new Grid()
{
RowSpacing = 10,
};
+
grid.RowDefinitions.Add(new RowDefinition());
grid.RowDefinitions.Add(new RowDefinition());
-
Grid.SetRow(richTextBlock, 0);
grid.Children.Add(richTextBlock);
-
var gameLibrarySelectorControl = new GameLibrarySelectorControl();
-
Grid.SetRow(gameLibrarySelectorControl, 1);
grid.Children.Add(gameLibrarySelectorControl);
-
var dialog = new EasyContentDialog(XamlRoot)
{
Title = "Failed to load game libraries",
@@ -118,8 +93,10 @@ async Task LoadGamesAsync()
DefaultButton = ContentDialogButton.Primary,
Content = grid,
};
+
var result = await dialog.ShowAsync();
- if (result == ContentDialogResult.Primary)
+
+ if (result is ContentDialogResult.Primary)
{
gameLibrarySelectorControl.Save();
}
@@ -154,7 +131,7 @@ async Task LoadGamesAsync()
});
}
- void FilterGames()
+ private void FilterGames()
{
// TODO: Remove weird hack which otherwise causes MainGridView_SelectionChanged to fire when changing MainGridView.ItemsSource.
MainGridView.SelectionChanged -= MainGridView_SelectionChanged;
@@ -163,7 +140,6 @@ void FilterGames()
if (Settings.Instance.GroupGameLibrariesTogether)
{
-
var collectionViewSource = new CollectionViewSource()
{
IsSourceGrouped = true,
@@ -189,7 +165,7 @@ void FilterGames()
{
foreach (var gameLibrary in GameLibraries)
{
- games.AddRange(gameLibrary.LoadedGames.Where(g => g.HasDLSS == true));
+ games.AddRange(gameLibrary.LoadedGames.Where(g => g.HasDLSS));
}
}
else
@@ -210,15 +186,14 @@ void FilterGames()
MainGridView.SelectionChanged += MainGridView_SelectionChanged;
}
-
- async void Page_Loaded(object sender, RoutedEventArgs e)
+ private async void Page_Loaded(object sender, RoutedEventArgs e)
{
await LoadGamesAndDlls();
}
- async void MainGridView_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ private async void MainGridView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- if (e.AddedItems.Count == 0)
+ if (e.AddedItems.Count is 0)
{
return;
}
@@ -228,11 +203,11 @@ async void MainGridView_SelectionChanged(object sender, SelectionChangedEventArg
{
EasyContentDialog dialog;
- if (game.HasDLSS == false)
+ if (!game.HasDLSS)
{
dialog = new EasyContentDialog(XamlRoot)
{
- //dialog.Title = "Error";
+ Title = "Error",
PrimaryButtonText = "Okay",
DefaultButton = ContentDialogButton.Primary,
Content = $"DLSS was not detected in {game.Title}.",
@@ -257,7 +232,7 @@ async void MainGridView_SelectionChanged(object sender, SelectionChangedEventArg
}
var dlssPickerControl = new DLSSPickerControl(game);
- dialog = new EasyContentDialog(XamlRoot)
+ dialog = new(XamlRoot)
{
Title = "Select DLSS Version",
PrimaryButtonText = "Swap",
@@ -266,52 +241,57 @@ async void MainGridView_SelectionChanged(object sender, SelectionChangedEventArg
Content = dlssPickerControl,
};
- if (String.IsNullOrEmpty(game.BaseDLSSVersion) == false)
+ if (!string.IsNullOrWhiteSpace(game.BaseDLSSVersion))
{
dialog.SecondaryButtonText = "Reset";
}
var result = await dialog.ShowAsync();
-
- if (result == ContentDialogResult.Primary)
+ if (result is ContentDialogResult.Primary)
{
var selectedDLSSRecord = dlssPickerControl.GetSelectedDLSSRecord();
- if (selectedDLSSRecord.LocalRecord.IsDownloading == true || selectedDLSSRecord.LocalRecord.IsDownloaded == false)
+ if (selectedDLSSRecord.LocalRecord.IsDownloading || !selectedDLSSRecord.LocalRecord.IsDownloaded)
{
// TODO: Initiate download here.
- dialog = new EasyContentDialog(XamlRoot)
+ dialog = new(XamlRoot)
{
Title = "Error",
CloseButtonText = "Okay",
DefaultButton = ContentDialogButton.Close,
Content = "Please download the DLSS record from the downloads page first.",
};
+
await dialog.ShowAsync();
return;
}
var didUpdate = game.UpdateDll(selectedDLSSRecord);
- if (didUpdate.Success == false)
+ if (!didUpdate.Success)
{
- dialog = new EasyContentDialog(XamlRoot)
+ dialog = new(XamlRoot)
{
Title = "Error",
PrimaryButtonText = "Okay",
DefaultButton = ContentDialogButton.Primary,
Content = didUpdate.Message,
};
+
/*
+ // TODO: Add run as adminstrator
// Disabled as I am unsure how to prompt to run as admin.
if (didUpdate.PromptToRelaunchAsAdmin == true)
{
dialog.SecondaryButtonText = "Relaunch as Administrator";
}
*/
+
var dialogResult = await dialog.ShowAsync();
+
/*
+ // TODO: Add run as adminstrator
// Disabled as I am unsure how to prompt to run as admin.
if (didUpdate.PromptToRelaunchAsAdmin == true && dialogResult == ContentDialogResult.Secondary)
{
@@ -320,11 +300,11 @@ async void MainGridView_SelectionChanged(object sender, SelectionChangedEventArg
*/
}
}
- else if (result == ContentDialogResult.Secondary)
+ else if (result is ContentDialogResult.Secondary)
{
var didReset = game.ResetDll();
- if (didReset.Success == false)
+ if (!didReset.Success)
{
dialog = new EasyContentDialog(XamlRoot)
{
@@ -333,14 +313,20 @@ async void MainGridView_SelectionChanged(object sender, SelectionChangedEventArg
DefaultButton = ContentDialogButton.Primary,
Content = didReset.Message,
};
+
/*
+ // TODO: Add run as adminstrator
// Disabled as I am unsure how to prompt to run as admin.
if (didReset.PromptToRelaunchAsAdmin == true)
{
dialog.SecondaryButtonText = "Relaunch as Administrator";
}
*/
- var dialogResult = await dialog.ShowAsync();/*
+
+ var dialogResult = await dialog.ShowAsync();
+
+ /*
+ // TODO: Add run as adminstrator
// Disabled as I am unsure how to prompt to run as admin.
if (didReset.PromptToRelaunchAsAdmin == true && dialogResult == ContentDialogResult.Secondary)
{
@@ -352,9 +338,7 @@ async void MainGridView_SelectionChanged(object sender, SelectionChangedEventArg
}
}
-
-
- async Task LoadGamesAndDlls()
+ private async Task LoadGamesAndDlls()
{
if (_loadingGamesAndDlls)
return;
@@ -367,7 +351,6 @@ async Task LoadGamesAndDlls()
var tasks = new List();
tasks.Add(LoadGamesAsync());
-
await Task.WhenAll(tasks);
DispatcherQueue.TryEnqueue(() =>
@@ -377,12 +360,12 @@ async Task LoadGamesAndDlls()
});
}
- async void RefreshButton_Click(object sender, RoutedEventArgs e)
+ private async void RefreshButton_Click(object sender, RoutedEventArgs e)
{
await LoadGamesAndDlls();
}
- async void FilterButton_Click(object sender, RoutedEventArgs e)
+ private async void FilterButton_Click(object sender, RoutedEventArgs e)
{
var gameFilterControl = new GameFilterControl();
@@ -396,7 +379,7 @@ async void FilterButton_Click(object sender, RoutedEventArgs e)
};
var result = await dialog.ShowAsync();
- if (result == ContentDialogResult.Primary)
+ if (result is ContentDialogResult.Primary)
{
Settings.Instance.HideNonDLSSGames = gameFilterControl.IsHideNonDLSSGamesChecked();
Settings.Instance.GroupGameLibrariesTogether = gameFilterControl.IsGroupGameLibrariesTogetherChecked();
From d5fb9e3d0350051f4c3aea22c6e4409d38f91510 Mon Sep 17 00:00:00 2001
From: Zagrthos <36556009+Zagrthos@users.noreply.github.com>
Date: Wed, 21 Aug 2024 23:40:26 +0200
Subject: [PATCH 10/13] Formatting and improving of GameGridPage.xaml
---
src/Pages/GameGridPage.xaml | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/Pages/GameGridPage.xaml b/src/Pages/GameGridPage.xaml
index ce4d7b2..d47bebc 100644
--- a/src/Pages/GameGridPage.xaml
+++ b/src/Pages/GameGridPage.xaml
@@ -1,12 +1,11 @@
@@ -21,7 +20,6 @@
-
From ddc556ffee028c649cdb96df935d3405f9e48585 Mon Sep 17 00:00:00 2001
From: Zagrthos <36556009+Zagrthos@users.noreply.github.com>
Date: Thu, 22 Aug 2024 08:44:46 +0200
Subject: [PATCH 11/13] Switch to `IsNullOrEmpty()` again
---
src/Pages/GameGridPage.xaml.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Pages/GameGridPage.xaml.cs b/src/Pages/GameGridPage.xaml.cs
index 29cdd9e..96f1a6c 100644
--- a/src/Pages/GameGridPage.xaml.cs
+++ b/src/Pages/GameGridPage.xaml.cs
@@ -241,7 +241,7 @@ private async void MainGridView_SelectionChanged(object sender, SelectionChanged
Content = dlssPickerControl,
};
- if (!string.IsNullOrWhiteSpace(game.BaseDLSSVersion))
+ if (string.IsNullOrEmpty(game.BaseDLSSVersion) is false)
{
dialog.SecondaryButtonText = "Reset";
}
From d0e5a3cbeeb26104a9babe52865ec5f2df73ffe2 Mon Sep 17 00:00:00 2001
From: Zagrthos <36556009+Zagrthos@users.noreply.github.com>
Date: Thu, 22 Aug 2024 08:44:56 +0200
Subject: [PATCH 12/13] Explicit boolean checks
---
src/Pages/GameGridPage.xaml.cs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/Pages/GameGridPage.xaml.cs b/src/Pages/GameGridPage.xaml.cs
index 96f1a6c..9664c3f 100644
--- a/src/Pages/GameGridPage.xaml.cs
+++ b/src/Pages/GameGridPage.xaml.cs
@@ -165,7 +165,7 @@ private void FilterGames()
{
foreach (var gameLibrary in GameLibraries)
{
- games.AddRange(gameLibrary.LoadedGames.Where(g => g.HasDLSS));
+ games.AddRange(gameLibrary.LoadedGames.Where(g => g.HasDLSS is true));
}
}
else
@@ -203,7 +203,7 @@ private async void MainGridView_SelectionChanged(object sender, SelectionChanged
{
EasyContentDialog dialog;
- if (!game.HasDLSS)
+ if (game.HasDLSS is false)
{
dialog = new EasyContentDialog(XamlRoot)
{
@@ -252,7 +252,7 @@ private async void MainGridView_SelectionChanged(object sender, SelectionChanged
{
var selectedDLSSRecord = dlssPickerControl.GetSelectedDLSSRecord();
- if (selectedDLSSRecord.LocalRecord.IsDownloading || !selectedDLSSRecord.LocalRecord.IsDownloaded)
+ if (selectedDLSSRecord.LocalRecord.IsDownloading is true || selectedDLSSRecord.LocalRecord.IsDownloaded is false)
{
// TODO: Initiate download here.
dialog = new(XamlRoot)
@@ -269,7 +269,7 @@ private async void MainGridView_SelectionChanged(object sender, SelectionChanged
var didUpdate = game.UpdateDll(selectedDLSSRecord);
- if (!didUpdate.Success)
+ if (didUpdate.Success is false)
{
dialog = new(XamlRoot)
{
@@ -304,7 +304,7 @@ private async void MainGridView_SelectionChanged(object sender, SelectionChanged
{
var didReset = game.ResetDll();
- if (!didReset.Success)
+ if (didReset.Success is false)
{
dialog = new EasyContentDialog(XamlRoot)
{
From 464c7eb401c7f6b5f3be3cd750fda9e85d4b466b Mon Sep 17 00:00:00 2001
From: Zagrthos <36556009+Zagrthos@users.noreply.github.com>
Date: Sun, 25 Aug 2024 13:32:58 +0200
Subject: [PATCH 13/13] Fix downloaded versions not showing when option is
disabled
---
src/UserControls/DLSSPickerControl.xaml.cs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/UserControls/DLSSPickerControl.xaml.cs b/src/UserControls/DLSSPickerControl.xaml.cs
index 2275d2f..ca17899 100644
--- a/src/UserControls/DLSSPickerControl.xaml.cs
+++ b/src/UserControls/DLSSPickerControl.xaml.cs
@@ -17,7 +17,14 @@ public DLSSPickerControl(Game game)
{
_game = game;
bool hideNotDownloaded = Settings.Instance.HideNotDownloadedVersions;
- DLSSRecords.AddRange(App.CurrentApp.MainWindow.CurrentDLSSRecords.Where(r => r.LocalRecord.IsDownloaded == hideNotDownloaded));
+ if (hideNotDownloaded)
+ {
+ DLSSRecords.AddRange(App.CurrentApp.MainWindow.CurrentDLSSRecords.Where(r => r.LocalRecord.IsDownloaded is true));
+ }
+ else
+ {
+ DLSSRecords.AddRange(App.CurrentApp.MainWindow.CurrentDLSSRecords);
+ }
this.InitializeComponent();
DataContext = this;