To understand my problem more precisely I would like to use a WPF application with two buttons as an example.
public RelayCommand Button1Command { get; private set; }
public RelayCommand Button2Command { get; private set; }
In my ctor:
Button1Command = new RelayCommand(Button1Method);
Button2Command = new RelayCommand(Button2Method);
public void Button1Method(object sender)
{
//Should do some stuff but e.g. in ThreadId 2
}
public void Button2Method(object sender)
{
//Should do some stuff but if Button1 was executed in ThreadId 2
//this button Action should also be done in ThreadId 2
}
The following example:
User clicks on Button1
=> Button1Method
is started on a new thread with ID 2.
User clicks on Button2
=> Button2Method
is started at the earliest when Button1Method
is finished but also on the same thread in which Button1Method
was executed.
And the whole also in the other direction.