public void Do() { // Only plant it once. if(m_bDone == false) { m_bDone = true; } else { WriteLine("PlotEvents watcher is working."); return; } try { if( m_plotMan == null ) m_plotMan = new PlotReactorManager(); m_plotMan.BeginPlot += new BeginPlotEventHandler( callback_BeginPlot); m_plotMan.BeginDocument += new BeginDocumentEventHandler( callback_BeginDocument); m_plotMan.BeginPage += new BeginPageEventHandler( callback_BeginPage); m_plotMan.EndPlot += new EndPlotEventHandler( callback_EndPlot); m_plotMan.EndDocument += new EndDocumentEventHandler( callback_EndDocument); m_plotMan.EndPage += new EndPageEventHandler( callback_EndPage); m_plotMan.PlotCancelled += new PlotCancelledEventHandler( callback_PlotCancelled); m_plotMan.PageCancelled += new PageCancelledEventHandler( callback_PageCancelled); } catch (System.Exception ex) { Helper.Message(ex); } }
public void Undo() { if( m_plotMan == null || m_bDone == false) return; try { m_plotMan.BeginPlot -= new BeginPlotEventHandler( callback_BeginPlot); m_plotMan.BeginDocument -= new BeginDocumentEventHandler( callback_BeginDocument); m_plotMan.BeginPage -= new BeginPageEventHandler( callback_BeginPage); m_plotMan.EndPlot -= new EndPlotEventHandler( callback_EndPlot); m_plotMan.EndDocument -= new EndDocumentEventHandler( callback_EndDocument); m_plotMan.EndPage -= new EndPageEventHandler( callback_EndPage); m_plotMan.PlotCancelled -= new PlotCancelledEventHandler( callback_PlotCancelled); m_plotMan.PageCancelled -= new PageCancelledEventHandler( callback_PageCancelled); m_plotMan = null; } catch (System.Exception ex) { Helper.Message(ex); } m_bDone = false; }
public PlotEvents() { m_bDone = false; m_plotMan = new PlotReactorManager(); Do(); }