public OTcpClient(string host, int port, Action connectionStabilised = null, Evaluator evaluator = null) { Host = host; Port = port; ConnectionStabilised = connectionStabilised; if (evaluator == null) { _evaluator = new Evaluator(); } _serverQueryInterfaceProxy = CreateProxy <IQueryInterface>(); new Thread(() => { while (_isKeepConnection) { ConnectServer(); _connSync.Wait(); } }) { IsBackground = true }.Start(); // enqueue sybmbol table call _symbolTable = new SymbolTable(_serverQueryInterfaceProxy.GetIndexedSymbols()); }
public OPipeClient(string pipeName, Action connectionStabilised = null, Evaluator evaluator = null) { _pipeName = pipeName; ConnectionStabilised = connectionStabilised; if (evaluator == null) { _evaluator = new Evaluator(); } _serverQueryInterfaceProxy = CreateProxy <IQueryInterface>(); new Thread(() => { while (_isKeepConnection) { ConnectPipeServer(); _connSync.Wait(); Thread.Sleep(3000); // Wait when OS close pipe if a pipe server was closed } }) { IsBackground = true }.Start(); // enqueue sybmbol table call _symbolTable = new SymbolTable(_serverQueryInterfaceProxy.GetIndexedSymbols()); }
/// <summary> /// Queries the interface. /// </summary> /// <typeparam name="T">Type of the destination object.</typeparam> /// <returns>Interface Implementation.</returns> public T QueryInterface <T>() where T : class, IQueryInterface { Type typeT = typeof(T); string key = typeT.FullName; foreach (KeyValuePair <Type, IQueryInterface> pairItem in _queryInterfaces) { if (typeT.IsAssignableFrom(pairItem.Key)) { return(pairItem.Value as T); } } foreach (KeyValuePair <Type, IQueryInterface> pairSubItem in _queryInterfaces) { IQueryInterface query = pairSubItem.Value.QueryInterface <T>() as IQueryInterface; if (query != null) { return(query as T); } } return(default(T)); }
public GetPaymentsQueryHandler(IQueryInterface <Payment> paymentQueryInterface) { _paymentQueryInterface = paymentQueryInterface; }