In my WPF project, I get the following error when trying to compile: No overload for 'FileDropStackPanel_Drop' matches delegate 'DragEventHandler'.
But I dont know where to change the DragHandlers delegate signature. If this is the right way.
public MainWindow()
{
InitializeComponent();
Backup backup = new Backup();
BackupFileManager manager = new BackupFileManager(backup);
}
private void FileDropStackPanel_Drop(object sender, DragEventArgs e, BackupFileManager manager, Backup backup)
{
SetValuesOfBackup(e, manager, backup);
IsFileZip(manager, backup);
}
private void IsFileZip(BackupFileManager manager, Backup backup)
{
if (backup.FileExtentsion == ".zip")
{
ZipFile.ExtractToDirectory(backup.FilePath, @"xyz");
}
}
private void SetValuesOfBackup(DragEventArgs e, BackupFileManager manager, Backup backup)
{
//the filepath must be set first
manager.SetFilePathOfBackup(e);
manager.SetDictionaryOfBackup();
manager.SetExtensionOfBackup();
manager.SetNameOfBackup();
}
DragEventHandler has only 2 Parameters:
private void FileDropStackPanel_Drop(object sender, DragEventArgs e)
You must define your variables Backup backup
and BackupFileManager manager
in the class as variables.
private Backup backup = new Backup();
private BackupFileManager manager = new BackupFileManager(backup);
public MainWindow()
{
InitializeComponent();
}
private void FileDropStackPanel_Drop(object sender, DragEventArgs e)
{
SetValuesOfBackup(e, manager, backup);
IsFileZip(manager, backup);
}
private void IsFileZip(BackupFileManager manager, Backup backup)
{
if (backup.FileExtentsion == ".zip")
{
ZipFile.ExtractToDirectory(backup.FilePath, @"xyz");
}
}
private void SetValuesOfBackup(DragEventArgs e, BackupFileManager manager, Backup backup)
{
//the filepath must be set first
manager.SetFilePathOfBackup(e);
manager.SetDictionaryOfBackup();
manager.SetExtensionOfBackup();
manager.SetNameOfBackup();
}