public void Run() { try { clientForm = new ClientForm(this); Thread tcpThread = new Thread(() => { TcpProcessServerResponse(); }); tcpThread.Start(); Thread udpThread = new Thread(() => { UdpProcessServerResponse(); }); udpThread.Start(); TcpSendMessage(new LoginPacket((IPEndPoint)udpClient.Client.LocalEndPoint, PublicKey)); clientForm.ShowDialog(); } catch (Exception exception) { Console.WriteLine("Client Run Exception: " + exception.Message); } finally { tcpClient.Close(); udpClient.Close(); } }
public Form_Main() { InitializeComponent(); TestClient client = new TestClient(); client.Strart(); ClientForm clientForm = new ClientForm(); if (clientForm.ShowDialog() == DialogResult.OK) { var login = clientForm.textBox1.Text; var pwd = clientForm.textBox2.Text; user = client.Login(login, pwd); if (user.Id == -1) { MessageBox.Show("Access denied"); Load += (s, e) => Close(); return; } tests = user.Groups.SelectMany(g => g.Tests).ToList(); dataGridView1.DataSource = tests .Select(x => new { Id = x.Id, Title = x.Title, Author = x.Author, DtCreate = x.DtCreate }) .ToList(); } }
public void Run() { clientForm = new ClientForm(this); Thread thread = new Thread(() => { ProcessServerResponce(); }); thread.Start(); clientForm.ShowDialog(); tcpClient.Close(); }
private void ReceiveAnswer(Socket serverSocket) { byte[] buffer = new byte[10]; serverSocket.Receive(buffer); string message = Encoding.UTF8.GetString(buffer).Replace("\0", string.Empty); if (message.Equals("Enter")) { ClientForm form = new ClientForm(serverSocket); form.ShowDialog(); } }
public void Run() { m_clientForm = new ClientForm(this); Thread tcpThread = new Thread(() => { TcpProcessServerResponse(); }); tcpThread.Start(); //Thread udpThread = new Thread(() => { UdpProcessServerResponse(); }); //udpThread.Start(); //Login(); //TODO FIX m_clientForm.ShowDialog(); }
//TCP FUNCTIONALITY public void Run() { _clientForm = new ClientForm(this); //start TCP thread for recieving packets _tcpThread = new Thread(() => { TCPProcessServerResponse(); }); _tcpThread.Start(); _udpThread = new Thread(() => { UDPProcessServerResponse(); }); _udpThread.Start(); Login(); _clientForm.ShowDialog(); //show window }
private void loginButton_Click(object sender, EventArgs e) { using (var db = new DatabaseEntities()) { String username = textBoxUsername.Text; String password = Utils.GetMD5Hash(textBoxPassword.Text); String message = String.Empty; Boolean isGood = true; var result = db.Users.FirstOrDefault(t => t.Username == username); if (result == null) { message = String.Format("There is no user with username {0}!", username); isGood = false; } else { if (result.Password != password) { message = "Password is wrong!"; isGood = false; } } if (!isGood) { MessageBox.Show(message); return; } Form form = null; switch (result.Access) { case 0: form = new AdminForm(); break; case 1: form = new ClientForm(result); break; default: break; } if (form != null) { this.Hide(); form.ShowDialog(); this.Show(); } } }
static void Main(string[] args) { Form f = new ClientForm(); f.ShowDialog(); }
private void ShowForm(ClientForm window) { window.ShowDialog(); }
private void newClientToolStripMenuItem_Click(object sender, EventArgs e) { /* Create a new client window selection in menu list 'Client' */ ClientForm newForm = new ClientForm(); newForm.ShowDialog(); }
public Client() { clientForm = new ClientForm(this); clientForm.ShowDialog(); }