Timer request

4 posts, 0 answers
  1. Xu
    Xu avatar
    7 posts
    Member since:
    Aug 2014

    Posted 14 Sep 2014 Link to this post

    Eric:

    I tried Timer request following this topic: https://groups.google.com/forum/?fromgroups#!searchin/httpfiddler/reissue/httpfiddler/8r9Hop7LMXg/0GROyv2HXWwJ.
    Everything is ok at first, it runs as expecting few days. Until this morning. The Timer started, but does not raise the tick!
    What is mysterious is if I put a MessageBox following the oTimer.Start() and keep the MessageBox on, it runs quite normal. But once I click the OK button to turn off the MessageBox, the oTimer stop raising tick again.
    The code looks like as following: 

    static var oTimer: System.Windows.Forms.Timer;
    static function TimerStart(){
       
    oTimer = new System.Windows.Forms.Timer();
       oTimer.add_Tick( OnTimer );
       oTimer.Interval = 3000;
       oTimer.Start();
       MessageBox.Show(
    'Timer Started: ' + oTimer.Interval.toString()  );
    }

    What the problem is it? What happened?
    thx a lot!

  2. Eric Lawrence
    Admin
    Eric Lawrence avatar
    833 posts

    Posted 15 Sep 2014 Link to this post

    Hi, Xu--

    This seems like it should work just fine, but your description makes it sound like the timer is getting garbage collected. What code is in the Tick event handler?

    Are you doing anything that would cause the script file to reload?


    Regards,
    Eric Lawrence
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Xu
    Xu avatar
    7 posts
    Member since:
    Aug 2014

    Posted 15 Sep 2014 in reply to Eric Lawrence Link to this post

    The Tick event in some way is complex, I can only descript it in few words is: if a specific object is exist, it tries to pop out an Url from a stack, then request the url. When the stack is empty, it raises to refill the stack. If the refilling end successful, pop and request an url again. Otherwise, end the all process.

    I guess the problem should not be inside the Tick event, because I put a MessageBox at the beginning of the tick event, but it were not triggered.

    And I can sure the script is not reloaded.
  4. Eric Lawrence
    Admin
    Eric Lawrence avatar
    833 posts

    Posted 16 Sep 2014 Link to this post

    Where exactly in your script file did you put this code? Can you share your entire script with me?


    Regards,
    Eric Lawrence
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top