/// <summary> /// Creates an instance of <see cref="SubscribeMeasurements"/> class. /// </summary> /// <param name="itemsPerPage"></param> /// <param name="autoSave"></param> public SubscribeMeasurements(int itemsPerPage, bool autoSave = true) : base(0, autoSave) { m_subscribedMeasurementsLock = new object(); m_authorizationQuery = new AuthorizedMeasurementsQuery(); m_authorizationQuery.AuthorizedMeasurements += m_authorizationQuery_AuthorizedMeasurements; m_refreshTimer = new DispatcherTimer(); m_refreshTimer.Interval = TimeSpan.FromSeconds(5); m_refreshTimer.Tick += m_refreshTimer_Tick; Load(); }
/// <summary> /// Handles unloading of the subscriber measurement view model. /// </summary> public void Unload() { if ((object)m_authorizationQuery != null) { m_authorizationQuery.AuthorizedMeasurements -= m_authorizationQuery_AuthorizedMeasurements; m_authorizationQuery.Dispose(); } m_authorizationQuery = null; if (m_refreshTimer != null) { try { m_refreshTimer.Stop(); } finally { m_refreshTimer = null; } } }