/// <summary> /// Called when Excel starts the RTD server. /// </summary> /// <param name="callbackObject">The call back object.</param> /// <returns>Status code.</returns> int Excel.IRtdServer.ServerStart(Microsoft.Office.Interop.Excel.IRTDUpdateEvent callbackObject) { // Store the callback object. m_callback = callbackObject; // Initialise and start the timer. m_timer = new System.Timers.Timer(1000); m_timer.Elapsed += TimerElapsed; m_timer.Start(); return(1); }
// This will be called just after the constructor. We need to cache the // IRTDUpdateEvent reference. We'll also setup a timer (with a 1000 // millisecond interval) to trigger the simulated data updates. Finally, // return 1 if all is OK. public int ServerStart( Microsoft.Office.Interop.Excel.IRTDUpdateEvent CallbackObject) { xlUpdateEvent = CallbackObject; timer = new Timer(1000); timer.AutoReset = true; timer.Elapsed += new ElapsedEventHandler(TimerEventHandler); return(1); }