9
9
using Flow . Launcher . Infrastructure . UserSettings ;
10
10
using Flow . Launcher . Plugin . SharedCommands ;
11
11
using System . Linq ;
12
+ using CommunityToolkit . Mvvm . DependencyInjection ;
13
+ using Flow . Launcher . Plugin ;
12
14
13
15
namespace Flow . Launcher . Core . Configuration
14
16
{
15
17
public class Portable : IPortable
16
18
{
19
+ private readonly IPublicAPI API = Ioc . Default . GetRequiredService < IPublicAPI > ( ) ;
20
+
17
21
/// <summary>
18
22
/// As at Squirrel.Windows version 1.5.2, UpdateManager needs to be disposed after finish
19
23
/// </summary>
@@ -40,7 +44,7 @@ public void DisablePortableMode()
40
44
#endif
41
45
IndicateDeletion ( DataLocation . PortableDataPath ) ;
42
46
43
- MessageBoxEx . Show ( "Flow Launcher needs to restart to finish disabling portable mode, " +
47
+ API . ShowMsgBox ( "Flow Launcher needs to restart to finish disabling portable mode, " +
44
48
"after the restart your portable data profile will be deleted and roaming data profile kept" ) ;
45
49
46
50
UpdateManager . RestartApp ( Constant . ApplicationFileName ) ;
@@ -64,7 +68,7 @@ public void EnablePortableMode()
64
68
#endif
65
69
IndicateDeletion ( DataLocation . RoamingDataPath ) ;
66
70
67
- MessageBoxEx . Show ( "Flow Launcher needs to restart to finish enabling portable mode, " +
71
+ API . ShowMsgBox ( "Flow Launcher needs to restart to finish enabling portable mode, " +
68
72
"after the restart your roaming data profile will be deleted and portable data profile kept" ) ;
69
73
70
74
UpdateManager . RestartApp ( Constant . ApplicationFileName ) ;
@@ -95,13 +99,13 @@ public void RemoveUninstallerEntry()
95
99
96
100
public void MoveUserDataFolder ( string fromLocation , string toLocation )
97
101
{
98
- FilesFolders . CopyAll ( fromLocation , toLocation , MessageBoxEx . Show ) ;
102
+ FilesFolders . CopyAll ( fromLocation , toLocation , ( s ) => API . ShowMsgBox ( s ) ) ;
99
103
VerifyUserDataAfterMove ( fromLocation , toLocation ) ;
100
104
}
101
105
102
106
public void VerifyUserDataAfterMove ( string fromLocation , string toLocation )
103
107
{
104
- FilesFolders . VerifyBothFolderFilesEqual ( fromLocation , toLocation , MessageBoxEx . Show ) ;
108
+ FilesFolders . VerifyBothFolderFilesEqual ( fromLocation , toLocation , ( s ) => API . ShowMsgBox ( s ) ) ;
105
109
}
106
110
107
111
public void CreateShortcuts ( )
@@ -157,13 +161,13 @@ public void PreStartCleanUpAfterPortabilityUpdate()
157
161
// delete it and prompt the user to pick the portable data location
158
162
if ( File . Exists ( roamingDataDeleteFilePath ) )
159
163
{
160
- FilesFolders . RemoveFolderIfExists ( roamingDataDir , MessageBoxEx . Show ) ;
164
+ FilesFolders . RemoveFolderIfExists ( roamingDataDir , ( s ) => API . ShowMsgBox ( s ) ) ;
161
165
162
- if ( MessageBoxEx . Show ( "Flow Launcher has detected you enabled portable mode, " +
166
+ if ( API . ShowMsgBox ( "Flow Launcher has detected you enabled portable mode, " +
163
167
"would you like to move it to a different location?" , string . Empty ,
164
168
MessageBoxButton . YesNo ) == MessageBoxResult . Yes )
165
169
{
166
- FilesFolders . OpenPath ( Constant . RootDirectory , MessageBoxEx . Show ) ;
170
+ FilesFolders . OpenPath ( Constant . RootDirectory , ( s ) => API . ShowMsgBox ( s ) ) ;
167
171
168
172
Environment . Exit ( 0 ) ;
169
173
}
@@ -172,9 +176,9 @@ public void PreStartCleanUpAfterPortabilityUpdate()
172
176
// delete it and notify the user about it.
173
177
else if ( File . Exists ( portableDataDeleteFilePath ) )
174
178
{
175
- FilesFolders . RemoveFolderIfExists ( portableDataDir , MessageBoxEx . Show ) ;
179
+ FilesFolders . RemoveFolderIfExists ( portableDataDir , ( s ) => API . ShowMsgBox ( s ) ) ;
176
180
177
- MessageBoxEx . Show ( "Flow Launcher has detected you disabled portable mode, " +
181
+ API . ShowMsgBox ( "Flow Launcher has detected you disabled portable mode, " +
178
182
"the relevant shortcuts and uninstaller entry have been created" ) ;
179
183
}
180
184
}
@@ -186,7 +190,7 @@ public bool CanUpdatePortability()
186
190
187
191
if ( roamingLocationExists && portableLocationExists )
188
192
{
189
- MessageBoxEx . Show ( string . Format ( "Flow Launcher detected your user data exists both in {0} and " +
193
+ API . ShowMsgBox ( string . Format ( "Flow Launcher detected your user data exists both in {0} and " +
190
194
"{1}. {2}{2}Please delete {1} in order to proceed. No changes have occurred." ,
191
195
DataLocation . PortableDataPath , DataLocation . RoamingDataPath , Environment . NewLine ) ) ;
192
196
0 commit comments