Outline: I have two Projects. One project is Primary and is used GUI and primary processing of information. The Second Project is Secondary to the first and completes tasks over a span in time.
Start Secondary Project:
Thread thread = new Thread(() =>
{
main.MainForm = new MainForm();
main.MainForm.FormClosed += new FormClosedEventHandler(MainForm_FormClosed);
main.MainForm.ShowMainForm();
Application.Run();
});
thread.SetApartmentState(ApartmentState.MTA);
thread.Start();
References: I have added a Reference to the Secondary Project in the primary project so I can access it.
My Issue: I need a way report progress and any possible issues that may arise back to the primary Project. When I start the Secondary Project in another Thread, I seem to loose a lot of access to the Secondary Project.
I have tried to reference:
main.MainForm...
This seems to be a little problematic.
I wonder if there is a way to manage my code, specifically progress and errors through some sort of simple event system?
Any help and or ideas on best practices in this situation would be much appreciated.