static void OnServerConnectionAvailable(object sender, SecureConnectionResults args) { if (args.AsyncException != null) { _Log.ErrorFormat("Client connection failed {0}", args.AsyncException); return; } try { SslStream sslStream = args.SecureStream; Guid session = Guid.NewGuid(); var receiveAgent = new ReceiveManager.ReceiveAgent(ClientRequestHelper.Process); var client = new Communication.Client(sslStream, session); var iClient = client as Trader.Helper.Common.ICommunicationAgent; iClient.DataArrived += ReceiveCenter.Default.DataArrivedHandler; iClient.Closed += AgentController.Default.SenderClosedEventHandle; var iReceiver = receiveAgent as Trader.Helper.Common.IReceiveAgent; iReceiver.ResponseSent += SendCenter.Default.ResponseSentHandle; AgentController.Default.Add(session, receiveAgent, client); } catch (Exception ex) { _Log.Error(ex); } }
public MainViewModel() { Message = ""; ReceivedMessages = new ObservableCollection <string>(); ConnectBtnClickCmd = new RelayCommand( () => { if (string.IsNullOrEmpty(ChatName)) { return; } SetIsConnected(true); clientcom = new Communication.Client("127.0.0.1", 6666, new Action <string>(NewMessageReceived), ClientDissconnected); Message = "connected"; SendBtnClickCmd.Execute(this); RaiseAllCanExecuteChanged(); }, () => { return(!isConnected); }); SendBtnClickCmd = new RelayCommand( () => { clientcom.Send(ChatName + ": " + Message); ReceivedMessages.Add("YOU: " + Message); }, () => { return(isConnected && Message.Length >= 1); }); }
public MainViewModel() { Message = ""; ReceivedMessages = new ObservableCollection <string>(); ConnectBtnClick = new RelayCommand( () => { isConnected = true; client = new Communication.Client("127.0.0.1", 8080, DisconnectClient, new Action <string>(NewMessageReceived)); }, () => { return(!isConnected); }); SendBtnClick = new RelayCommand( () => { isConnected = true; client.Send(ChatName + ": " + Message); ReceivedMessages.Add("YOU: " + Message); }, () => { return(isConnected && Message.Length >= 1); }); }
public ImageWeb() { webClient = Communication.Client.GetInstance; webClient.RecivedMessageFromServer(); Config1 = Configuration.GetInstance; NumberOfImgs = NumberOfImages(); CommandRecievedEventArgs commanToSent = new CommandRecievedEventArgs((int)CommandStateEnum.GET_APP_CONFIG, new string[5], ""); webClient.SendCommandToServer(commanToSent); List <Creator> student = InizilaizedCreator(); Students = student; }
private Configuration() { configClient = Client.GetInstance; configClient.CommandRecieved += this.OnUpdate; OutputDir = string.Empty; SourceName = string.Empty; LogName = string.Empty; ThumbS = 0; HandlerList = new ObservableCollection <string>(); CommandRecievedEventArgs commandToSent = new CommandRecievedEventArgs((int)CommandStateEnum.GET_APP_CONFIG, new string[5], ""); configClient.SendCommandToServer(commandToSent); }
private void UpdateConnection(string ipaddress, bool connect) { if (connect == true) { client = new Communication.Client(1030, ipaddress, UpdateMessageBox, ResetButtonText, ResetClient); Thread clientMainThread = new Thread(x => client.StartClient()); clientMainThread.Start(); } else { SendMessage(Resources.ConnectionCloseFlag); client.CloseConnection(); ResetClient(); } }
private void ResetClient() { client = null; }