void connector_Connected(object sender, ConnectionEventArgs e) { serverID = e.ID; }
void connector_ConnectionLost(object sender, ConnectionEventArgs e) { if (Ready2Timer != null) { Ready2Timer.Stop(); } //View.ConnectionFailed(); GameInProgress = false; shipSelected = false; }
void conn_ConnectionLost(object sender, ConnectionEventArgs e) { OnEvent(ConnectionLost, e); }
void conn_Connected(object sender, ConnectionEventArgs e) { OnEvent(Connected, e); }
protected virtual void OnEvent(EventHandler<ConnectionEventArgs> handler, ConnectionEventArgs e) { if (handler != null) { foreach (EventHandler<ConnectionEventArgs> singleCast in handler.GetInvocationList()) { ISynchronizeInvoke syncInvoke = singleCast.Target as ISynchronizeInvoke; try { //This code is to make the raising of the event threadsafe with the UI thread. if (syncInvoke != null && syncInvoke.InvokeRequired) { syncInvoke.BeginInvoke(singleCast, new object[] { this, e }); } else { singleCast(this, e); } } catch (Exception ex) { if (CrashOnException) { throw; } else { if (e != null) { RaiseExceptionEncountered(ex, e.ID); } else { RaiseExceptionEncountered(ex, Guid.Empty); } } } } } }
void Processor_NewClientConnected(object sender, ConnectionEventArgs e) { if (sender == clientProcessor) { LastclientID = e.ID; StartServerConnection(); } else { if (proxyType == ProxyType.OneServerConnectionToOneClientConnection) { ServersToClients.Add(e.ID, LastclientID); ClientsToServers.Add(LastclientID, e.ID); LastclientID = Guid.Empty; } } }
void ServerProcessor_Connected(object sender, ConnectionEventArgs e) { if (Connected != null) { Connected(this, e); } }