Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Timer isn't ticking!
Message
From
10/11/2008 09:05:38
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
08/11/2008 07:56:26
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, United Kingdom
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01360368
Message ID:
01360864
Views:
9
>Hi Tim,
>
>Thanks for the info. Your suggestion of using InvokeRequired and Invoke did the trick. Once I found the MSDN article on the subject and plumbed it all in, everything is fine.
>
>I changed my handler for new/dropped phone calls to the following:
>
>        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;
>        }
>
>
>A good lesson learned here - one which I think every .NET Winforms developer will come across at some time or other.
>
>Thanks again.

Your welcome, glad you got it figured out.
Tim
Timothy Bryan
Previous
Reply
Map
View

Click here to load this message in the networking platform