Explorar o código

misc: chore: remove sender parameter from LdnGameData receieved event

Evan Husted hai 1 ano
pai
achega
3141c560fb

+ 3 - 6
src/Ryujinx/UI/Windows/MainWindow.axaml.cs

@@ -164,7 +164,7 @@ namespace Ryujinx.Ava.UI.Windows
             });
         }
 
-        private void ApplicationLibrary_LdnGameDataReceived(object sender, LdnGameDataReceivedEventArgs e)
+        private void ApplicationLibrary_LdnGameDataReceived(LdnGameDataReceivedEventArgs e)
         {
             Dispatcher.UIThread.Post(() =>
             {
@@ -408,13 +408,10 @@ namespace Ryujinx.Ava.UI.Windows
         {
             StatusBarView.VolumeStatus.Click += VolumeStatus_CheckedChanged;
 
+            ApplicationGrid.DataContext = ApplicationList.DataContext = ViewModel;
+            
             ApplicationGrid.ApplicationOpened += Application_Opened;
-
-            ApplicationGrid.DataContext = ViewModel;
-
             ApplicationList.ApplicationOpened += Application_Opened;
-
-            ApplicationList.DataContext = ViewModel;
         }
 
         private void SetWindowSizePosition()

+ 4 - 4
src/Ryujinx/Utilities/AppLibrary/ApplicationLibrary.cs

@@ -45,7 +45,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
         public const string DefaultLanPlayWebHost = "ryuldnweb.vudjun.com";
         public Language DesiredLanguage { get; set; }
         public event EventHandler<ApplicationCountUpdatedEventArgs> ApplicationCountUpdated;
-        public event EventHandler<LdnGameDataReceivedEventArgs> LdnGameDataReceived;
+        public event Action<LdnGameDataReceivedEventArgs> LdnGameDataReceived;
 
         public readonly IObservableCache<ApplicationData, ulong> Applications;
         public readonly IObservableCache<(TitleUpdateModel TitleUpdate, bool IsSelected), TitleUpdateModel> TitleUpdates;
@@ -779,7 +779,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
                     using HttpClient httpClient = new HttpClient();
                     string ldnGameDataArrayString = await httpClient.GetStringAsync($"https://{ldnWebHost}/api/public_games");
                     ldnGameDataArray = JsonHelper.Deserialize(ldnGameDataArrayString, _ldnDataSerializerContext.IEnumerableLdnGameData);
-                    LdnGameDataReceived?.Invoke(null, new LdnGameDataReceivedEventArgs
+                    LdnGameDataReceived?.Invoke(new LdnGameDataReceivedEventArgs
                     {
                         LdnData = ldnGameDataArray
                     });
@@ -787,7 +787,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
                 catch (Exception ex)
                 {
                     Logger.Warning?.Print(LogClass.Application, $"Failed to fetch the public games JSON from the API. Player and game count in the game list will be unavailable.\n{ex.Message}");
-                    LdnGameDataReceived?.Invoke(null, new LdnGameDataReceivedEventArgs
+                    LdnGameDataReceived?.Invoke(new LdnGameDataReceivedEventArgs
                     {
                         LdnData = Array.Empty<LdnGameData>()
                     });
@@ -795,7 +795,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
             }
             else
             {
-                LdnGameDataReceived?.Invoke(null, new LdnGameDataReceivedEventArgs
+                LdnGameDataReceived?.Invoke(new LdnGameDataReceivedEventArgs
                 {
                     LdnData = Array.Empty<LdnGameData>()
                 });