internal Feed(int heartbeat) { var rtd = Type.GetTypeFromCLSID( new Guid(Registry.GetValue(registryKey, "", null).ToString())); this.server = (IRTDServer)Activator.CreateInstance(rtd); this.HeartbeatInterval = heartbeat; this.server.ServerStart(this); }
public RTDClient(string address) { var a = new EndpointAddress(address); var b = new NetTcpBinding(); var f = new DuplexChannelFactory <IRTDServer>(this, b, a); _server = f.CreateChannel(); _server.Register(); }
public void AutoOpen() { // setup support for RTD functions ExcelAsyncUtil.Initialize(); // setup error handler ExcelIntegration.RegisterUnhandledExceptionHandler(ex => "!!! EXCEPTION: " + ex.ToString()); // setup connection to server var a = new EndpointAddress("net.tcp://localhost:8080/hello"); var b = new NetTcpBinding(); var f = new DuplexChannelFactory <IRTDServer>(this, b, a); _server = f.CreateChannel(); _server.Register(); // this makes the server get a callback channel to us so it can call SendValue // increase RTD refresh rate since the 2 seconds default is too slow (move as setting to ribbon later) object app; object rtd; app = ExcelDnaUtil.Application; rtd = app.GetType().InvokeMember("RTD", BindingFlags.GetProperty, null, app, null); rtd.GetType().InvokeMember("ThrottleInterval", BindingFlags.SetProperty, null, rtd, new object[] { 100 }); }
/// <summary> /// Load assemblies /// </summary> /// <param name="binPath">path to the kit binaries, empty use location of this assembly</param> private void loadRTDAssemblies(string binPath) { try { if(binPath.Length ==0) { // get the location of the current assembly i.e. K2RTDServerKit, assume dependancies are there string[] reqAssyDef = System.Reflection.Assembly.GetExecutingAssembly().FullName.Split(','); int reqDllNamePos = System.Reflection.Assembly.GetExecutingAssembly().Location.IndexOf(reqAssyDef[0]); binPath = System.Reflection.Assembly.GetExecutingAssembly().Location.Substring(0, reqDllNamePos - 1); } //m_PlugInLog.Info("DynamicLoad:" + myPath); string mainDllPath = binPath + @"\K2RTDRequestHandler.dll"; //string mainDllPath = binPath + @"\K2RTDRequestHandler.dll"; m_Server = DynamicLoad(mainDllPath); } catch { } }