/// <summary> /// Initializes a new instance of the <see cref="EventProvider"/> class. /// </summary> /// <param name="dataProvider">The data provider to get data from</param> /// <param name="interval">The interval in milliseconds the timer should fetch the data.</param> /// <param name="synchronizingObject">The synchronizing object. Specify your Form or Control here so that you don't have to invoke when handling events.</param> /// <param name="enabled">if set to <c>true</c> this class will immediately start fetching data from Spotify.</param> public EventProvider(DataProvider dataProvider, double interval, ISynchronizeInvoke synchronizingObject, bool enabled) { this.DataProvider = dataProvider; this.timer = new Timer(interval) { AutoReset = false }; this.timer.Elapsed += (s, e) => this.UpdateData(); this.EventSynchronizingObject = synchronizingObject; this.Enabled = enabled; }
/// <summary> /// Initializes a new instance of the <see cref="EventProvider"/> class. /// </summary> /// <param name="dataProvider">The data provider to get data from.</param> /// <param name="interval">The interval in milliseconds the timer should fetch the data.</param> public EventProvider(DataProvider dataProvider, double interval) : this(dataProvider, interval, null) { }
/// <summary> /// Initializes a new instance of the <see cref="EventProvider"/> class. /// </summary> /// <param name="dataProvider">The data provider to get data from</param> /// <param name="interval">The interval in milliseconds the timer should fetch the data.</param> /// <param name="synchronizingObject">The synchronizing object. Specify your Form or Control here so that you don't have to invoke when handling events.</param> public EventProvider(DataProvider dataProvider, double interval, ISynchronizeInvoke synchronizingObject) : this(dataProvider, interval, synchronizingObject, false) { }
/// <summary> /// Initializes a new instance of the <see cref="EventProvider"/> class. /// </summary> /// <param name="dataProvider">The data provider to get data from.</param> public EventProvider(DataProvider dataProvider) : this(dataProvider, 50) { }