User ' s information on timer tactics in the disktop annex



  • There is a program with shape and two timers.

    Situation 1:One timer operates once a second and makes a request for a server to get information. The accuracy of this timer is not very important. We need to visualize the form, which has been updated or that the timer tic has occurred. Like some flashing sign, flashing, and it doesn't look like another tic. Tried to animate a change in colour of some text on the label, with delay Thread.Sleep(300) I'm sorry to have caused the problem (the flashing of the element is not a stable frequencies for the time shift).

    Situation 2:

    Dim aTimer As System.Timers.Timer
    

    ' Создаем таймер с интервалом в зависимости от настроек
    aTimer = New System.Timers.Timer(Me.delay)

    ' Биндим процедуру вызова таймером через определенные интервалы
    AddHandler aTimer.Elapsed, AddressOf OnTimedEvent
    aTimer.Enabled = True

    Private Sub OnTimedEvent(source As Object, e As ElapsedEventArgs)
    ' тут http вызовы с последующей записью в базу а также метод
    ' который отображал срабатывания тика таймера, что так же приводит к
    ' проблеме из ситуации №1

    End Sub

    Ask how best to deal with this problem, i.e. to depict the visual tic of the timer without causing disinchronation on the frequency of the challenge of the procedure that follows the code.



  • The simplest way is two timers.

    The first timer causes the necessary action, changes color, e.g. Labeland activate the second timer.

    2 Timer at a given interval changes color Label back and down, before reactivation.

    The first time interval shall be greater than the second.

    The second option is to make a self-containing timer with a timer inside and built. Put it in shape and just pull this control over the main time of the application. The second option requires more code, but it allows for the reuse of the tag where necessary.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2