Search Results for

    Show / Hide Table of Contents

    Class ManagedTimer

    A managed timer that will tick on intervals. Might catchup if callback takes too long.

    Inheritance
    System.Object
    ManagedTimer
    Namespace: FM.LiveSwitch
    Assembly: FM.LiveSwitch.dll
    Syntax
    public class ManagedTimer : object

    Constructors

    ManagedTimer(Int32, Action0)

    Creates a new instance of the managed timer.

    Declaration
    public ManagedTimer(int interval, Action0 callback)
    Parameters
    Type Name Description
    System.Int32 interval

    The millisecond interval to tick on.

    Action0 callback

    The callback to use when a tick occurs.

    Properties

    Interval

    Gets the interval that the timer will tick on.

    Declaration
    public int Interval { get; }
    Property Value
    Type Description
    System.Int32

    InTick

    Gets whether the callback is currently being called.

    Declaration
    public bool InTick { get; }
    Property Value
    Type Description
    System.Boolean

    Running

    Gets whether the timer is running.

    Declaration
    public bool Running { get; }
    Property Value
    Type Description
    System.Boolean

    Methods

    ChangeInterval(Int32)

    Changes the interval of the timer.

    Declaration
    public void ChangeInterval(int newInterval)
    Parameters
    Type Name Description
    System.Int32 newInterval

    PerSecondInterval(Double)

    Calculates a interval based on how many times you want the timer to tick per second.

    Declaration
    public static int PerSecondInterval(double timesPerSecond)
    Parameters
    Type Name Description
    System.Double timesPerSecond

    The amount of times to tick per second.

    Returns
    Type Description
    System.Int32

    Start()

    Starts the timer.

    Declaration
    public bool Start()
    Returns
    Type Description
    System.Boolean

    false if the timer was already started; otherwise, true.

    Stop()

    Stops the timer.

    Declaration
    public bool Stop()
    Returns
    Type Description
    System.Boolean

    false if the timer was already stopped; otherwise, true.

    Stop(Boolean)

    Stops the timer.

    Declaration
    public bool Stop(bool waitForStop)
    Parameters
    Type Name Description
    System.Boolean waitForStop

    True if method should block until timer is stopped.

    Returns
    Type Description
    System.Boolean

    false if the timer was already stopped; otherwise, true.

    StopAsync()

    Stops the timer.

    Declaration
    public Future<object> StopAsync()
    Returns
    Type Description
    Future<System.Object>

    false if the timer was already stopped; otherwise, true.

    In This Article
    Back to top Copyright © LiveSwitch Inc. All Rights Reserved. Doc build for LiveSwitch v1.15.0