Пример #1
0
		/// <summary>
		/// Implementation of the async work invoker
		/// </summary>
		/// <remarks>
		/// We're using the delegate BeginInvoke() / EndInvoke() pattern here
		/// </remarks>
		protected override void BeginInvokeCore()
		{
			WorkInvoker worker = new WorkInvoker( DoWork );
			worker.BeginInvoke(
				_initializeCallback,
				_progressCallback ,
				_primaryStatusTextCallback ,
				_secondaryStatusTextCallback,
				new AsyncCallback( EndWork ), null );
		}
Пример #2
0
        /// <summary>
        /// Implementation of the async work invoker
        /// </summary>
        /// <remarks>
        /// We're using the delegate BeginInvoke() / EndInvoke() pattern here
        /// </remarks>
        protected override void BeginInvokeCore()
        {
            WorkInvoker worker = new WorkInvoker(DoWork);

            worker.BeginInvoke(
                _initializeCallback,
                _progressCallback,
                _primaryStatusTextCallback,
                _secondaryStatusTextCallback,
                new AsyncCallback(EndWork), null);
        }
Пример #3
0
    static void Main()
    {
        WorkInvoker method = Work;

        // Start the delegate; control returned immediately to caller
        // We also have the callback delegate 'Done' that is automatically called
        // upon completion.
        method.BeginInvoke("test", Done, method);

        // Caller can carry on with other operations in *parallel* here
        double d = 1.0;

        Thread.Sleep(5000);
        Console.WriteLine("Value {0}", d);

        Console.ReadLine();
    }