private async void OnConnectTcp(TcpClientViewModel model) { if (!string.IsNullOrEmpty(model.Ip) && (model.Port > 0 && model.Port < 65535)) { model.FileDir = SelectedDsik; await _hcdzClient.ConnectTcpServer(SelectedDsik, model.Ip, model.Port, model.Id); } }
private void NoticeTcpConnect(bool arg, TcpClientViewModel model) { var findItem = TcpViewModel.FirstOrDefault(o => o.Id == model.Id); findItem.IsConnected = model.IsConnected; findItem.MessageText += model.IsConnected == true ? "TCP连接成功!\n" : "TCP连接断开!\n"; findItem.BtnIsEnabled = model.IsConnected == true ? false : true; }
private void NoticeTcpData(TcpClientViewModel model) { var findItem = TcpViewModel.FirstOrDefault(o => o.Id == model.Id); findItem.CurrentSize = model.DataSize; findItem.IsBegin = true; findItem.RateText = string.Format("速率{0}MB/s", (model.DataSize / 1048576.0).ToString("f2")); // findItem.DataSize += model.DataSize; }
private async void OnCloseTcp(TcpClientViewModel model) { model.IsBegin = false; await _hcdzClient.CloseTcpServer(model.Id); }