Skip to content

Commit 6b1e337

Browse files
yaira2lukeblevins
andauthored
Develop (#445)
* Implement Win32 FileTimeToSystemTime * Handle/log exception during device StorageFolder initialization step * Prevent Pinning OneDrive Multiple Times * Added temp environment variables * Added some more variables * Recfactored variable paths * Save ribbon state * Added strings * Added strings * Added strings for share * Added strings * Fixed formating in RibbonArea xaml * Added PermanentDelete option for ctrl+shift+delete * Cleaned up last code from last commit * CI (#444) * Set up CI with Azure Pipelines Co-authored-by: Luke Blevins <[email protected]>
1 parent 59ae8ea commit 6b1e337

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

Files/Interacts/Interaction.cs

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class Interaction
3434
{
3535
private IShellPage CurrentInstance;
3636
InstanceTabsView instanceTabsView;
37+
string DeleteType;
3738
public Interaction()
3839
{
3940
CurrentInstance = App.CurrentInstance;
@@ -552,14 +553,28 @@ public async void DeleteItem_Click(object sender, RoutedEventArgs e)
552553
if (storItem.FileType != "Folder")
553554
{
554555
var item = await StorageFile.GetFileFromPathAsync(storItem.FilePath);
555-
await item.DeleteAsync(StorageDeleteOption.Default);
556-
556+
557+
if (DeleteType == "Perm")
558+
{
559+
await item.DeleteAsync(StorageDeleteOption.PermanentDelete);
560+
}
561+
else
562+
{
563+
await item.DeleteAsync(StorageDeleteOption.Default);
564+
}
557565
}
558566
else
559567
{
560568
var item = await StorageFolder.GetFolderFromPathAsync(storItem.FilePath);
561-
await item.DeleteAsync(StorageDeleteOption.Default);
562569

570+
if (DeleteType == "Perm")
571+
{
572+
await item.DeleteAsync(StorageDeleteOption.PermanentDelete);
573+
}
574+
else
575+
{
576+
await item.DeleteAsync(StorageDeleteOption.Default);
577+
}
563578
}
564579
}
565580
catch (FileLoadException)
@@ -568,14 +583,28 @@ public async void DeleteItem_Click(object sender, RoutedEventArgs e)
568583
if (storItem.FileType != "Folder")
569584
{
570585
var item = await StorageFile.GetFileFromPathAsync(storItem.FilePath);
571-
await item.DeleteAsync(StorageDeleteOption.Default);
572586

587+
if (DeleteType == "Perm")
588+
{
589+
await item.DeleteAsync(StorageDeleteOption.PermanentDelete);
590+
}
591+
else
592+
{
593+
await item.DeleteAsync(StorageDeleteOption.Default);
594+
}
573595
}
574596
else
575597
{
576598
var item = await StorageFolder.GetFolderFromPathAsync(storItem.FilePath);
577-
await item.DeleteAsync(StorageDeleteOption.Default);
578-
599+
600+
if (DeleteType == "Perm")
601+
{
602+
await item.DeleteAsync(StorageDeleteOption.PermanentDelete);
603+
}
604+
else
605+
{
606+
await item.DeleteAsync(StorageDeleteOption.Default);
607+
}
579608
}
580609
}
581610

@@ -593,6 +622,14 @@ public async void DeleteItem_Click(object sender, RoutedEventArgs e)
593622
{
594623
Debug.WriteLine("Attention: Tried to delete an item that could be found");
595624
}
625+
626+
DeleteType = "Default";
627+
}
628+
629+
public void PermanentDelete(object sender, RoutedEventArgs e)
630+
{
631+
DeleteType = "Perm";
632+
DeleteItem_Click(null, null);
596633
}
597634

598635
public void RenameItem_Click(object sender, RoutedEventArgs e)

Files/Views/Pages/ProHome.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,10 @@ private async void ProHomeInstance_KeyUp(object sender, KeyRoutedEventArgs e)
234234
case (true, true, false, true, VirtualKey.N): //ctrl + shift + n, new item
235235
await App.addItemDialog.ShowAsync();
236236
break;
237+
case (true, true, false, true, VirtualKey.Delete): //ctrl + shift + delete, PermanentDelete
238+
if (!App.CurrentInstance.NavigationControl.IsEditModeEnabled)
239+
App.CurrentInstance.InteractionOperations.PermanentDelete(null, null);
240+
break;
237241
case (true, false, false, true, VirtualKey.C): //ctrl + c, copy
238242
if (!App.CurrentInstance.NavigationControl.IsEditModeEnabled)
239243
App.CurrentInstance.InteractionOperations.CopyItem_ClickAsync(null, null);

0 commit comments

Comments
 (0)