An ISimpleLogger can be temporarily passed to a class which is not Dispsable in place of a TextWriter. This makes it unambiguous that the class using the logger is not responsible to dispose of it. The actual class is disposable and should normally be created in a Using clause. The logger can also track an indent.
Inheritance: ISimpleLogger, IDisposable
Ejemplo n.º 1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Called when [request debug info].
		/// </summary>
		/// <param name="commandObj">The command obj.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		public bool OnRequestDebugInfo(object commandObj)
		{
			CheckDisposed();

			using (var logger = new SimpleLogger())
			{
				m_xbvvc.LogStream = logger;
				int cv = m_sda.get_VecSize(m_hvoRoot, m_fakeFlid);
				if (cv > 0)
				{
					int hvoObjSel = m_sda.get_VecItem(m_hvoRoot,
													  m_fakeFlid, m_selectedIndex < 0 ? 0 : m_selectedIndex);
					m_rootb.PropChanged(hvoObjSel, m_tagMe, 0, 0, 0);
					Update(); // causes the PropChanged to actually invoke the VC.
				}
				else
				{
					logger.WriteLine("The record list is empty.");
				}
				MessageBox.Show(this, logger.Content, "DEBUG: Row generation info");
			}
			return true;
		}