static void Main() { BeanFactory = new BeanFactory(); #if DEBUG BackService bs = new BackService(BeanFactory); bs.Start(new String[0]); Application.ApplicationExit += (sender, e) => bs.Stop(); #endif Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
public void Start(String[] args) { ParameterizedThreadStart fn = delegate(Object o) { BackService bs = (BackService)o; bs.OnStart(args); lock (this) { Monitor.Wait(bs); bs.OnStop(); } }; t = new Thread(fn); t.Start(this); }