Question

Windows mobile multitasking is not working perfectly in CF 3.5. When I run Multitask, remaining functions are not working perfectly.Here is my code

        Thread internetStatusDisplayThread = new Thread(startInternetCheck);
        internetStatusDisplayThread.Start();
          private void startInternetCheck()
          {
           while(isTreadRunning)
           {
            bool internetAvailable = new SecurityManager().IsInternetIsAvailable();
            if (internetAvailable)
            {
                this.Invoke(controlUpdator, noInternetImage, false);
            }
            else
            {
                this.Invoke(controlUpdator, noInternetImage, true);
            }
            internetStatusDisplayThread.IsBackground = true;
            internetStatusDisplayThread.Priority = ThreadPriority.Lowest;

            Thread.Sleep(5000);
           }
          }
        private delegate void InternetStausUpdator(Control uiControl, bool status );
Was it helpful?

Solution

this.Invoke(...); change to this.BeginInvoke(...). Now it is working fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top