33using System . IO ;
44using System . Linq ;
55using System . Threading . Tasks ;
6+ using AppImageDesktopFileCreator ;
67using Avalonia . Platform . Storage ;
78using Avalonia . Threading ;
89using AvaloniaControls ;
@@ -41,23 +42,23 @@ public class MsuWindowService(ILogger<MsuWindowService> logger,
4142
4243 public MsuWindowViewModel InitializeModel ( )
4344 {
44- msuLookupService . OnMsuLookupStarted += ( sender , args ) =>
45+ msuLookupService . OnMsuLookupStarted += ( _ , _ ) =>
4546 {
4647 Model . AreMsusLoading = true ;
4748 } ;
4849
49- msuLookupService . OnMsuLookupComplete += ( sender , args ) =>
50+ msuLookupService . OnMsuLookupComplete += ( _ , _ ) =>
5051 {
5152 Model . AreMsusLoading = false ;
5253 } ;
5354
54- msuMonitorService . MsuMonitorStarted += ( sender , args ) =>
55+ msuMonitorService . MsuMonitorStarted += ( _ , _ ) =>
5556 {
5657 Model . IsMsuMonitorActive = true ;
5758 MsuMonitorStarted ? . Invoke ( this , EventArgs . Empty ) ;
5859 } ;
5960
60- msuMonitorService . MsuMonitorStopped += ( sender , args ) =>
61+ msuMonitorService . MsuMonitorStopped += ( _ , _ ) =>
6162 {
6263 Model . IsMsuMonitorActive = false ;
6364 MsuMonitorStopped ? . Invoke ( this , EventArgs . Empty ) ;
@@ -83,10 +84,31 @@ public MsuWindowViewModel InitializeModel()
8384 Model . DisplayMsuTypeComboBox = false ;
8485 Model . FilterColumnIndex = 0 ;
8586 }
87+
88+ Model . DisplaySettingsWindowOnLoad = Model is { MsuWindowDisplayOptionsButton : true , HasMsuFolder : false } ;
89+
90+ if ( OperatingSystem . IsLinux ( ) && Model . MsuWindowDisplayOptionsButton && ! userOptions . MsuUserOptions . SkipDesktopFile &&
91+ ! DesktopFileCreator . CheckIfDesktopFileExists ( "org.mattequalscoder.msurandomizer" ) )
92+ {
93+ Model . DisplayDesktopPopupOnLoad = true ;
94+ }
8695
8796 return Model ;
8897 }
8998
99+ public void HandleUserDesktopResponse ( bool addDesktopFile )
100+ {
101+ if ( addDesktopFile && OperatingSystem . IsLinux ( ) )
102+ {
103+ Program . BuildLinuxDesktopFile ( ) ;
104+ }
105+ else
106+ {
107+ userOptions . MsuUserOptions . SkipDesktopFile = true ;
108+ userOptions . Save ( ) ;
109+ }
110+ }
111+
90112 private void AppInitializationServiceOnInitializationComplete ( object ? sender , EventArgs e )
91113 {
92114 if ( appInitializationService . LatestFullRelease == null )
@@ -96,7 +118,7 @@ private void AppInitializationServiceOnInitializationComplete(object? sender, Ev
96118
97119 Dispatcher . UIThread . Invoke ( ( ) =>
98120 {
99- var messageWindow = new MessageWindow ( new MessageWindowRequest ( )
121+ var messageWindow = new MessageWindow ( new MessageWindowRequest
100122 {
101123 Title = $ "MSU Randomizer { appInitializationService . LatestFullRelease . Tag } ",
102124 Message = "A new version of the MSU Randomizer has been released." ,
@@ -106,7 +128,7 @@ private void AppInitializationServiceOnInitializationComplete(object? sender, Ev
106128 CheckBoxText = "Do not check for updates" ,
107129 Buttons = MessageWindowButtons . OK
108130 } ) ;
109- messageWindow . Closed += ( o , args ) =>
131+ messageWindow . Closed += ( _ , _ ) =>
110132 {
111133 if ( messageWindow . DialogResult ? . CheckedBox == true )
112134 {
@@ -368,7 +390,6 @@ private void MsuTypeServiceOnOnMsuTypeLoadComplete(object? sender, EventArgs e)
368390 foreach ( var entry in userOptions . MsuUserOptions . MsuDirectories )
369391 {
370392 var path = entry . Key ;
371- var msuTypeName = entry . Value ;
372393 var directoryMsuType = msuTypeService . GetMsuType ( Model . SelectedMsuType ) ;
373394 if ( directoryMsuType == null )
374395 {
0 commit comments