Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new in-app “data center” WebView2 window for Wuthering Waves, introduces a “refresh current page” action wired through the MVVM messenger, and adjusts several V2 game page/UI and downloader/update flows (plus version bumps).
Changes:
- Add
KuroDataCenterWindow+ WebView2 session bootstrap (WebSessionContext,WebViewHostInitializer) and wireOpenDataCenterto open it. - Add “refresh current page” command in shell and hook game pages to run
LoadedCommandon page load. - Update several V2 game context/download/update behaviors and bump app/setup versions.
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| src/WutheringWavesTool/WindowModels/KuroDataCenterWindow.xaml.cs | New WinUI window code-behind hosting the WebView2 data center page. |
| src/WutheringWavesTool/WindowModels/KuroDataCenterWindow.xaml | New window XAML layout for the data center WebView2 view. |
| src/WutheringWavesTool/ViewModel/WikiViewModels/WavesWikiViewModel.cs | Inject IAppContext, remove stamina usage, and open the new data center window. |
| src/WutheringWavesTool/ViewModel/WikiViewModels/PunishWikiViewModel.cs | Make Dispose null-safe. |
| src/WutheringWavesTool/ViewModel/ShellViewModel.cs | Add command to send a refresh message for the current page. |
| src/WutheringWavesTool/ViewModel/GameViewModels/KuroGameContextViewModelV2/KuroGameContextViewModelV2.cs | Register refresh messenger + add Loaded command and some UI text updates. |
| src/WutheringWavesTool/ViewModel/GameViewModels/KuroGameContextViewModelV2/KuroGameContextViewModelV2.Predownloader.cs | Add pause/resume toggle handling for predownload command. |
| src/WutheringWavesTool/ViewModel/DialogViewModels/UpdateGameViewModel.cs | Switch dialog VM to use IGameContextV2. |
| src/WutheringWavesTool/Pages/ShellPage.xaml | Add a refresh button in the title bar footer bound to the new command. |
| src/WutheringWavesTool/Pages/GameWikis/WavesWikiPage.xaml | Update UI text and replace stamina panel with “敬请期待”. |
| src/WutheringWavesTool/Pages/GamePages/WavesV2GamePage.xaml | Invoke LoadedCommand via Xaml behaviors and adjust launcher/predownload UI layout. |
| src/WutheringWavesTool/Pages/GamePages/PunishV2GamePage.xaml | Invoke LoadedCommand via Xaml behaviors and adjust launcher/predownload UI layout. |
| src/WutheringWavesTool/Pages/Dialogs/UpdateGameDialog.xaml.cs | Resolve keyed IGameContextV2 for the update dialog. |
| src/WutheringWavesTool/Package.appxmanifest | Bump package version. |
| src/WutheringWavesTool/Models/WebSessionContext.cs | Add session model + source-gen JSON context used to seed WebView login/session. |
| src/WutheringWavesTool/Models/Messanger/RefreshGamePageMessager.cs | Add a new messenger message type for page refresh. |
| src/WutheringWavesTool/Haiyu.csproj | Update WebView2 package and add XAML Page compile entries. |
| src/WutheringWavesTool/Common/KuroWebView/WebViewHostInitializer.cs | Add WebView2 initialization + JS/cookie session injection for Kuro web pages. |
| src/WutheringWavesTool/App.xaml.cs | Bump app version string. |
| src/Waves.Core/Services/KuroClient/KuroClient.DataCenter.cs | Add retries and minor formatting for data-center API calls. |
| src/Waves.Core/Services/GameWikiClient.cs | Add null guard in GetEventData. |
| src/Waves.Core/Models/WavesQueryLocalPlayerInfoRequest.cs | Make some fields nullable/long? and update recover-time formatting logic. |
| src/Waves.Core/GameContext/KruoGameContextBaseV2/KuroGameContextBaseV2.cs | Refine pause logic for download vs predownload state. |
| src/Waves.Core/GameContext/KruoGameContextBaseV2/KuroGameContextBaseV2.UpdateGame.cs | Adjust CDN/resource selection + update task cleanup and check-all flow. |
| src/Waves.Core/GameContext/KruoGameContextBaseV2/KuroGameContextBaseV2.Download.cs | Adjust completion cleanup and cancellation/state reset behavior. |
| src/Setup/Project.WPFSetup/ViewModels/UserViewModels/UpdateViewModel.cs | Improve process-kill logic to handle multiple running instances. |
| src/Setup/Project.WPFSetup/ViewModels/UserViewModels/UninstallViewModel.cs | Improve process-kill logic to handle multiple running instances. |
| src/Setup/Project.WPFSetup/Resources/Resource1.resx | Bump setup version string. |
| src/Setup/Project.WPFSetup/Resources/Resource1.Designer.cs | Update generated XML doc string for the bumped version. |
Files not reviewed (1)
- src/Setup/Project.WPFSetup/Resources/Resource1.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private AppInstance mainInstance; | ||
|
|
||
| public static string AppVersion => "1.2.20"; | ||
| public static string AppVersion => "1.2.21"; |
There was a problem hiding this comment.
AppVersion was bumped to 1.2.21, but Package.appxmanifest is still Version="1.2.20.0" (and setup resources are also 1.2.21). Keeping these versions in sync avoids confusing users and update systems; update the manifest (and any other version sources) to match.
| <Page Update="Pages\Communitys\KuroDataCenterWindow.xaml"> | ||
| <Generator>MSBuild:Compile</Generator> | ||
| </Page> |
There was a problem hiding this comment.
The project file includes Pages\Communitys\KuroDataCenterWindow.xaml, but that file does not exist under src/WutheringWavesTool/Pages/Communitys. This will break builds; remove this <Page Update=...> entry or add the missing XAML file.
| <Page Update="Pages\Communitys\KuroDataCenterWindow.xaml"> | |
| <Generator>MSBuild:Compile</Generator> | |
| </Page> |
| for (int i = 0; i < 5; i++) | ||
| { | ||
| return null; | ||
| } | ||
| var result = await HttpClientService.HttpClient.SendAsync(request, token); | ||
| var jsonStr = await result.Content.ReadAsStringAsync(token); | ||
|
|
There was a problem hiding this comment.
The retry loop reuses the same HttpRequestMessage instance for multiple SendAsync calls. HttpRequestMessage is single-use; retrying with the same instance can throw (e.g., "The request message was already sent") or reuse disposed content. Build a new request inside the loop (or clone the request/content) before each retry.
| @@ -0,0 +1,36 @@ | |||
| using ABI.System; | |||
There was a problem hiding this comment.
using ABI.System; appears unused in this file. Removing it avoids unnecessary/unused imports (and potential type name ambiguity) under nullable/analyzer settings.
| using ABI.System; |
| private string? _documentScriptId; | ||
| private WebSessionContext _currentSession; | ||
| private bool _eventsHooked; |
There was a problem hiding this comment.
_currentSession is declared non-nullable but never initialized in the constructor, and it is used from the NavigationCompleted handler. This will raise nullable warnings and could throw if NavigationCompleted fires before InitializeAsync sets the session. Consider making it nullable and guarding before use (or initialize to a non-null sentinel).
| if (value == null) | ||
| { | ||
| field = 0; | ||
| } | ||
| if (value == 0) |
There was a problem hiding this comment.
When StoreEnergyRecoverTime is null, the setter assigns field = 0 but then continues execution; later it dereferences value!.Value, which will throw. After handling null, return immediately (or normalize null to 0 before subsequent checks).
| { | ||
| field = 0; |
There was a problem hiding this comment.
When EnergyRecoverTime is null, the setter assigns field = 0 but then continues execution; later it dereferences value!.Value, which will throw. After handling null, return immediately (or normalize null to 0 before subsequent checks).
| { | |
| field = 0; | |
| { | |
| this.EnergyRecoverEndTime = "已充满"; | |
| field = 0; | |
| return; |
| var cdnResult = await TestCdnAsync( | ||
| launcher.ResourceDefault.CdnList, | ||
| launcher.ResourceDefault.ResourcesBasePath, | ||
| patch.Resource | ||
| checkAllResource!.Resource | ||
| ); |
There was a problem hiding this comment.
GetGameResourceAsync returns IndexGameResource?, but checkAllResource!.Resource is dereferenced without a null check. If the resource index request fails or returns null, this will throw at runtime. Handle the null case before calling TestCdnAsync.
| WebViewHostInitializer hostInitializer; | ||
|
|
||
| public KuroDataCenterWindow(nint value, WebSessionContext context) |
There was a problem hiding this comment.
hostInitializer is a non-nullable field but it is only assigned in grid_Loaded. With <Nullable>enable</Nullable>, this will produce a nullability warning (and may be treated as an error depending on build settings). Make it nullable (WebViewHostInitializer?) or initialize it in the constructor.
|
|
||
| public class RefreshGamePageMessager(bool isRefresh) | ||
| { | ||
|
|
There was a problem hiding this comment.
RefreshGamePageMessager(bool isRefresh) defines a constructor parameter that is never stored or exposed, so the boolean passed by senders is effectively ignored. Either remove the parameter to make this a pure marker message, or add a public property/field so receivers can read isRefresh.
| public bool IsRefresh { get; } = isRefresh; |
No description provided.