Skip to content

Commit

Permalink
fix the bug where may crash when install game #1051
Browse files Browse the repository at this point in the history
  • Loading branch information
Scighost committed Aug 29, 2024
1 parent b36ab24 commit 27f1959
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Starward/MyWindows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.UI.Xaml.Media.Animation;
using Starward.Controls;
using Starward.Models;
using Starward.Services.Download;
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
Expand Down Expand Up @@ -145,7 +146,14 @@ private async void AppWindow_Closing(AppWindow sender, AppWindowClosingEventArgs
}
if (option is CloseWindowOption.Close)
{
App.Current.CloseMainWindow();
if (InstallGameManager.Instance.HasTask)
{
Hide();
}
else
{
App.Current.CloseMainWindow();
}
}
}
catch { }
Expand Down
3 changes: 3 additions & 0 deletions src/Starward/Services/Download/InstallGameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ private InstallGameManager()
public static InstallGameManager Instance => _instance ??= new();


public bool HasTask => _services.Count > 0;



public static TokenBucketRateLimiter RateLimiter { get; private set; }

Expand Down

0 comments on commit 27f1959

Please sign in to comment.