public void Dispose() { //throw new NotImplementedException(); BasePrices_MA?.Dispose(); SmallSma_MA?.Dispose(); BigSma_MA?.Dispose(); }
public void Dispose() { //throw new NotImplementedException(); Logger.WriteLog("Disposing current sma values"); //LargestMa. try { Logger.WriteLog("Deregistering sma events "); if (LargestMa != null) { LargestMa.MovingAverageUpdatedEvent -= LargestSmaUpdatedHandler; } if (MediumMa != null) { MediumMa.MovingAverageUpdatedEvent -= MediumSmaUpdatedHandler; } if (SmallestMa != null) { SmallestMa.MovingAverageUpdatedEvent -= SmallestSmaUpdateHandler; } } catch (Exception ex) { Logger.WriteLog("Error deregistering event " + ex.Message); //throw; } try { Logger.WriteLog("diposing all sma data"); if (LargestMa != null) { LargestMa.Dispose(); } if (MediumMa != null) { MediumMa.Dispose(); } if (SmallestMa != null) { SmallestMa.Dispose(); } } catch (Exception ex) { Logger.WriteLog("Error disposing sma, continuing " + ex.Message); //throw; } finally { LargestMa = null; MediumMa = null; SmallestMa = null; } }