Torna al Thread

/// <summary>Dispatches an asynchronous message to a synchronization context.</summary> /// <param name="d">The <see cref="T:System.Threading.SendOrPostCallback" /> delegate to call.</param> /// <param name="state">The object passed to the delegate.</param> public override void Post(SendOrPostCallback d, object state) { if (this.controlToSendTo != null) { Control control = this.controlToSendTo; object[] objArray = new object[] { state }; control.BeginInvoke(d, objArray); } } /// <summary>Dispatches a synchronous message to a synchronization context</summary> /// <param name="d">The <see cref="T:System.Threading.SendOrPostCallback" /> delegate to call.</param> /// <param name="state">The object passed to the delegate.</param> /// <exception cref="T:System.ComponentModel.InvalidAsynchronousStateException">The destination thread no longer exists.</exception> public override void Send(SendOrPostCallback d, object state) { Thread destinationThread = this.DestinationThread; if (destinationThread == null || !destinationThread.IsAlive) { throw new InvalidAsynchronousStateException(SR.GetString("ThreadNoLongerValid")); } if (this.controlToSendTo != null) { Control control = this.controlToSendTo; object[] objArray = new object[] { state }; control.Invoke(d, objArray); } }
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5