private void SendLoginRequest() { LoginResponse response = UserServiceProxy.Login(new LoginRequest { UserName = this.UserName, Password = this.Password }); ConsoleLog.Document += $" { response.IsSuccess } {response.Message} \n "; if (response.IsSuccess == true) { //save loged user authentication AuthenticatedUser.Authentication = response.Authentication; AuthenticatedUser.UserName = this.UserName; //update contactList ContactStateManager.AssignAllCurrentOnlineContacts(response.AllOtherUsers); //joining the chat service: JoinChatServiceResponse responseFromChatService = ChatServiceProxy.JoinService(new JoinChatServiceRequest()); ConsoleLog.Document += responseFromChatService.Message; //joining the Game Service: JoinGameServiceResponse responseFromGameService = GameServiceProxy.JoinService(new JoinGameServiceRequest()); ConsoleLog.Document += responseFromGameService.Message; UserServiceProxy.OnLoginEvent += UserServiceProxy_OnLoginEvent; ViewChanging("ContactListView"); //set online users to something : new class that will save online users } }
public JoinChatServiceResponse JoinService(JoinChatServiceRequest joinServiceRequest) { using (new OperationContextScope((IClientChannel)proxy)) { AuthenticatedUser currentLogedUser = AuthenticatedUser.Instance; WebOperationContext.Current.OutgoingRequest.Headers.Add("Authentication", currentLogedUser.Authentication.ToString()); JoinChatServiceResponse response = proxy.JoinService(joinServiceRequest); return(response); } }