Skip to content

Commit

Permalink
Revert "Don't use async void"
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Sep 6, 2023
1 parent 66509d9 commit 3935a18
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Threading.Tasks;
using LightBulb.Core;
using LightBulb.Services;
using Stylet;
Expand Down Expand Up @@ -48,9 +47,9 @@ public LocationSettingsTabViewModel(SettingsService settingsService)
);
}

public bool CanAutoDetectLocationAsync => !IsBusy;
public bool CanAutoDetectLocation => !IsBusy;

public async Task AutoDetectLocationAsync()
public async void AutoDetectLocation()
{
IsBusy = true;
IsLocationError = false;
Expand All @@ -69,12 +68,12 @@ public async Task AutoDetectLocationAsync()
}
}

public bool CanSetLocationAsync =>
public bool CanSetLocation =>
!IsBusy
&& !string.IsNullOrWhiteSpace(LocationQuery)
&& LocationQuery != Location?.ToString();

public async Task SetLocationAsync()
public async void SetLocation()
{
if (string.IsNullOrWhiteSpace(LocationQuery))
return;
Expand Down
2 changes: 1 addition & 1 deletion LightBulb/ViewModels/RootViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public async void OnViewFullyLoaded()
await ShowUkraineSupportMessageAsync();
}

public async Task ShowSettingsAsync() =>
public async void ShowSettings() =>
await _dialogManager.ShowDialogAsync(_viewModelFactory.CreateSettingsViewModel());

public void ShowAbout() => ProcessEx.StartShellExecute(App.GitHubProjectUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
Margin="16,0,0,0"
Padding="4"
VerticalAlignment="Center"
Command="{s:Action AutoDetectLocationAsync}"
Command="{s:Action AutoDetectLocation}"
Style="{DynamicResource MaterialDesignFlatButton}"
ToolTip="Try to detect location automatically based on your IP">
<materialDesign:PackIcon
Expand Down Expand Up @@ -134,7 +134,7 @@
Margin="0,0,16,0"
Padding="4"
VerticalAlignment="Center"
Command="{s:Action SetLocationAsync}"
Command="{s:Action SetLocation}"
IsDefault="True"
Style="{DynamicResource MaterialDesignFlatButton}"
ToolTip="Set location">
Expand Down
2 changes: 1 addition & 1 deletion LightBulb/Views/RootView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
<!-- Settings -->
<Button
Margin="8"
Command="{s:Action ShowSettingsAsync}"
Command="{s:Action ShowSettings}"
Style="{DynamicResource MaterialDesignFlatButton}"
ToolTip="Open settings">
<StackPanel Orientation="Horizontal">
Expand Down

0 comments on commit 3935a18

Please sign in to comment.