private void initiateServer() { try { // Keep track if player is server or client active = e_active.server; NetworkServer server = new NetworkServer(); // random between 1 or 2 if (new Random().Next(0, 2) > 0) { // true means server starts } /* TODO: * Initate game, send prompt to client * Draw who'll start (50/50?) * Keep track of boards * Change visisbility between groupboxes! * * Add pictures to picBoxes, * On click, call function, applay player symbol. If it is alrady filled, do nothing. * Call oposing player of change, tell its thier turn. * */ } catch (Exception err) { MessageBox.Show(err.Message, Text); } }
private void initiateClient() { try { // Keep track if player is server or client active = e_active.client; NetClientUI clientUI = new NetClientUI(); DialogResult rClient = clientUI.ShowDialog(); if (rClient == DialogResult.OK) { client = new NetworkClient(clientUI.Ip); client.connectClientAndResponse(); } else if (rClient == DialogResult.Cancel) { return; } } catch (Exception err) { MessageBox.Show(err.Message, Text); } }