> private delegate void RefreshLineCallback(clsLine LineObj, CtlPhoneLine1 LineCtl); > > private void OnLineStatChg(object sender, EventArgs e) > { > //This event handler fires whenever the status of a clsLine (phone line) changes > //Find the corresponding screen line representation, then call the refresh code, below. > > clsLine theline = (clsLine)sender; > foreach (CtlPhoneLine1 obj in this.Controls) > { > if (obj is CtlPhoneLine1) > { > if (obj.Index == theline.Index) > { > if (this.InvokeRequired == true) > { > this.Invoke(new RefreshLineCallback(RefreshLine), theline, obj); > } > else > { > this.RefreshLine(theline, obj); > } > goto FoundIt; > } > } > > } > FoundIt: > return; > } >>