@@ -226,30 +226,46 @@ public static async void CopyItem_ClickAsync(object sender, RoutedEventArgs e)
226
226
{
227
227
DataPackage dataPackage = new DataPackage ( ) ;
228
228
dataPackage . RequestedOperation = DataPackageOperation . Copy ;
229
- var DataGridSelectedItem = ItemViewModel . FilesAndFolders [ GenericFileBrowser . data . SelectedIndex ] ;
230
- if ( DataGridSelectedItem != null )
229
+ if ( GenericFileBrowser . data . SelectedItems . Count != 0 )
231
230
{
232
- var path = ItemViewModel . PUIP . Path ;
233
- var fol = await StorageFolder . GetFolderFromPathAsync ( path ) ;
234
- var item = await fol . GetItemAsync ( DataGridSelectedItem . FileName ) ;
235
231
List < IStorageItem > items = new List < IStorageItem > ( ) ;
236
- items . Add ( item ) ;
232
+ foreach ( ListedItem StorItem in GenericFileBrowser . data . SelectedItems )
233
+ {
234
+ if ( StorItem . FileExtension != "Folder" )
235
+ {
236
+ var item = await StorageFile . GetFileFromPathAsync ( StorItem . FilePath ) ;
237
+ items . Add ( item ) ;
238
+ }
239
+ else
240
+ {
241
+ var item = await StorageFolder . GetFolderFromPathAsync ( StorItem . FilePath ) ;
242
+ items . Add ( item ) ;
243
+ }
244
+ }
245
+ //var DataGridSelectedItem = ItemViewModel.FilesAndFolders[GenericFileBrowser.data.SelectedIndex];
246
+ PathSnapshot = ItemViewModel . PUIP . Path ;
247
+ //var fol = await StorageFolder.GetFolderFromPathAsync(path);
248
+ //foreach(IStorageItem it in fol)
249
+ //{
250
+
251
+ //}
252
+ //var item = await fol.GetItemAsync(DataGridSelectedItem.FileName);
237
253
IEnumerable < IStorageItem > EnumerableOfItems = items ;
238
254
dataPackage . SetStorageItems ( EnumerableOfItems ) ;
239
255
Clipboard . SetContent ( dataPackage ) ;
240
256
241
257
}
242
258
}
243
-
259
+ static string PathSnapshot ;
244
260
public static async void PasteItem_ClickAsync ( object sender , RoutedEventArgs e )
245
261
{
246
- // TODO: Add progress box and collision for this operation
262
+ // TODO: Add progress box and collision options for this operation
247
263
var DestinationPath = ItemViewModel . PUIP . Path ;
248
264
DataPackageView packageView = Clipboard . GetContent ( ) ;
249
265
var ItemsToPaste = await packageView . GetStorageItemsAsync ( ) ;
250
266
foreach ( IStorageItem item in ItemsToPaste )
251
267
{
252
- StorageFolder SourceFolder = await StorageFolder . GetFolderFromPathAsync ( item . Path ) ;
268
+ StorageFolder SourceFolder = await StorageFolder . GetFolderFromPathAsync ( PathSnapshot ) ;
253
269
254
270
if ( item . IsOfType ( StorageItemTypes . Folder ) )
255
271
{
@@ -263,55 +279,15 @@ public static async void PasteItem_ClickAsync(object sender, RoutedEventArgs e)
263
279
}
264
280
265
281
}
282
+ Navigation . NavigationActions . Refresh_Click ( null , null ) ;
266
283
267
284
}
268
285
269
286
public static async void CloneDirectory ( string root , string dest )
270
287
{
271
288
StorageFolder SourceFolder = await StorageFolder . GetFolderFromPathAsync ( root ) ;
272
289
StorageFolder DestinationFolder = await StorageFolder . GetFolderFromPathAsync ( dest ) ;
273
- //// Check for clone of source folder in destination folder
274
- //var FolderCreate = await DestinationFolder.TryGetItemAsync(SourceFolder.Name);
275
- //// if not there, then create it
276
- //if (FolderCreate == null)
277
- //{
278
- // await DestinationFolder.CreateFolderAsync(SourceFolder.Name);
279
- // Debug.WriteLine("Source folder clone not found in destination");
280
- //}
281
- //// If there, then update dest folder to reflect this
282
- //else
283
- //{
284
- // DestinationFolder = await StorageFolder.GetFolderFromPathAsync(dest + @"\" + SourceFolder.Name);
285
- // foreach (var directory in await SourceFolder.GetFoldersAsync())
286
- // {
287
- // string DirName = directory.Name;
288
- // if (await DestinationFolder.TryGetItemAsync(DirName) == null)
289
- // {
290
- // await DestinationFolder.CreateFolderAsync(DirName);
291
- // }
292
- // CloneDirectory(directory.Path, dest + @"\" + DirName);
293
- // }
294
- //}
295
-
296
- var FolderCreate = await DestinationFolder . TryGetItemAsync ( SourceFolder . Name ) ;
297
- // Create initial root directory in dest if not there already
298
- if ( FolderCreate == null )
299
- {
300
- await DestinationFolder . CreateFolderAsync ( SourceFolder . Name ) ;
301
- Debug . WriteLine ( "Source folder clone not found in destination" ) ;
302
- }
303
- foreach ( var directory in await SourceFolder . GetFoldersAsync ( ) )
304
- {
305
- string DirName = directory . Name ;
306
- if ( await DestinationFolder . TryGetItemAsync ( DirName ) == null )
307
- {
308
- await DestinationFolder . CreateFolderAsync ( DirName ) ;
309
- }
310
- }
311
-
312
-
313
-
314
-
290
+
315
291
}
316
292
}
317
293
0 commit comments