@@ -297,25 +297,25 @@ private static bool IsNotificationTimestampValid(NotificationProp Entry)
297297 return isBeginValid && isEndValid ;
298298 }
299299
300+ private async void ChangeRegion ( object sender , RoutedEventArgs e )
301+ {
302+ try
303+ {
304+ ToggleChangeRegionBtn ( sender , true ) ;
305+ ChangeRegionInstant ( ) ;
306+ }
307+ finally
308+ {
309+ ToggleChangeRegionBtn ( sender , false ) ;
310+ }
311+ }
312+
300313 private async void ChangeRegionNoWarning ( object sender , RoutedEventArgs e )
301314 {
302315 try
303316 {
304317 ( sender as Button ) ? . IsEnabled = false;
305- if ( ! IsLoadRegionComplete )
306- {
307- return ;
308- }
309-
310- _lockRegionChangeBtn = true ;
311- _currentGameCategory = ComboBoxGameTitle . SelectedIndex ;
312- _currentGameRegion = ComboBoxGameRegion . SelectedIndex ;
313- await LoadRegionRootButton ( ) ;
314- InvokeLoadingRegionPopup ( false ) ;
315-
316- MainFrameChanger . ChangeMainFrame ( m_appMode == AppMode . Hi3CacheUpdater
317- ? typeof ( CachesPage )
318- : typeof ( HomePage ) , true ) ;
318+ ChangeRegionInstant ( ) ;
319319 }
320320 catch ( Exception ex )
321321 {
@@ -324,7 +324,7 @@ private async void ChangeRegionNoWarning(object sender, RoutedEventArgs e)
324324 }
325325 finally
326326 {
327- _lockRegionChangeBtn = false ;
327+ ( sender as Button ) ? . IsEnabled = true ;
328328 }
329329 }
330330
@@ -341,7 +341,6 @@ private async void ChangeRegionInstant()
341341 _currentGameCategory = ComboBoxGameTitle . SelectedIndex ;
342342 _currentGameRegion = ComboBoxGameRegion . SelectedIndex ;
343343 await LoadRegionRootButton ( ) ;
344- InvokeLoadingRegionPopup ( false ) ;
345344
346345 MainFrameChanger . ChangeMainFrame ( m_appMode == AppMode . Hi3CacheUpdater
347346 ? typeof ( CachesPage )
@@ -355,39 +354,7 @@ private async void ChangeRegionInstant()
355354 finally
356355 {
357356 _lockRegionChangeBtn = false ;
358- }
359- }
360-
361- private async void ChangeRegion ( object sender , RoutedEventArgs e )
362- {
363- try
364- {
365- if ( ! IsLoadRegionComplete )
366- {
367- return ;
368- }
369-
370- // Disable ChangeRegionBtn and hide flyout
371- _lockRegionChangeBtn = true ;
372- ToggleChangeRegionBtn ( sender , true ) ;
373- if ( ! await LoadRegionRootButton ( ) )
374- {
375- return ;
376- }
377-
378- // Finalize loading
379- ToggleChangeRegionBtn ( sender , false ) ;
380- _currentGameCategory = ComboBoxGameTitle . SelectedIndex ;
381- _currentGameRegion = ComboBoxGameRegion . SelectedIndex ;
382- }
383- catch ( Exception ex )
384- {
385- LogWriteLine ( $ "Failed while changing region with normal method\r \n { ex } ", LogType . Error , true ) ;
386- await SentryHelper . ExceptionHandlerAsync ( ex ) ;
387- }
388- finally
389- {
390- _lockRegionChangeBtn = false ;
357+ InvokeLoadingRegionPopup ( false ) ;
391358 }
392359 }
393360
0 commit comments