Skip to content

Commit af5d716

Browse files
committed
disable text drop
1 parent bb6265c commit af5d716

File tree

1 file changed

+60
-59
lines changed

1 file changed

+60
-59
lines changed

Files/ViewModels/Widgets/Bundles/BundleContainerViewModel.cs

Lines changed: 60 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -291,63 +291,64 @@ private async void Drop(DragEventArgs e)
291291
}
292292
else if (e.DataView.Contains(StandardDataFormats.Text))
293293
{
294-
string itemText = await e.DataView.GetTextAsync();
295-
296-
if (string.IsNullOrWhiteSpace(itemText))
297-
{
298-
return;
299-
}
300-
301-
bool dragFromBundle = false;
302-
string itemPath = null;
303-
string originBundle = null;
304-
305-
if (itemText.Contains("|"))
306-
{
307-
dragFromBundle = true;
308-
309-
originBundle = itemText.Split('|')[0];
310-
itemPath = itemText.Split('|')[1];
311-
}
312-
else
313-
{
314-
dragFromBundle = false;
315-
itemPath = itemText;
316-
}
317-
318-
IStorageItem item = await StorageItemHelpers.ToStorageItem<IStorageItem>(itemPath);
319-
320-
if (item != null || itemPath.EndsWith(".lnk"))
321-
{
322-
if (Contents.Count < Constants.Widgets.Bundles.MaxAmountOfItemsPerBundle)
323-
{
324-
if (!Contents.Any((i) => i.Path == itemPath)) // Don't add existing items!
325-
{
326-
AddBundleItem(new BundleItemViewModel(itemPath, itemPath.EndsWith(".lnk") ? FilesystemItemType.File : (item.IsOfType(StorageItemTypes.Folder) ? FilesystemItemType.Directory : FilesystemItemType.File))
327-
{
328-
ParentBundleName = BundleName,
329-
NotifyItemRemoved = NotifyItemRemovedHandle,
330-
OpenItem = OpenPath,
331-
OpenPathInNewPane = OpenPathInNewPane,
332-
LoadIconOverlay = LoadIconOverlay
333-
});
334-
itemsAdded = true;
335-
}
336-
}
337-
}
338-
339-
if (itemsAdded && dragFromBundle)
340-
{
341-
// Also remove the item from the collection
342-
if (BundlesSettings.SavedBundles.ContainsKey(BundleName))
343-
{
344-
Dictionary<string, List<string>> allBundles = BundlesSettings.SavedBundles;
345-
allBundles[originBundle].Remove(itemPath);
346-
BundlesSettings.SavedBundles = allBundles;
347-
348-
NotifyBundleItemRemoved(originBundle, itemPath);
349-
}
350-
}
294+
// Doesn't support text drop
295+
//string itemText = await e.DataView.GetTextAsync();
296+
297+
//if (string.IsNullOrWhiteSpace(itemText))
298+
//{
299+
// return;
300+
//}
301+
302+
//bool dragFromBundle = false;
303+
//string itemPath = null;
304+
//string originBundle = null;
305+
306+
//if (itemText.Contains("|"))
307+
//{
308+
// dragFromBundle = true;
309+
310+
// originBundle = itemText.Split('|')[0];
311+
// itemPath = itemText.Split('|')[1];
312+
//}
313+
//else
314+
//{
315+
// dragFromBundle = false;
316+
// itemPath = itemText;
317+
//}
318+
319+
//IStorageItem item = await StorageItemHelpers.PathToStorageItemAsync<IStorageItem>(itemPath);
320+
321+
//if (item != null || itemPath.EndsWith(".lnk"))
322+
//{
323+
// if (Contents.Count < Constants.Widgets.Bundles.MaxAmountOfItemsPerBundle)
324+
// {
325+
// if (!Contents.Any((i) => i.Item.Path == itemPath)) // Don't add existing items!
326+
// {
327+
// AddBundleItem(new BundleItemViewModel(itemPath, itemPath.EndsWith(".lnk") ? StorageItemTypes.File : (item.IsOfType(StorageItemTypes.Folder) ? StorageItemTypes.Folder : StorageItemTypes.File))
328+
// {
329+
// ParentBundleName = BundleName,
330+
// NotifyItemRemoved = NotifyItemRemovedHandle,
331+
// OpenItem = OpenPath,
332+
// OpenPathInNewPane = OpenPathInNewPane,
333+
// LoadIconOverlay = LoadIconOverlay
334+
// });
335+
// itemsAdded = true;
336+
// }
337+
// }
338+
//}
339+
340+
//if (itemsAdded && dragFromBundle)
341+
//{
342+
// // Also remove the item from the collection
343+
// if (BundlesSettings.SavedBundles.ContainsKey(BundleName))
344+
// {
345+
// Dictionary<string, List<string>> allBundles = BundlesSettings.SavedBundles;
346+
// allBundles[originBundle].Remove(itemPath);
347+
// BundlesSettings.SavedBundles = allBundles;
348+
349+
// NotifyBundleItemRemoved(originBundle, itemPath);
350+
// }
351+
//}
351352
}
352353

353354
if (itemsAdded)
@@ -366,7 +367,7 @@ private async void Drop(DragEventArgs e)
366367

367368
private void DragItemsStarting(DragItemsStartingEventArgs e)
368369
{
369-
string itemPathAndData = $"{BundleName}|{(e.Items.First() as BundleItemViewModel).Path}";
370+
string itemPathAndData = $"{BundleName}|{(e.Items.First() as BundleItemViewModel).Item.Path}";
370371
e.Data.SetData(StandardDataFormats.Text, itemPathAndData);
371372
}
372373

@@ -408,7 +409,7 @@ private bool SaveBundle()
408409
if (BundlesSettings.SavedBundles.ContainsKey(BundleName))
409410
{
410411
Dictionary<string, List<string>> allBundles = BundlesSettings.SavedBundles;
411-
allBundles[BundleName] = Contents.Select((item) => item.Path).ToList();
412+
allBundles[BundleName] = Contents.Select((item) => item.Item.Path).ToList();
412413

413414
BundlesSettings.SavedBundles = allBundles;
414415

0 commit comments

Comments
 (0)