@@ -117,22 +117,18 @@ protected PackageManagerViewModel(string appName)
117
117
118
118
protected abstract void InvokeOnDispatcher ( Action action ) ;
119
119
120
+
120
121
/// <summary>
121
- /// Called when browsing for a package to open. Normally paired with OpenFileDialog
122
+ /// Called when browsing for a package to open.
122
123
/// </summary>
123
- /// <remarks>Normally paired with SaveFileDialog</remarks>
124
- /// <param name="path">Path of the package to open. Must exist.</param>
125
- /// <param name="openReadOnly">Set to true to open the package in a read-only state; False to open normally.</param>
126
- /// <returns>True on successful opening of package. False to cancel the opening process.</returns>
127
- protected abstract Task < bool > BrowseOpenFile ( out string path , out bool openReadOnly ) ;
124
+ /// <returns>Result of the open process. Success will be set to false if the opening process should be canceled.</returns>
125
+ protected abstract ValueTask < BrowseFileResult > BrowseOpenFile ( ) ;
128
126
129
127
/// <summary>
130
128
/// Called when browsing for destination to save a package.
131
129
/// </summary>
132
- /// <remarks>Normally paired with SaveFileDialog</remarks>
133
- /// <param name="path">Destination path for the package to save.</param>
134
- /// <returns>True on successful selection of package destination. False to cancel the saving process.</returns>
135
- protected abstract Task < bool > BrowseSaveFile ( out string path ) ;
130
+ /// <returns>Result of the open process. Success will be set to false if the saving process should be canceled.</returns>
131
+ protected abstract ValueTask < BrowseFileResult > BrowseSaveFile ( ) ;
136
132
137
133
protected virtual void OnPropertyChanged ( [ CallerMemberName ] string ? propertyName = null )
138
134
{
@@ -268,12 +264,12 @@ public virtual async Task<bool> Open()
268
264
if ( ! await TryClose ( ) )
269
265
return false ;
270
266
271
- var result = await BrowseOpenFile ( out var path , out var readOnly ) ;
267
+ var result = await BrowseOpenFile ( ) ;
272
268
273
- if ( result != true )
269
+ if ( result . Success != true )
274
270
return false ;
275
271
276
- return await Open ( path , readOnly ) ;
272
+ return await Open ( result . Path , result . OpenReadOnly ) ;
277
273
}
278
274
279
275
public virtual async Task < bool > Open ( string path , bool forceReadOnly )
@@ -434,11 +430,11 @@ internal virtual async Task<bool> SaveAsInternal(TPackage? package)
434
430
if ( package == null )
435
431
return false ;
436
432
437
- var browseResult = await BrowseSaveFile ( out var path ) ;
433
+ var browseResult = await BrowseSaveFile ( ) ;
438
434
439
- if ( browseResult )
435
+ if ( browseResult . Success )
440
436
{
441
- var result = await package . Save ( path ) ;
437
+ var result = await package . Save ( browseResult . Path ) ;
442
438
443
439
switch ( result . SaveResult )
444
440
{
0 commit comments