Question

I created application for WCE (RF terminal Motorola MC3190). My problem is that app after 15 minutes of running crashed without some error message. No exception catch in code is possible. No matter if the I working with application or not. After crashes if I try close directory with exe file (or anything else) then Windows freezes and after couple of minutes RF is a hard-reseted.

Application communicate via TCP sockets with other application. Based on XML data from other app are created Windows controls and events. All is OK for first 15min (+/- 30sec). For this time I not using motorola EDMK library.

Some ideas for a solution?

Thanks!

NEWS: When I removed this code app stopped crashes. Concretely remove Thread.Sleep(1000); has effect.

    //using Symbol.Keyboard;
    delegate void setBoolAlpha(bool alpha);
    public void checkAlpha()
    {
        KeyPad KP = new KeyPad();
        bool alpha = KP.AlphaMode;
        showAlpha(alpha);
        Thread.Sleep(1000);
        checkAlpha();
    }

    public void showAlpha(bool alpha)
    {
        if (this.abc.InvokeRequired)
        {
            setBoolAlpha d = new setBoolAlpha(showAlpha);
            this.Invoke(d, new object[] { alpha });
        }
        else
        {
            this.abc.Visible = alpha; //abc = Control panel
        }    
    }   
Was it helpful?

Solution

A little change was necessary. CheckAlpha() is running as "IsBackground" thread.

delegate void setBoolAlpha(bool alpha);
public void checkAlpha()
{
  while(true)
  {
    KeyPad KP = new KeyPad();
    bool alpha = KP.AlphaMode;
    showAlpha(alpha);
    Thread.Sleep(500);
    //checkAlpha();
    }
  }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top