internal void UpdateTcpConfiguration(ITcpConfigurationDTO tcp) { DettachedEvent(); NetworkColletion.Instance.CreateConnection(tcp); AttachedEvent(tcp); _tcpDTO = tcp; }
private void UpdateTcpConfig() { ITcpConfigurationDTO tcpDTO = _configservice.ReadTcp(); txtPort.Text = tcpDTO.Port.ToString(); txtTempo.Text = tcpDTO.Time.ToString(); }
private void AttachedEvent(ITcpConfigurationDTO tcp) { if (NetworkColletion.Instance.TcpConnection != null) { NetworkColletion.Instance.TcpConnection.OnDataReceive += TcpConnection_OnDataReceive; } _taskFactory.StartNew(() => SendInfoTask(tcp, _cancel.Token)); }
public static void Save(File filesDir, ITcpConfigurationDTO tcp) { var json = new JSONObject(); json.Put(nameof(ITcpConfigurationDTO.Port), tcp.Port); json.Put(nameof(ITcpConfigurationDTO.Time), tcp.Time); TextFile.Save(filesDir, c_tcpJson, json.ToString()); Core.Instance.UpdateTcpConfiguration(tcp); }
private void SendInfoTask(ITcpConfigurationDTO tcp, CancellationToken token) { if (tcp.Time >= 0) { while (!token.IsCancellationRequested) { SendInfo(); Task.Delay(tcp.Time, token).Wait(); } } }
public TcpServerNetwork CreateTcpConnection(ITcpConfigurationDTO tcp) { if (NetworkColletion.Instance.TcpConnection != null) { NetworkColletion.Instance.TcpConnection.OnError -= TcpConnection_OnError; } NetworkColletion.Instance.CreateConnection(tcp); NetworkColletion.Instance.TcpConnection.OnError += TcpConnection_OnError; return(NetworkColletion.Instance.TcpConnection); }
private void ConfigService_OnTcpConfigUpdate(object sender, ITcpConfigurationDTO e) { _networkService.CreateTcpConnection(e); }
public void CreateConnection(ITcpConfigurationDTO tcpConfiguration) { StopConnection(); TcpConnection = NetworkFactory.CreateTcp(tcpConfiguration.Port); }
public void Save(ITcpConfigurationDTO tcpDTO) { ReadWriteObject.Save(_fileDir, tcpDTO); }
public void StartServerTcp(ITcpConfigurationDTO tcp) { UpdateTcpConfiguration(tcp); }