private void SelectDeskResponse(Protocol.SelectDeskResponse e) { if (e.Success) { ViewModel.Desk desk = mDesks.FirstOrDefault(o => o.ID == e.Desk); if (e.Seat == 1) { desk.S1.Use = true; } else if (e.Seat == 2) { desk.S2.Use = true; } else if (e.Seat == 3) { desk.S3.Use = true; } else if (e.Seat == 4) { desk.S4.Use = true; } else { } } else { MessageBox.Show(e.Message); } }
protected override void OnExecute(Protocol.SelectDesk message, EC.ISession session, Interfaces.IUserAgent agent, Interfaces.ISiqiServer server) { Interfaces.IRoom room = server.GetRoom(message.Room); if (room != null) { room.AddMessage(message, agent); } else { Protocol.SelectDeskResponse response = new Protocol.SelectDeskResponse(); response.Success = false; response.Message = "所在房间不存在!"; server.Send(response, session); } }
private void SelectDesk(Protocol.SelectDesk e, IUserAgent agent, ISiqiServer server) { IDesk desk = Desks.FirstOrDefault(o => o.ID == e.Desk); Protocol.SelectDeskResponse response = new Protocol.SelectDeskResponse(); response.Success = true; response.Seat = e.Seat; response.Desk = e.Desk; if (desk != null) { response.Message = desk.In(agent, e.Seat); response.Success = string.IsNullOrEmpty(response.Message); } else { response.Success = false; response.Message = "桌子编号错误!"; } server.Send(response, agent); }