LargeIntervalTimer

Last post 04-08-2008 12:59 by pfingsten.bob@con-way.com. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 03-26-2008 12:34

    LargeIntervalTimer

    All,

     I seem to be having a problem with the LargeIntervalTimer class when running on a PPC2003, Intermec 761B, using .net cf 2.0 sp2.  I get the tick events for about two hours but then they stop and do not resume until I wake the device up.  I have the device set to turn off after 3 minutes of idle time.  The timer is executing every minute (for testing five minutes in production).  I am currently running a test on a WM5 device now.

  • 03-26-2008 16:05 In reply to

    Re: LargeIntervalTimer

    Same problem happens on a Intermec CN3 with WM5.

  • 03-26-2008 16:16 In reply to

    • ctacke
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-27-2007
    • Indiana
    • Posts 1,922

    Re: LargeIntervalTimer

    What interval are you using between ticks?

  • 03-26-2008 16:27 In reply to

    Re: LargeIntervalTimer

    I was using a 5 minute interval but reduce it to 1 minute for testing.  Both intervals fail.

  • 03-28-2008 14:51 In reply to

    Re: LargeIntervalTimer

    After some testing it seems it has something to do with my application.  I wrote a console application to test and it ran successfully for 4+ hours.  The only difference is that my test code had a static method for the tick and my application has a class that is instantiated and did not use a static method.

     

  • 04-08-2008 12:59 In reply to

    Re: LargeIntervalTimer

    Can someone explain why running the LargeIntervalTimer works as expected when initializing in a main and using a static delegate, but when using a main which instantiates a class that in turn instantiates a LargeIntervalTimer that calls an intstance delegate ceases to respond after about 3 hours?  I am assuming this has something to do with Windows Mobile and its suspend state but would like to hear some concrete reasoning.  All code is part of a class called AutoArriveDepart.  Any response is much appreciated.

     Static Example (Tested for 16 hours):

    [MTAThread]
    static void Main(String[] args)
    {
        Cursor.Current = Cursors.Default;
        LargeIntervalTimer myTimer = new LargeIntervalTimer();
        myTimer.Tick += new EventHandler(myTimer_Tick);
        myTimer.Interval = new TimeSpan(0, 1, 0);
        myTimer.Enabled = true;
        myTimer_Tick(null, null);
        while (true)
        {
            Thread.Sleep(10000);
        }
        logger.Debug("Exiting Main");
    }
    static void myTimer_Tick(object sender, EventArgs e)
    {
        logger.Debug("tick");
        SoundPlayer sp = new SoundPlayer();
        sp.SoundLocation = @"/windows/notify.wav";
        sp.Play();
    }

     

    Instance Example (some code removed for brevity.  Fails after 3 hours) :

    [MTAThread]
    static void Main(String[] args)
    {
        aad = new AutoArriveDepart();
        Cursor.Current = Cursors.Default;
        while (aad.keepRunning)
        {
            logger.Debug("Sleeping");
            Thread.Sleep(5000);
            logger.Debug("Awake");
            Application.DoEvents();
            logger.Debug("Finished DoEvents()");
        }
        aad.CloseSystemTrayIcon();
        logger.Debug("Exiting Main");
    }


    public AutoArriveDepart()
    {
        collectionTimer = new LargeIntervalTimer();
        collectionTimer.Interval = new TimeSpan(0, 1, 0);
        collectionTimer.Tick +=new EventHandler(collectionTimer_Tick);

        collectionTimer.Enabled = true; 
    }
    void collectionTimer_Tick(object sender, EventArgs e)
    {
        logger.Debug("tick");
        SoundPlayer sp = new SoundPlayer();
        sp.SoundLocation = @"/windows/notify.wav";
        sp.Play();
    }

     

    Filed under:
Page 1 of 1 (6 items)