private async void SendJoinMessage(int roomId, String password) { JoinRoomMessage jrm = new JoinRoomMessage() { Password = password, RoomId = roomId }; Global.Status = BusyMessageEnum.JoiningRoom; var answer = await Global.NetworkClient.SendMessage(jrm); if (!answer.Result) Error = answer.Message; OnPropertyChanged("Error"); OnPropertyChanged("HasError"); Global.Status = BusyMessageEnum.ExitingRoom; }
public override BaseMessage GetInnerMessage() { switch (Type) { case AbonentsCommandType.Authorization: { AuthorizationMessage msg = new AuthorizationMessage(); msg.UTFDeSerialize(this.Message); return msg; } case AbonentsCommandType.UnAuthorization: { return new UnAuthorizationMessage() { MsgId = this.MsgId }; } case AbonentsCommandType.Exit: { return new ExitMessage() { MsgId = this.MsgId }; } case AbonentsCommandType.ExitRoom: { return new ExitRoomMessage() { MsgId = this.MsgId }; } case AbonentsCommandType.JoinRoom: { JoinRoomMessage msg = new JoinRoomMessage(); msg.UTFDeSerialize(this.Message); return msg; } case AbonentsCommandType.CreateRoom: { CreateRoomMessage msg = new CreateRoomMessage(); try { msg.UTFDeSerialize(this.Message); return msg; } catch(Exception ex) { } return msg; } case AbonentsCommandType.RequestRoomInfo: { return new RequestRoomInfoMessage() { MsgId = this.MsgId }; } case AbonentsCommandType.StartRoom: { return new StartRoomMessage() { MsgId = this.MsgId }; } case AbonentsCommandType.KickUser: { DataContractSerializer serializer = new DataContractSerializer(typeof(KickUserMessage)); using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(Message))) { KickUserMessage msg = (KickUserMessage)serializer.ReadObject(stream); return msg; } } } return null; }