Skip to content

Commit

Permalink
Remove ConfigureAwaits from UI
Browse files Browse the repository at this point in the history
  • Loading branch information
BartoszCichecki committed Apr 16, 2024
1 parent d7302cc commit 7d53727
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion LenovoLegionToolkit.WPF/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ private static async Task InitGpuOverclockControllerAsync()
if (Log.Instance.IsTraceEnabled)
Log.Instance.Trace($"Ensuring GPU overclock is applied...");

var result = await controller.EnsureOverclockIsAppliedAsync().ConfigureAwait(false);
var result = await controller.EnsureOverclockIsAppliedAsync();
if (result)
{
if (Log.Instance.IsTraceEnabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ private async Task StartAnimationAsync()
await StopAnimationAsync();

if (_refreshStateCancellationTokenSource is not null)
await _refreshStateCancellationTokenSource.CancelAsync().ConfigureAwait(false);
await _refreshStateCancellationTokenSource.CancelAsync();

_refreshStateCancellationTokenSource = new();

Expand All @@ -354,7 +354,7 @@ private async Task StopAnimationAsync()
using (await _startStopAnimationLock.LockAsync())
{
if (_refreshStateCancellationTokenSource is not null)
await _refreshStateCancellationTokenSource.CancelAsync().ConfigureAwait(false);
await _refreshStateCancellationTokenSource.CancelAsync();

_refreshStateCancellationTokenSource = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private async void DownloadButton_Click(object sender, RoutedEventArgs e)
_downloadingStackPanel.Visibility = Visibility.Visible;

if (_downloadPackageTokenSource is not null)
await _downloadPackageTokenSource.CancelAsync().ConfigureAwait(false);
await _downloadPackageTokenSource.CancelAsync();

_downloadPackageTokenSource = new();

Expand Down
2 changes: 1 addition & 1 deletion LenovoLegionToolkit.WPF/Pages/BatteryPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void Refresh()
try
{
var batteryInfo = Battery.GetBatteryInformation();
var powerAdapterStatus = await Power.IsPowerAdapterConnectedAsync().ConfigureAwait(false);
var powerAdapterStatus = await Power.IsPowerAdapterConnectedAsync();
var onBatterySince = Battery.GetOnBatterySince();
Dispatcher.Invoke(() => Set(batteryInfo, powerAdapterStatus, onBatterySince));

Expand Down
2 changes: 1 addition & 1 deletion LenovoLegionToolkit.WPF/Pages/PackagesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private async void FilterTextBox_TextChanged(object sender, TextChangedEventArgs
return;

if (_filterDebounceCancellationTokenSource is not null)
await _filterDebounceCancellationTokenSource.CancelAsync().ConfigureAwait(false);
await _filterDebounceCancellationTokenSource.CancelAsync();

_filterDebounceCancellationTokenSource = new();

Expand Down
14 changes: 7 additions & 7 deletions LenovoLegionToolkit.WPF/Windows/Utils/StatusWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ private static async Task<StatusWindowData> GetStatusWindowDataAsync()

try
{
if (await powerModeFeature.IsSupportedAsync().ConfigureAwait(false))
if (await powerModeFeature.IsSupportedAsync())
{
state = await powerModeFeature.GetStateAsync().ConfigureAwait(false);
state = await powerModeFeature.GetStateAsync();

if (state == PowerModeState.GodMode)
godModePresetName = await godModeController.GetActivePresetNameAsync().ConfigureAwait(false);
godModePresetName = await godModeController.GetActivePresetNameAsync();
}
}
catch { /* Ignored */ }

try
{
if (gpuController.IsSupported())
gpuStatus = await gpuController.RefreshNowAsync().ConfigureAwait(false);
gpuStatus = await gpuController.RefreshNowAsync();

}
catch { /* Ignored */ }
Expand All @@ -79,15 +79,15 @@ private static async Task<StatusWindowData> GetStatusWindowDataAsync()

try
{
if (await batteryFeature.IsSupportedAsync().ConfigureAwait(false))
batteryState = await batteryFeature.GetStateAsync().ConfigureAwait(false);
if (await batteryFeature.IsSupportedAsync())
batteryState = await batteryFeature.GetStateAsync();

}
catch { /* Ignored */ }

try
{
hasUpdate = await updateChecker.CheckAsync().ConfigureAwait(false) is not null;
hasUpdate = await updateChecker.CheckAsync() is not null;
}
catch { /* Ignored */ }

Expand Down

0 comments on commit 7d53727

Please sign in to comment.