I receive some data from a service reference.
The structure f.e. is as follows:
I receive some driverdata from the service reference (namespace: ServiceReference.Driver)
The namespace of the driverdata in my project is 'MyProject.Driver'.
DriverUserControl should be created in the constructor of MyProject.Driver.
public Driver(int id, string name, string telephone, string plate,
Dictionary<DateTime, TransportType> transportTypes, Division division)
{
this.id = id;
this.name = name;
this.telephone = telephone;
this.plate = plate;
this.transportTypes = transportTypes;
this.division = division;
userControl = new DriverUserControl(this);
}
But when i get here:
public DriverUserControl(Driver magnet)
{
InitializeComponent();
this.magnet = magnet;
Render();
}
Whenever it reaches the constructor of the usercontrol the following error "The calling thread must be STA, because many UI components require this" shows up.
Because I never started a thread anywhere in my project I don't know how I should set this to STA. I guess the servicereference is seen as a thread, but still, is there a way to change this to STA?
Thanks.