I have a multithreaded application that I now want to convert into a Windows
Service. Does application.run work in a windows service? Are there things
to take into consideration when creating a multithreaded windows service as
opposed to a multithreaded windows forms application?
E.G.
namespace whatever
{
public partial class Form1 : Form
{
....
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
SomeArray = new SomeClass[# - #];
for (...)
{
...
...
ThreadStart ts = new ThreadStart(SomeClass.SomeMethod);
Thread wrkThread = new Thread(ts);
whatever.CurrentThread = wrkThread;
wrkThread.SetApartmentState(ApartmentState.STA);
wrkThread.Start();
}
return;
}
}
public class SomeClass
{
// ...
// ...
private void SomeMethod()
{
....
....
Application.Run();
}
}
}