I am calling COM dll in WPF and want that UI doesn't Hang. So far i have used Task.Run approaches but no result.
Here is the code
public MainWindow()
{
InitializeComponent();
Task.Run(() => DoWork());
}
private void DoWork()
{
Task.Run(() =>
{
Allocate();
});
}
void Allocate()
{
int idwErrorCode = 0;
try
{
bIsConnected = axCZKEM1.Connect_Net("192.168,2,2", 3703);
}
the COM method axCZKEM1.Connect_Net("192.168,2,2", 3703) execution takes time and UI hangs up.
Need a simple solution.