Skip to content

Commit

Permalink
fix: Remove async/await from sync methods and add static modifier
Browse files Browse the repository at this point in the history
Refactored methods in PosterPickerViewModel to remove unnecessary async/await usage for synchronous operations. Made ProcessSubfolders method in MainWindowViewModel static to align it with its usage context. Added an async keyword to SearchAgainMethod to correctly await StartSearch execution in SearchResultViewModel.
  • Loading branch information
DineshSolanki committed Jul 26, 2024
1 parent 7f233db commit 6ee179f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion FoliCon/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ private void AddToFinalList(string itemTitle)
}
}

private void ProcessSubfolders(string folderPath, Queue<string> folderQueue)
private static void ProcessSubfolders(string folderPath, Queue<string> folderQueue)
{
Logger.Trace("Subfolder Processing Enabled, Processing Subfolders.");
var folders = FileUtils.GetAllSubFolders(folderPath, Services.Settings.Patterns);
Expand Down
6 changes: 3 additions & 3 deletions FoliCon/ViewModels/PosterPickerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private async Task LoadMediaData(string resultType, dynamic response)
if (images != null)
{
var imageDataWrappers = images.Posters.Select(imageData => new ImageDataWrapper(images.Id, imageData, TmdbObject.GetClient()));
await LoadImages(imageDataWrappers);
LoadImages(imageDataWrappers);
}
}

Expand Down Expand Up @@ -196,13 +196,13 @@ private async Task LoadGameData(dynamic response)
Logger.Debug("Media Type is Game, loading images from IGDB");
Artwork[] images = response.Artworks.Values;
var artworkWrappers = images.Select(artwork => new ArtworkWrapper(artwork));
await LoadImages(artworkWrappers);
LoadImages(artworkWrappers);
}

#endregion


private async Task LoadImages(IEnumerable<IImage> images)
private void LoadImages(IEnumerable<IImage> images)
{
ResetState();
IsBusy = true;
Expand Down
4 changes: 2 additions & 2 deletions FoliCon/ViewModels/SearchResultViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ private void LoadData(string searchTitle)
PerformSelectionChanged();
}

private void SearchAgainMethod()
private async void SearchAgainMethod()
{
if (!string.IsNullOrWhiteSpace(SearchAgainTitle))
{
StartSearch(false);
await StartSearch(false);
}
}

Expand Down

0 comments on commit 6ee179f

Please sign in to comment.