private void SendComLogin() { ArgComAutorize arg = new ArgComAutorize(); arg.Login = "******"; arg.Password = "******"; if (_netClient.Connector != null) { _netClient.Connector.SendCommand(arg, true); } }
private void NCAutorizeNewClient(IConnector connector, ArgComAutorize arg) { if (arg == null || connector == null) { return; } ATCPConnector atcpcon = connector as ATCPConnector; if (atcpcon == null) { return; } if (!string.IsNullOrEmpty(arg.Login) && arg.Password == "Password") { _autorizator.RemoveConnector(connector.UniqueID); ArgUniqueID argClientID = new ArgUniqueID(NComSendClientID.uniqueID); argClientID.UniqueID = Uid64.CreateNewSync().Data; TeamPainterTCPClient client = new TeamPainterTCPClient(atcpcon, argClientID.UniqueID, arg.Login); bool added = _worker.AddClient(client); if (!added) { client.Disconnect(); return; } lvClients.Invoke((MethodInvoker) delegate { ListViewItem lvi = lvClients.Items[client.Connector.UniqueID.ToString()]; if (lvi != null) { lvi.Name = client.UniqueID.ToString(); lvi.SubItems[0].Text = client.UniqueID.ToString(); lvi.SubItems[1].Text = arg.Login; lvi.BackColor = Color.WhiteSmoke; lvi.ForeColor = Color.Black; lvClients.Invalidate(); } }); connector.SendCommand(argClientID); } }