1
0
mirror of https://github.com/chylex/Backup-Essentials.git synced 2025-01-08 20:42:45 +01:00

Added history entry deletion

This commit is contained in:
chylex 2015-04-16 20:00:51 +02:00
parent 67cf7f904c
commit df05265bab

View File

@ -1,6 +1,8 @@
using BackupEssentials.Backup;
using BackupEssentials.Backup.Data;
using BackupEssentials.Backup.History;
using System;
using System.IO;
using System.Windows;
using System.Windows.Controls;
@ -26,7 +28,18 @@ namespace BackupEssentials.Pages{
}
private void ClickRemove(object sender, RoutedEventArgs e){
HistoryEntry entry = HistoryListView.SelectedItem as HistoryEntry;
if (entry != null && MessageBox.Show(App.Window,"Are you sure you want to delete the history entry? This action cannot be taken back.","Confirm deletion",MessageBoxButton.YesNo,MessageBoxImage.Warning) == MessageBoxResult.Yes){
DataStorage.HistoryEntryList.Remove(entry);
try{
File.Delete(Path.Combine(HistoryEntry.Directory,entry.Filename));
}catch(Exception ex){
App.LogException(ex);
MessageBox.Show(App.Window,"Failed deleting the entry file: "+ex.Message,"Error deleting history entry",MessageBoxButton.OK,MessageBoxImage.Error);
}
}
}
}
}