@@ -64,6 +64,7 @@ public MainWindow()
6464 FileSystem ( ) ;
6565
6666
67+
6768 ImmersiveExperiencePage = new ImmersiveExperience ( ) ;
6869 ImmersiveFinalisePage = new ImmersiveFinalise ( ) ;
6970 CurrentAppsPage = new CurrentApps ( ) ;
@@ -92,11 +93,20 @@ public MainWindow()
9293 {
9394 ErrorNotif . Visibility = Visibility . Visible ;
9495 }
96+
9597 JSONArrayList = ReadJSON ( ) ;
9698 // Trigger a refresh of many things. Not strictly necessary for all of this but hey extra refreshing is always nice
9799 Displays = GetDisplays ( ) ;
98100 RefreshLists ( ) ;
99101 DebugRefreshEvent ( ) ;
102+ if ( IsRunningAsUWP ( ) )
103+ {
104+ LogEntry ( "[ADP] Running in UWP mode" ) ;
105+ }
106+ else
107+ {
108+ LogEntry ( "[ADP] Running in legacy win32 mode" ) ;
109+ }
100110 if ( JSONArrayList . Count != 0 && WindowHandles . Count ( ) == 0 )
101111 {
102112 StartSavedApps ( ) ;
@@ -115,14 +125,7 @@ public MainWindow()
115125 {
116126 StartupInit ( ) ;
117127 }
118- if ( IsRunningAsUWP ( ) )
119- {
120- LogEntry ( "[ADP] Running in UWP mode" ) ;
121- }
122- else
123- {
124- LogEntry ( "[ADP] Running in legacy win32 mode" ) ;
125- }
128+
126129
127130 CurrentAppsPage . TitleTextBox . Text = "[Hold Ctrl to select an app]" ;
128131 CurrentAppsPage . HwndInputTextBox . Text = "" ;
@@ -317,7 +320,10 @@ public void RefreshLists()
317320 }
318321 }
319322 SavedListRefreshEvent ( ) ;
320- StartupInit ( ) ;
323+ if ( IsRunningAsUWP ( ) )
324+ {
325+ StartupInit ( ) ;
326+ }
321327 LogEntry ( "[ADP] Refreshed in-app lists" ) ;
322328 }
323329
@@ -1110,8 +1116,16 @@ private static bool EnumWindow(IntPtr handle, IntPtr pointer)
11101116 // Checks if running as a UWP app
11111117 public bool IsRunningAsUWP ( )
11121118 {
1113- Helpers helpers = new Helpers ( ) ;
1114- return helpers . IsRunningAsUwp ( ) ;
1119+ try
1120+ {
1121+ Helpers helpers = new Helpers ( ) ;
1122+ return helpers . IsRunningAsUwp ( ) ;
1123+ }
1124+ catch ( Exception )
1125+ {
1126+ return false ;
1127+ }
1128+
11151129 }
11161130
11171131 // Actually removes the borders
0 commit comments