1
0
mirror of https://github.com/chylex/Backup-Essentials.git synced 2025-05-25 18:34:11 +02:00

Tweaked selected item after deleting History entry, and fixed removing non-existent files

This commit is contained in:
chylex 2015-05-15 23:55:45 +02:00
parent 089347aff2
commit 1e74ab7908

View File

@ -33,9 +33,13 @@ namespace BackupEssentials.Pages{
foreach(HistoryEntry entry in HistoryListView.SelectedItems)list.Add(entry);
if (list.Count > 0 && MessageBox.Show(App.Window,Sys.Settings.Default.Language["History.Deletion.Confirmation.",list.Count,list.Count.ToString()],Sys.Settings.Default.Language["History.Deletion.Confirmation.Title"],MessageBoxButton.YesNo,MessageBoxImage.Warning) == MessageBoxResult.Yes){
int index = HistoryListView.SelectedIndex;
foreach(HistoryEntry entry in list){
try{
File.Delete(Path.Combine(HistoryEntry.Directory,entry.Filename));
string path = Path.Combine(HistoryEntry.Directory,entry.Filename);
if (File.Exists(path))File.Delete(path);
DataStorage.HistoryEntryList.Remove(entry);
}catch(Exception ex){
App.LogException(ex);
@ -45,6 +49,9 @@ namespace BackupEssentials.Pages{
else if (res == MessageBoxResult.Yes)DataStorage.HistoryEntryList.Remove(entry);
}
}
if (index > 0)HistoryListView.SelectedIndex = index-1;
else if (HistoryListView.Items.Count > 0)HistoryListView.SelectedIndex = index;
}
}