private bool SelectReader(string reader) { try { if (QuoteReader != null) { QuoteReader.OnError -= GargoyleMessageUtilities_OnError; QuoteReader.OnInfo -= GargoyleMessageUtilities_OnInfo; QuoteReader.OnQuote -= m_reader_OnQuote; QuoteReader.OnReaderStopped -= m_reader_OnReaderStopped; QuoteReader.Dispose(); } QuoteReader = QuoteReaderFactory.GetReader(reader); if (QuoteReader == null) { OnInfo(String.Format("Unable to instantiate quote reader {0}", reader), true); return(false); } else { QuoteReader.OnError += GargoyleMessageUtilities_OnError; QuoteReader.OnInfo += GargoyleMessageUtilities_OnInfo; QuoteReader.OnQuote += m_reader_OnQuote; QuoteReader.OnReaderStopped += m_reader_OnReaderStopped; return(true); } } catch (Exception ex) { OnError("Unable to instantiate quote reader", ex, true); return(false); } }
protected void Dispose(bool disposing) { if (m_bWaiting) { m_waitHandle.Set(); System.Threading.Thread.Sleep(m_parms.Timeout * 2); } if (m_bTaskStarted) { m_bTaskStarted = !EndTask(m_parms.TaskName, !m_bTaskFailed); } if (disposing) { if (m_waitHandle != null) { m_waitHandle.Dispose(); m_waitHandle = null; } if (QuoteReader != null) { QuoteReader.Dispose(); QuoteReader = null; } if (m_hugoConnection != null) { m_hugoConnection.Dispose(); m_hugoConnection = null; } if (m_writer != null) { m_writer.Dispose(); m_writer = null; } } }