public void SetupForRecv(Mainform appParent) { try { AsyncCallback receiveData = new AsyncCallback(appParent.OnRecievedANS); m_sock.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, receiveData, this); } catch (Exception ex) { MessageBox.Show("Recieve callback setup failed! {0}", ex.Message); } }
/// <summary> /// OK Button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { try { int iPlayers = int.Parse(textBox1.Text); int iQuestions = int.Parse(textBox3.Text); int iTimeOutSeconds = int.Parse(textBox2.Text); _mainForm = new Mainform(iPlayers,iTimeOutSeconds,iQuestions); this.Hide(); _mainForm._OptionForm = this; this.Owner = _mainForm; _mainForm.Show(); } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
public DauTruongServer(Form gui, int playerCount) { try { _listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _iPlayers = playerCount; _PlayerList = new ArrayList(_iPlayers); countdownEvent = new CountdownEvent(_PlayerList.Count); GUI = gui as Mainform; if (useLoopback == false) { IPAddress[] addrList = Dns.GetHostEntry(Dns.GetHostName()).AddressList; foreach (IPAddress ip in addrList) { if (ip.AddressFamily == AddressFamily.InterNetwork) _localAddr = ip; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public OptionForm(Form form) { InitializeComponent(); _mainForm = form as Mainform; }