public GameSession(Connection <GameSession> client, int version, int timeout) { this.m_client = client; //Asynchronous send this.Type = (int)PlayerType.Undefined; this.State = PlayerState.None; this.ClientVersion = version; if (timeout <= 0) { timeout = 15; } MyTimer CheckTimer = new MyTimer(1000, timeout); CheckTimer.AutoReset = true; CheckTimer.Elapsed += delegate { if (!string.IsNullOrEmpty(Name)) { CheckTimer.Stop(); CheckTimer.Close(); } if (CheckTimer.CheckStop()) { //Timeout is automatically disconnected CloseAsync(); CheckTimer.Close(); } }; }
public GameSession(Connection<GameSession> client, int version, int timeout) { this.m_client = client; //异步发送 this.Type = (int)PlayerType.Undefined; this.State = PlayerState.None; this.ClientVersion = version; if (timeout <= 0) { timeout = 15; } MyTimer CheckTimer = new MyTimer(1000, timeout); CheckTimer.AutoReset = true; CheckTimer.Elapsed += delegate { if (!string.IsNullOrEmpty(Name)) { CheckTimer.Stop(); CheckTimer.Close(); } if (CheckTimer.CheckStop()) { //超时自动断开 CloseAsync(); CheckTimer.Close(); } }; }
public Session(Connection <Session> client, RoomServer server, int timeout = 15) { this.Client = client; this.Client.Tag = this; this.Server = server; MyTimer CheckTimer = new MyTimer(1000, timeout); CheckTimer.AutoReset = true; CheckTimer.Elapsed += delegate { if (!string.IsNullOrEmpty(Name)) { CheckTimer.Stop(); CheckTimer.Close(); } if (CheckTimer.CheckStop()) { //超时自动断开 Close(); CheckTimer.Close(); } }; }
public void ActualizaClienteSignal(object sender, System.Timers.ElapsedEventArgs e) { var objcomun = new comun(); using (var db = new bdloginEntities()) { MyTimer timer = (MyTimer)sender; int idlocal = timer.idlocal; string urlDownload = timer.urlDownload; var parametro = db.bingoParametro.Where(p => p.idLocal == idlocal).SingleOrDefault(); if (parametro.apagarCliente) { timer.Stop(); timer.Close(); timer.Dispose(); } if (parametro != null) { //if (objcomun.ActualizaCliente(idlocal)) //{ if ((!parametro.videoActivo) && (parametro.visualizar == "video")) { var salida = objcomun.ClientDownload(1, urlDownload); var context = GlobalHost.ConnectionManager.GetHubContext <signal>(); context.Clients.All.broadcastMessage(salida + DateTime.Now); } if (parametro.visualizar == "bingo") { var salida = objcomun.ClientDownload(1, urlDownload); var context = GlobalHost.ConnectionManager.GetHubContext <signal>(); context.Clients.All.broadcastMessage(salida + DateTime.Now); } //} } } }
public Session(Connection<Session> client, RoomServer server, int timeout = 15) { this.Client = client; this.Client.Tag = this; this.Server = server; MyTimer CheckTimer = new MyTimer(1000, timeout); CheckTimer.AutoReset = true; CheckTimer.Elapsed += delegate { if (!string.IsNullOrEmpty(Name)) { CheckTimer.Stop(); CheckTimer.Close(); } if (CheckTimer.CheckStop()) { //超时自动断开 Close(); CheckTimer.Close(); } }; }