示例#1
0
        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();
        }
示例#2
0
        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();
        }
示例#3
0
        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);
        }