Esempio n. 1
0
 public int ServerStart(IRTDUpdateEvent theCallback_)
 {
     theCallback = theCallback_;
     theTimer.Tick += new EventHandler(TimerEventHandler);
     theTimer.Interval = 2000; // because excel will only check about 2 seconds anyway
     return 1;
 }
Esempio n. 2
0
        }// DisconnectData

        //
        int IRtdServer.ServerStart(IRTDUpdateEvent CallbackObject)
        {
            m_XLRTDUpdate    = CallbackObject;                  // store reference to do callbacks.
            m_Timer          = new System.Timers.Timer(2000);
            m_Timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
            return(1);                                           // returning 1 means all is well.
        }
Esempio n. 3
0
        public int ServerStart(IRTDUpdateEvent callbackObject)
        {
            _updateEventHandler = callbackObject;
            AppConfiguration.TryToLoadLog4Net();

            return(1);
        }
 public Listener(TopicSubscriber topicSubscriber, IRTDUpdateEvent callback)
 {
     LatestValue = "no update recieved";
     this.rtdUpdateEvent = callback;
     this.TopicSubscriber = topicSubscriber;
     TopicSubscriber.OnMessageRecieved += OnMessageRecieved;
 }
        public int ServerStart(IRTDUpdateEvent CallbackObject)
        {
            if (isSolaceConnected)
            {
                logger.Info("Solace RTD Server already connected to Solace.");
                return(SUCCESS);
            }

            try
            {
                callback       = CallbackObject;
                timer          = new Timer();
                timer.Elapsed += new ElapsedEventHandler(TimeEventHandler);
                timer.Interval = 1000;
                timer.Start();

                // Register to receive Solace Connection Events
                var printEvents = new ActionBlock <ConnectionEvent>(evt =>
                {
                    logger.Info("Connection Event: {0} ResponseCode: {1} Info: {2}",
                                evt.State, evt.ResponseCode, evt.Info);
                });
                connectionEvtQueue.LinkTo(printEvents);
                solaceConnection.RegisterConnectionEvents(connectionEvtQueue);

                var cacheEvents = new ActionBlock <SolaceMessage>(evt =>
                {
                    if (messageCache.ContainsKey(evt.Destination))
                    {
                        messageCache[evt.Destination] = evt;
                    }
                    else
                    {
                        messageCache.TryAdd(evt.Destination, evt);
                    }
                });
                messageQueue.LinkTo(cacheEvents);

                // Connect to Solace
                Task <ConnectionEvent> connTask = Task.Run <ConnectionEvent>(async
                                                                                 () => await solaceConnection.ConnectAsync().ConfigureAwait(false));
                var connResult = connTask.Result;
                if (connResult.State != ConnectionState.Opened)
                {
                    return(FAILURE);
                }
                else
                {
                    isSolaceConnected = true;
                }

                logger.Info("Solace RTD Excel server has started successfully");
                return(SUCCESS);
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception on ServerStart()");
            }
            return(FAILURE);
        }
 public int ServerStart(IRTDUpdateEvent rtdUpdateEvent)
 {
     this._rtdUpdateEvent   = rtdUpdateEvent;
     synchronizationContext = new DispatcherSynchronizationContext();
     _timer = new Timer(delegate { PostUpdateNotify(); }, null, TimeSpan.Zero, TimeSpan.FromSeconds(5));
     return(1);
 }
Esempio n. 7
0
 public int ServerStart(IRTDUpdateEvent callback)
 {
     m_callback                   = callback;
     m_NotifyPeriodTimer          = new Timer(2000);
     m_NotifyPeriodTimer.Elapsed += TimerEventHandler;
     return(1);
 }
Esempio n. 8
0
 public int ServerStart(IRTDUpdateEvent theCallback_)
 {
     theCallback       = theCallback_;
     theTimer.Tick    += new EventHandler(TimerEventHandler);
     theTimer.Interval = 2000; // because excel will only check about 2 seconds anyway
     return(1);
 }
Esempio n. 9
0
        public NmsClient(IRTDUpdateEvent xlRtdUpdate, string[] keyBaseFields, string brokerUrl)
        {
            var configurationFileName = System.Reflection.Assembly.GetExecutingAssembly().Location + ".config";

            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(configurationFileName));
//            _log = log4net.LogManager.GetLogger("SubscriberApp.Logging");

            _baseFields    = keyBaseFields;
            _mXlRtdUpdate  = xlRtdUpdate;
            _brokerUrl     = brokerUrl;
            _heartBeatTime = DateTime.Now;

            //_log.Info("About to connect to ActiveMQ");
            // Each instance of the Excel RTD creates a new COM instance, since we are using static
            // fields to store the data, we do not need to re-load the data for each instance
            // ensure that we only initialize once
            lock (_lockObject)
            {
                _positionCache.ClearCaches();
                if (!Initialized)
                {
                    InitializeConnection();
                }
            }
        }
Esempio n. 10
0
 public int ServerStart(IRTDUpdateEvent CallbackObject)
 {
     updateNotify = new System.Action(delegate() {
         CallbackObject.UpdateNotify();
     });
     dispatcher = Dispatcher.CurrentDispatcher;
     return(1);
 }
Esempio n. 11
0
 // Support for pushing UpdateNotify onto the main thread.
 // RTD server may be alive or now - here we don't worry.
 // We assume UpdateNotify is not called too often here (need RTD server to be careful).
 public void UpdateNotify(IRTDUpdateEvent updateEvent)
 {
     lock (_lockObject)
     {
         _pendingRtdUpdates[updateEvent] = null;
         _syncWindow.PostUpdateNotify();
     }
 }
Esempio n. 12
0
 public int ServerStart(IRTDUpdateEvent CallbackObject)
 {
     _callback       = CallbackObject;
     _timer          = new Timer();
     _timer.Tick    += Callback;
     _timer.Interval = 500;
     return(1);
 }
Esempio n. 13
0
 public void ServerTerminate()
 {
     lock (this)
     {
         Trace.WriteLineIf(traceSwitch.TraceInfo, "Terminating K4RtdServer");
         xlRTDUpdate = null;
     }
 }
Esempio n. 14
0
 /* ServerStart is the first method called by Excel and is where we prepare the RTD server. In particular we set
  * the callback member variable and prepare the timer. Notice that the timer is not yet enabled.
  * Returning 1 indicates that everything is fine. */
 public int ServerStart(IRTDUpdateEvent callback)
 {
     m_callback       = callback;
     m_timer          = new Timer();
     m_timer.Tick    += timer_Tick;
     m_timer.Interval = 2000;
     return(1);
 }
Esempio n. 15
0
        public int ServerStart(IRTDUpdateEvent CallbackObject)
        {
            LoggingWindow.WriteLine("Starting server");

            callback = CallbackObject;

            return(1);
        }
Esempio n. 16
0
        public int ServerStart(IRTDUpdateEvent CallbackObject)
        {
            ExcelDna.Logging.LogDisplay.WriteLine("Starting server");

            callback = CallbackObject;

            return(1);
        }
Esempio n. 17
0
        public void ServerTerminate()
        {
            RTDCallback = null;

            TopicsToContractIds.Clear();
            TopicsToTickTypes.Clear();
            ContractsToMarkets.Clear();
        }
Esempio n. 18
0
 public int ServerStart(IRTDUpdateEvent callback)
 {
     m_callback       = callback;
     m_timer          = new Timer( );
     m_timer.Elapsed += this.OnTimerEvent;
     m_timer.Interval = 2000;
     m_topics         = new Dictionary <int, string>( );
     return(1);
 }
Esempio n. 19
0
        public int ServerStart(IRTDUpdateEvent callback)
        {
            this.callback = callback;
            timer         = new System.Windows.Forms.Timer();
            timer.Tick   += new EventHandler(TimerEventHandler);

            timer.Interval = 1000;
            return(1);
        }
Esempio n. 20
0
 void IRtdServer.ServerTerminate()
 {
     m_XLRTDUpdate = null;                               // drop reference
     if (m_Timer != null && m_Timer.Enabled)
     {
         m_Timer.Stop();
     }
     m_Timer = null;
 }
Esempio n. 21
0
        /// <summary>
        /// 啟動
        /// </summary>
        /// <param name="CallbackObject"></param>
        /// <returns></returns>
        public int ServerStart(IRTDUpdateEvent CallbackObject)
        {
            m_xlRTDUpdate = CallbackObject;
            m_Getter      = new RTDItemGetter(this);

            m_tmrTimer          = new Timer(10000);
            m_tmrTimer.Elapsed += tmrTimer_Elapsed;
            return(1);
        }
Esempio n. 22
0
 public int ServerStart(IRTDUpdateEvent CallbackObject)
 {
     // ServerStart should never be called when ServerTerminate has not been called.
     // So we should never have a wrapped server at this point.
     Debug.Assert(_wrappedServer == null);
     InstallAfterCalculateHandler();
     CreateWrappedServer();
     _callbackObject = CallbackObject;
     return(_wrappedServer.ServerStart(_callbackObject));
 }
 public int ServerStart(IRTDUpdateEvent CallbackObject)
 {
     flowForm.AppendExcelLog("RtdServer started");
     reverseTopicIdMap.Clear();
     updateQueue.Clear();
     topicIdMap.Clear();
     (new Thread(new ThreadStart(delegate() { lsClient.Start(false); }))).Start();
     rtdUpdateEvent = CallbackObject;
     return(1);
 }
Esempio n. 24
0
 // 1. Start the server
 public int ServerStart(IRTDUpdateEvent CallbackObject)
 {
     // Called when the first RTD topic is requested
     // Sets server to poll for updates every second
     _callback       = CallbackObject;
     _timer          = new System.Windows.Forms.Timer();
     _timer.Tick    += Callback;
     _timer.Interval = 1000;
     return(1);
 }
        /**
         * this method is called by Excel when the RTD server start (the first time the workbook calls =RTD(...)
		 * here we should creat the connection to the space
         * CallbackObject - the link between this runtime and the Excel
        */
        public int ServerStart(IRTDUpdateEvent CallbackObject)
        {
            // Hold a reference to the callback object.
            _xlRTDUpdate = CallbackObject;

            bool isConnected = SpaceInit(); //connect to the space

            //All is well, return 1. 
            return (isConnected ? 1 : 0);
        }
Esempio n. 26
0
 void IRtdServer.ServerTerminate()
 {
     m_XLRTDUpdate = null;                               // drop reference
     // Dispose of the model components.
     if (m_Timer != null && m_Timer.Enabled)
     {
         m_Timer.Stop();
     }
     m_Timer = null;
 }
Esempio n. 27
0
        public int ServerStart(IRTDUpdateEvent CallbackObject)
        {
            lock (this)
            {
                Trace.WriteLineIf(traceSwitch.TraceInfo, "ServerStart");
                xlRTDUpdate = CallbackObject;
            }

            return(1);
        }
Esempio n. 28
0
        //this method is called by Excel when the RTD server start (the first time the workbook calls =RTD(...)
        //here we should creat the connection to the space
        public int ServerStart(IRTDUpdateEvent CallbackObject)
        {
            // Hold a reference to the callback object.
            _xlRTDUpdate = CallbackObject;

            bool isConnected = SpaceInit();

            //All is well, return 1.
            return(isConnected ? 1 : 0);
        }
Esempio n. 29
0
        }// ServerStart()

        //
        // *******************************************************************
        // ****                 Server Terminate()                        ****
        // *******************************************************************
        //
        void IRtdServer.ServerTerminate()
        {
            OnRtdServerTerminate();
            if (m_Timer != null)                                            // dispose of the timer.
            {
                m_Timer.Stop();
                m_Timer.Elapsed -= new System.Timers.ElapsedEventHandler(Timer_Elapsed);
                m_Timer          = null;
            }
            m_RtdUpdateEvent = null;                                        // drop reference
        }//ServerTerminate()
Esempio n. 30
0
        /// <summary>
        /// 終止
        /// </summary>
        public void ServerTerminate()
        {
            m_xlRTDUpdate = null;
            if (m_tmrTimer.Enabled)
            {
                m_tmrTimer.Stop();
            }

            m_tmrTimer.Elapsed -= tmrTimer_Elapsed;
            m_tmrTimer.Dispose();
        }
Esempio n. 31
0
        }// DisconnectData

        //
        // Server intialization.
        //
        int IRtdServer.ServerStart(IRTDUpdateEvent CallbackObject) // this is the initialization.
        {
            m_XLRTDUpdate = CallbackObject;                        // store reference to do callbacks.
            // Can do some model initialization here.
            // But request specific information gets passed in using ConnectData() call.
            // There we will finish intializing our model.
            m_Timer          = new System.Timers.Timer(2000);
            m_Timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);

            return(1);                                           // returning 1 means all is well.
        }
Esempio n. 32
0
 // *****************************************************************
 // ****                 Server Start()                          ****
 // *****************************************************************
 /// <summary>
 ///  These methods implement the IRtdServer interface, allowing us to receive
 ///  calls from excel thread.
 ///  This is triggered when excel starts the new workbook.
 /// </summary>
 /// <param name="CallbackObject">Object we use to inform excel of updates</param>
 /// <returns>1 (healthy RTD server)</returns>
 int IRtdServer.ServerStart(IRTDUpdateEvent CallbackObject)          // this is the initialization.
 {
     m_RtdUpdateEvent = CallbackObject;                              // store reference to do callbacks.
     OnRtdServerStart();
     if (m_Timer == null)
     {
         m_Timer          = new System.Timers.Timer();
         m_Timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
     }
     return(1);                                                       // returning 1 = "is healthy".
 }// ServerStart()
        public int ServerStart(IRTDUpdateEvent callback)
        {
            m_callback = callback;

            m_timer          = new Timer();
            m_timer.Tick    += new EventHandler(TimerEventHandler);
            m_timer.Interval = 500;

            m_topics = new Dictionary <int, TopicData>();

            return(1);
        }
    public int ServerStart(IRTDUpdateEvent CallbackObject)
    {
        m_source = new Dictionary<int, string>();
        m_bland = new Dictionary<int, string>();
        m_field = new Dictionary<int, string>();
        m_data = new Dictionary<int, string>();

        m_callback = CallbackObject;

        m_timer = new System.Windows.Forms.Timer();
        m_timer.Tick += Callback;
        m_timer.Interval = INTERVAL;

        return 1;
    }
 // Should only be called from the RTD server ServerStart
 // Keeps track of the 'alive' RTD servers.
 public void RegisterUpdateNotify(IRTDUpdateEvent updateEvent)
 {
     _registeredRtdUpdates[updateEvent] = null;
 }
 // Support for pushing UpdateNotify onto the main thread.
 // RTD server may be alive or now - here we don't worry.
 // We assume UpdateNotify is not called too often here (need RTD server to be careful).
 public void UpdateNotify(IRTDUpdateEvent updateEvent)
 {
     lock (_lockObject)
     {
         _pendingRtdUpdates[updateEvent] = null;
         _syncWindow.PostUpdateNotify();
     }
 }
Esempio n. 37
0
 public int ServerStart(IRTDUpdateEvent CallbackObject)
 {
     try
     {
         using (XlCall.Suspend())
         {
             if (_rtdServer != null)
             {
                 return _rtdServer.ServerStart(CallbackObject);
             }
             // CallbackObject will actually be a RCW (__ComObject) so the type 'mismatch' calling Invoke never arises.
             return _ServerStart(CallbackObject);
         }
     }
     catch (Exception e)
     {
         Logging.LogDisplay.WriteLine("Error in RTD server {0} ServerStart: {1}", _progId, e.ToString());
         return 0;
     }
 }
Esempio n. 38
0
        /// <summary>
        /// Called when Excel RTD connects to this automation component.
        /// </summary>
        /// <param name="callbackObject">[In] This is the object through which
        /// this RTD server notifies Excel that real-time data updates are
        /// available.</param>
        /// <returns>1 to denote "success".</returns>
        public int ServerStart(IRTDUpdateEvent callbackObject)
        {
            // Used by this component to notify Excel that
            // new data is available.
            m_callback = callbackObject;

            // Set timer to trigger every 2 seconds.
            m_timer = new Timer();
            m_timer.Tick += new EventHandler(TimerEventHandler);
            m_timer.Interval = 2000; // 2 seconds

            return 1;
        }
Esempio n. 39
0
        // This is the private implementation of the IRtdServer interface
        int IRtdServer.ServerStart(IRTDUpdateEvent callbackObject)
        {
            try
            {
                _updateSync = SynchronizationManager.RtdUpdateSynchronization;
                if (_updateSync == null)
                {
                    // CONSIDER: A better message to alert user of problem here?
                    return 0;
                }

                _callbackObject = callbackObject;
                _updateSync.RegisterUpdateNotify(_callbackObject);
                using (XlCall.Suspend())
                {
                    return ServerStart() ? 1 : 0;
                }
            }
            catch (Exception e)
            {
                Logger.RtdServer.Error("Error in RTD server {0} ServerStart: {1}", GetType().Name, e.ToString());
                return 0;
            }
        }
Esempio n. 40
0
        /// <summary>
        ///   Called when Excel RTD connects to this automation component.
        /// </summary>
        /// <param name="callbackObject"> [In] This is the object through which this RTD server notifies Excel that real-time data updates are available. </param>
        /// <returns> 1 to denote "success". </returns>
        public int ServerStart(IRTDUpdateEvent callbackObject)
        {
            // Uncomment to prevent Server Startup to allow fixup of problematic spreadsheet
            //            return 1;

            MCallback = callbackObject;

            // Create an inactive one-shot timer with ModbusScan() as delegate
            _modbusscantimer = new Timer(delegate { ModbusScan(); }, null, Timeout.Infinite, Timeout.Infinite);
            // Now that timer is initialized,
            // 8-8-15 Dont start it here. It will be started when client sends serverdisabled=false
            _modbusscantimer.Change(CfgInfo.IdleTimerInterval, Timeout.Infinite);

            //            _lastupdate = Now() - CfgInfo.PollRate;

            if ((CfgInfo.DebugLevel & LogLevel.ServerStartStop) == LogLevel.ServerStartStop)
                Log.Info("ExcelRTD ServerStart Logger:{0}, Logfile:{1}", LogManager.GetCurrentClassLogger(),
                         LogManager.GetLogger("logfile"));

            return 1;
        }
Esempio n. 41
0
        public int ServerStart(IRTDUpdateEvent CallbackObject)
        {
            ExcelDna.Logging.LogDisplay.WriteLine("Starting server");

            callback = CallbackObject;

            return 1;
        }
Esempio n. 42
0
 public void ServerTerminate()
 {
     lock( this)
     {
         Trace.WriteLineIf( traceSwitch.TraceInfo, "Terminating K4RtdServer");
         xlRTDUpdate = null;
     }
 }
 private void clean()
 {
     try
     {
         //remove the event
         if (_eventReg != null)
         {
             _proxy.DefaultDataEventSession.RemoveListener(_eventReg);
             _eventReg = null;
         }
         // Clear the RTDUpdateEvent reference.
         _xlRTDUpdate = null;
     }
     catch (Exception ex)
     {
         System.Console.Write(ex);
     }
 }
        public int ServerStart(IRTDUpdateEvent callback)
        {
            try
            {
                rtdCallback = callback;

                CreateActiveMQSession();

                isInitialised = true;

            }
            catch (Exception ex)
            {
                lastErrorMsg = ex.Message;
            }

            return 1;
        }
Esempio n. 45
0
        public int ServerStart(IRTDUpdateEvent callback)
        {
            if (logOSEvent != null)
                logOSEvent.WriteEntry("ServerStart() ");

            m_callback = callback;
            m_timer = new Timer(TimerFunc, null, Timeout.Infinite, Timeout.Infinite);
            return 1;
        }
Esempio n. 46
0
        public int ServerStart(IRTDUpdateEvent CallbackObject)
        {
            lock( this)
            {
                Trace.WriteLineIf( traceSwitch.TraceInfo, "ServerStart");
                xlRTDUpdate = CallbackObject;
            }

            return 1;
        }
Esempio n. 47
0
        /// <summary>
        /// Called when Excel requests the first RTD topic for the server. 
        /// Connect to the broker, returns a on success and 0 otherwise
        /// </summary>
        /// <param name="CallbackObject"></param>
        /// <returns></returns>
        public int ServerStart(IRTDUpdateEvent CallbackObject)
        {
            _onMessage = CallbackObject;  
            string host = "localhost";
            string port = "5673";
            string virtualhost = "test";
            string username = "******";
            string password = "******";
            _messageProcessor = getMessage;
          
            if( ConfigurationManager.AppSettings["Host"] != null )
            {
                host = ConfigurationManager.AppSettings["Host"];
            }
            if (ConfigurationManager.AppSettings["Port"] != null)
            {
                port = ConfigurationManager.AppSettings["Port"];
            }
            if (ConfigurationManager.AppSettings["VirtualHost"] != null)
            {
                virtualhost = ConfigurationManager.AppSettings["VirtualHost"];
            }
            if (ConfigurationManager.AppSettings["Username"] != null)
            {
                username = ConfigurationManager.AppSettings["UserName"];
            }
            if (ConfigurationManager.AppSettings["Password"] != null)
            {
                password = ConfigurationManager.AppSettings["Password"];
            }
            if (ConfigurationManager.AppSettings["ProcessorAssembly"] != null)
            {
                try
                {
                    Assembly a = Assembly.LoadFrom(ConfigurationManager.AppSettings["ProcessorAssembly"]);
                    Object o = a.CreateInstance(ConfigurationManager.AppSettings["ProcessorClass"]);
                    MessageProcessor p = (MessageProcessor) o;
                    _messageProcessor = p.ProcessMessage;
                }
                catch (Exception e)
                {
                    System.Windows.Forms.MessageBox.Show("Error: \n" + e.StackTrace);         
                    return 0;
                }
            }

            System.Windows.Forms.MessageBox.Show("Connection parameters: \n host: " + host + "\n port: " 
                                                 + port + "\n user: "******"Error: \n" + e.StackTrace);         
                return 0;
            }
            
            // always successful 
            return 1;
        }
Esempio n. 48
0
        public void ServerTerminate()
        {
            ExcelDna.Logging.LogDisplay.WriteLine("Stopping server");

            callback = null;
        }
 // Should be called from the RTD server ServerTerminate
 // This doesn't really solve the problem of another thread calling UpdateNotify after ServerTerminate....?
 public void DeregisterUpdateNotify(IRTDUpdateEvent updateEvent)
 {
     _registeredRtdUpdates.Remove(updateEvent);
 }
Esempio n. 50
0
 public int ServerStart(IRTDUpdateEvent CallbackObject)
 {
     updateNotify = new System.Action(delegate() {
         CallbackObject.UpdateNotify();
     });
     dispatcher = Dispatcher.CurrentDispatcher;
     return 1;
 }
Esempio n. 51
0
 public int ServerStart(IRTDUpdateEvent callback)
 {
     this.ExcelCallback = callback;
     this.RefreshTimer = new Timer();
     this.RefreshTimer.Tick += delegate(object sender, EventArgs e)
     {
         this.RefreshTimer.Stop();
         this.ExcelCallback.UpdateNotify();
     };
     this.RefreshTimer.Interval = this.RefreshInterval;
     this.CreateProxy();
     return 1;
 }
Esempio n. 52
0
        public int ServerStart(IRTDUpdateEvent callback)
        {
            WriteLog("ServerStart() ");

            try
            {
                msgChannel = new TibcoMsgChannel();
                msgChannel.Service = RTDServerConfig.Instance.ServiceCode;
                msgChannel.Network = RTDServerConfig.Instance.Network;
                msgChannel.Daemon = RTDServerConfig.Instance.Daemon;
                msgChannel.Description = "PriceRTDServer";
                msgChannel.Connect();

                priceClient = new PriceClient(msgChannel);
                priceClient.OnUpdatePrice += new Action<string, decimal>(priceClient_OnUpdatePrice);
                priceClient.Subscribe("ST.OMS.SERVER.Price.>");

                WriteLog(string.Format("MsgChannel {0},{1},{2}", RTDServerConfig.Instance.Daemon, RTDServerConfig.Instance.Network, RTDServerConfig.Instance.ServiceCode));
            }
            catch (Exception exp)
            {
                WriteLog("MsgChannel connect faile");
            }

            m_callback = callback;
            return 1;
        }
Esempio n. 53
0
        public int ServerStart(IRTDUpdateEvent CallbackObject)
        {
            LoggingWindow.WriteLine("Starting server");

            callback = CallbackObject;

            return 1;
        }
Esempio n. 54
0
 public int ServerStart(IRTDUpdateEvent rtdUpdateEvent)
 {
     _timer = new Timer(delegate { rtdUpdateEvent.UpdateNotify(); }, null, TimeSpan.Zero, TimeSpan.FromSeconds(5));
     return 1;
 }
Esempio n. 55
0
        public void ServerTerminate()
        {
            LoggingWindow.WriteLine("Stopping server");

            callback = null;
        }
Esempio n. 56
0
 public void ServerTerminate()
 {
     // Clear the RTDUpdateEvent reference.
     _xlRTDUpdate = null;
 }
Esempio n. 57
0
File: rtd.cs Progetto: npalko/uRPC
        public int ServerStart(IRTDUpdateEvent callback)
        {
            // ServerStart is the first method called by Excel and is where we
              // prepare the RTD server. In particular we set the callback member
              // variable and prepare the timer. Notice that the timer is not yet
              // enabled. Returning 1 indicates that everything is fine.

              m_callback = callback;
              m_timer = new Timer();
              m_timer.Tick += new EventHandler(TimerEventHandler);
              m_timer.Interval = 2000;

              return 1;
        }