I have a component like this and can't change it:
public sealed class UFScannerManager
{
public UFScannerManager(ISynchronizeInvoke synInvoke);
public ScannerList Scanners { get; }
public event UFS_SCANNER_PROC ScannerEvent;
public UFS_STATUS Init();
public UFS_STATUS Uninit();
public UFS_STATUS Update();
[DefaultMember("Item")]
public sealed class ScannerList
{
public ScannerList(UFScannerManager Owner);
public UFScanner this[int Index] { get; }
public UFScanner this[string ScannerID] { get; }
public UFScanner this[IntPtr ScannerHandle] { get; }
public int Count { get; }
}
}
I want to create an instance of the component like this: UFScannerManager(this), but in WPF I cannot call pass this as an argument. Here this means the current window form object, the constructor required a ISynchronizeInvoke sysInvoke parameter. So when passing this, the scanner can be initialized properly in a Windows Form applications. No need to worry about ISynchronizeInvoke interface.
UFS_STATUS ufs_res;
UFScannerManager ScannerManager;
int nScannerNumber;
ScannerManager = new UFScannerManager(this);
ufs_res = ScannerManager.Init();
nScannerNumber = ScannerManager.Scanners.Count;
However, this code does not work in WPF. The problem is this line. The bit it does not like is this.
ScannerManager = new UFScannerManager(this);
When I try to build, I get an error:
Argument 1: cannot convert from 'win_myapp' to 'System.ComponentModel.ISynchronizeInvoke'