Ejemplo n.º 1
0
 public Client(string sessionId,Guid userId, IClientProxy clientProxy, Language language)
 {
     this._SessionId = sessionId;
     this._UserId = userId;
     this._ClientProxy = clientProxy;
     this._Language = language;
     this._MessageRelayEngine = new RelayEngine<Message>(this.SendMessage, this.HandlEngineException);
 }
Ejemplo n.º 2
0
 public ExchangeSystem(ExchangeSystemSetting exchangeSystemSetting, ConnectionManager connectionManager)
 {
     this._ExchangeSystemSetting = exchangeSystemSetting;
     this._ConnectionManager = connectionManager;
     this._CommandRelayEngine = new RelayEngine<Command>(this.DispatchCommand, this.HandleEngineException);
     this._QuotationRelayEngine = new RelayEngine<List<GeneralQuotation>>(this.SetQuotation, this.HandleQuotationRelayEngineException);
     this._QuotationServer = new QuotationServer(exchangeSystemSetting);
 }
Ejemplo n.º 3
0
 private void InternalStart(string managerAddress, string exchangeCode)
 {
     this._ManagerAddress = managerAddress;
     this._ExchangeCode   = exchangeCode;
     if (this._CommandRelayEngine == null)
     {
         this._CommandRelayEngine = new RelayEngine <Command>(null, this.HandlEngineException, this.SendCommand);
     }
     ThreadPool.QueueUserWorkItem(this.ConnectToManager);
 }
Ejemplo n.º 4
0
 public static void AddEvent(TraceEventType eventType, string format, params object[] args)
 {
     lock (Logger._Lock)
     {
         if (Logger.LogEngine == null)
         {
             Logger.LogEngine = new RelayEngine<Log>(Logger.WriteLog, Logger.HandlEngineException);
         }
         Logger.LogEngine.AddItem(new Log { EventType = eventType, Format = format, Args = args });
     }
 }
Ejemplo n.º 5
0
        public void Start()
        {
            this._QuotationRelayEngine = new RelayEngine<string>(this.ProcessQuotation, delegate(Exception ex) { });

            this._NetworkStream = this._TcpClient.GetStream();
            Thread receiveDataThread = new Thread(delegate()
            {
                while (true)
                {
                    byte[] buffer = new byte[2];
                    if (!this.ReadAll(buffer))
                    {
                        this.Stop();
                        break;
                    }
                    int packetLength = ((int)buffer[0]) * 256 + buffer[1];
                    if (packetLength <= 0) continue;
                    buffer = new byte[packetLength];

                    if (this.ReadAll(buffer))
                    {
                        try
                        {
                            this.Process(buffer);
                        }
                        catch (Exception e)
                        {
                            this.Stop();
                            Logger.TraceEvent(TraceEventType.Error, "QuotationClient.start ", e.ToString());
                        }
                    }
                    else
                    {
                        this.Stop();
                        break;
                    }
                }
            });
            receiveDataThread.IsBackground = true;
            receiveDataThread.Start();
        }
Ejemplo n.º 6
0
 public MessageClient()
 {
     this._MessageRelayEngine = new RelayEngine<Message>(this.ProcessMessage, this.HandleException);
 }
Ejemplo n.º 7
0
 public ExchangeSystem(ExchangeSystemSetting exchangeSystemSetting)
 {
     this._ExchangeSystemSetting = exchangeSystemSetting;
     this._CommandRelayEngine = new RelayEngine<Command>(this.Dispatch, this.HandlEngineException);
 }
Ejemplo n.º 8
0
 public MessageClient()
 {
     this._MessageRelayEngine = new RelayEngine<Message>(this.ProcessMessage, this.HandleException);
     this._MessageRelayEngine.Suspend();
     this._ExchangeDataManager = App.MainFrameWindow.ExchangeDataManager;
 }