private void CreateInvoke(object o, EventArgs eArgs) { if (this.InvokeRequired) { this.Invoke(new EventHandler(CreateInvoke), new object[] { o, eArgs }); //IAsyncResult res = this.BeginInvoke(new EventHandler(CreateInvoke), new object[] { o, eArgs }); //this.EndInvoke(res); /* * LogHub logHub = (LogHub)o; * if (logHub.m_ErrorView != null) * { * logHub.m_ErrorView.AddMessage("Awesome!"); * } * else * { * int nn = 0; * } */ } else { LogHub logHub = (LogHub)o; CreatorEventArgs e = (CreatorEventArgs)eArgs; LogViewer v = new LogViewer(logHub, true); v.Text = logHub.LogName + " Error"; v.TopMost = true; v.Show(); v.AddMessage(e.Message); //if (logHub.m_ErrorView == null) // logHub.m_ErrorView = v; } }
}// CreateLogViewer() // // private void GuiCreator_FormCreated(object sender, EventArgs eventArgs) { m_GuiCreator = null; // let go of this gui creator. if (m_LogViewer == null) { FrontEnds.Utilities.GuiCreator.CreateFormEventArgs e = (FrontEnds.Utilities.GuiCreator.CreateFormEventArgs)eventArgs; if (e.CreatedForm is LogViewer) { m_LogViewer = (LogViewer)e.CreatedForm; this.IsViewActive = true; } } }// CreateLogViewer()
}//end Stop(). // // /// <summary> /// TODO: This does not seem to be thread-safe!! Can't we be writing to LogViewer after /// user has closed and destroyed object? /// </summary> /// <param name="viewerToRemove"></param> public void RemoveLogViewer(LogViewer viewerToRemove) { if (viewerToRemove == m_LogViewer) { m_IsViewActive = false; m_LogViewer = null; // release this viewer. return; } //lock (m_ErrorViewLock) //{ // if (viewerToRemove == m_ErrorView) // m_ErrorView = null; // release this viewer //} }