@@ -250,7 +250,9 @@ public async Task CheckForAllModUpdatesAsync()
250250 {
251251 IsBusy = true ;
252252 var download = new Download ( Localize ( "Download.Text.CheckModUpdate" ) , true , - 1 ) ;
253- download . Run ( this ) ;
253+ if ( promptUpdate )
254+ download . Run ( this ) ;
255+
254256 try
255257 {
256258 if ( await mod . Updater ! . CheckForUpdatesAsync ( c ) == true )
@@ -266,30 +268,27 @@ public async Task CheckForAllModUpdatesAsync()
266268 Logger . Debug ( $ "Update found for { mod . Title } ") ;
267269 Logger . Debug ( $ " Current: { mod . Version } ") ;
268270 Logger . Debug ( $ " Latest: { info . Version } ") ;
269- if ( promptUpdate )
271+ var messageBox = new MessageBoxModal ( "Modal.Title.UpdateMod" , Localize ( "Modal.Message.UpdateMod" , mod . Title ) ) ;
272+ messageBox . AddButton ( "Common.Button.Cancel" , ( s , e ) => messageBox . Close ( ) ) ;
273+ messageBox . AddButton ( "Common.Button.Update" , async ( s , e ) =>
270274 {
271- var messageBox = new MessageBoxModal ( "Modal.Title.UpdateMod" , Localize ( "Modal.Message.UpdateMod" , mod . Title ) ) ;
272- messageBox . AddButton ( "Common.Button.Cancel" , ( s , e ) => messageBox . Close ( ) ) ;
273- messageBox . AddButton ( "Common.Button.Update" , async ( s , e ) =>
275+ // TODO: Look into threading issues
276+ await Dispatcher . UIThread . InvokeAsync ( async ( ) =>
274277 {
275- // TODO: Look into threading issues
276- await Dispatcher . UIThread . InvokeAsync ( async ( ) =>
277- {
278- Modals . Where ( x => x . Control is ModInfoModal ) . ToList ( ) . ForEach ( x => x . Close ( ) ) ;
279- Logger . Information ( $ "Update clicked for { mod . Title } ") ;
280- messageBox . Close ( ) ;
281- await CreateSimpleDownload ( Localize ( "Download.Text.UpdateMod" , mod . Title ) ,
282- "Failed to update mod" , "Modal.Title.UpdateError" , Localize ( "Modal.Message.UpdateModError" , mod . Title ) ,
283- async ( d , p , c ) =>
284- {
285- await mod . Updater . PerformUpdateAsync ( p , c ) ;
286- } ) . RunAsync ( this ) ;
287- Modals . Where ( x => x . Control is ModInfoModal ) . ToList ( ) . ForEach ( x => x . Close ( ) ) ;
288- RefreshGame ( ) ;
289- } ) ;
278+ Modals . Where ( x => x . Control is ModInfoModal ) . ToList ( ) . ForEach ( x => x . Close ( ) ) ;
279+ Logger . Information ( $ "Update clicked for { mod . Title } ") ;
280+ messageBox . Close ( ) ;
281+ await CreateSimpleDownload ( Localize ( "Download.Text.UpdateMod" , mod . Title ) ,
282+ "Failed to update mod" , "Modal.Title.UpdateError" , Localize ( "Modal.Message.UpdateModError" , mod . Title ) ,
283+ async ( d , p , c ) =>
284+ {
285+ await mod . Updater . PerformUpdateAsync ( p , c ) ;
286+ } ) . RunAsync ( this ) ;
287+ Modals . Where ( x => x . Control is ModInfoModal ) . ToList ( ) . ForEach ( x => x . Close ( ) ) ;
288+ RefreshGame ( ) ;
290289 } ) ;
291- messageBox . Open ( this ) ;
292- }
290+ } ) ;
291+ messageBox . Open ( this ) ;
293292 return info ;
294293 }
295294 }
0 commit comments