private static void Main() { Console.WriteLine("Main thread: {0}", Thread.CurrentThread.ManagedThreadId); var asyncComponent = new AsyncComponent(); asyncComponent.LongTaskCompleted += Comp_LongTaskCompleted; asyncComponent.LongTaskAsync("input", 33); Console.ReadLine(); }
static void Main() { Console.WriteLine("Main thread: {0}", Thread.CurrentThread.ManagedThreadId); AsyncComponent comp = new AsyncComponent(); comp.LongTaskCompleted += Comp_LongTaskCompleted; comp.LongTaskAsync("input", 33); Console.ReadLine(); }
static void Main() { //WindowsFormsSynchronizationContext syncContext = new WindowsFormsSynchronizationContext(); //SynchronizationContext.SetSynchronizationContext(syncContext); Console.WriteLine("Main thread: {0}", Thread.CurrentThread.ManagedThreadId); AsyncComponent comp = new AsyncComponent(); comp.LongTaskCompleted += new LongTaskCompletedEventHandler(comp_LongTaskCompleted); comp.LongTaskAsync("input", 33); Console.ReadLine(); // Thread.Sleep(12000); }