public override void JoinPartita(DescrittorePartita descrittore) { base.JoinPartita(descrittore); if (_currentPartita == null) { try { _chatComune = new ChatComune(); _chatCoordinamentoMaster = new ChatCoordinamentoMaster(); _gestoreSchede = new GestoreSchedeMaster(); _gestoreSchede.Dock = DockStyle.Fill; _gestoreSchede.Carica(_path + descrittore.IdPartita + "/"); _currentPartita = new PartitaMaster(); _currentPartita.Dock = DockStyle.Fill; _currentPartita.BindComponent(_gestoreSchede); _currentPartita.BindComponent(_chatComune); _currentPartita.BindComponent(_chatCoordinamentoMaster); _serverSocket = new MyServerSocket("127.0.0.1", PortEnum.Master); _currentPartita.BindComponent(_serverSocket); _partitaForm = new Form(); _partitaForm.Controls.Add(_currentPartita); _partitaForm.Size = new System.Drawing.Size(800, 600); System.Drawing.Rectangle resolution = Screen.PrimaryScreen.Bounds; _partitaForm.Location = new System.Drawing.Point(0, resolution.Height - 650); _partitaForm.Text = descrittore.Nome; _partitaForm.FormClosing += _gestoreSchede.Salva; _partitaForm.FormClosed += LeavePartita; _partitaForm.Show(); } catch (SocketException) { MessageBox.Show("Master non trovato", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
protected virtual void SocketMessageHandler(MyServerSocket sender, Utility.Messages.ServerSocketErrorMessageEventArgs e) { DocumentoMaster.GetIstance().LeavePartita(this, e); }
protected void Draw(MyServerSocket myServerSocket) { myServerSocket.Output += SocketForwarder; _components.Add(myServerSocket); }