public override void OnOperationResponse(OperationResponse operationResponse) { //string resString = (string)DictTool.GetValue<byte, object>(operationResponse.Parameters, (byte)ParameterCode.UserNameList); //Debug.Log("resString = " + resString); //using (StringReader reader = new StringReader(resString)) //{ // XmlSerializer serializer = new XmlSerializer(typeof(List<string>)); // List<string> userNameList = (List<string>)serializer.Deserialize(reader); // for (int i = 0; i < userNameList.Count; i++) // { // Debug.Log("userName ="******"userName =" + userNameList.NameList[i]); } player.OnSyncPlayResponse(userNameList); }
private async void CreateSpeaker() { await FillUserList(); NewSpeaker = new Speaker(Username, Password, FullName, Description, Image.Name); if (!ImageCatalog.ImageCatalog.Dictionary.Keys.Contains(Image.Name)) { await ImageCatalog.ImageCatalog.AddImage(Image, Image.Name); if (!UserNameList.Contains(NewSpeaker.UserName)) { speakerHandler.CreateSpeaker(NewSpeaker); } else { await MessageDialogUtil.MessageDialogAsync("Username Already taken", "brugernavnet du har angivet er allerede i brug \nbenyt venligst et andet brugernavn"); } } else { await MessageDialogUtil.MessageDialogAsync("Billede eksisterer allerede", "navnet af det valgte billede eksistere allerede i systemet vælg venligst et andet billede eller ændre navnet på din billedfil"); } }
private void storeUser(ref byte[] bytes) { //TODO save encrypt user data use tempBytes UserSerives.StoreUserData.encryptUserData(UserName, bytes, SiteName); bytes = null; UserNameList.Add(UserName); }
public void OnSyncPlayResponse(UserNameList userNameList) { Debug.Log("Start Instantiate Other Player"); foreach (var username in userNameList.NameList) { OnNewPlayerEvent(username); } }
public override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters, ClientPeer peer) { //取得所有已经登录的用户 List <string> userNameList = new List <string>(); foreach (var tempPeer in MyGameServer.Instance.peerList) { if (!string.IsNullOrEmpty(tempPeer.userName) && tempPeer != peer) { userNameList.Add(tempPeer.userName); } } //StringWriter sw = new StringWriter(); //XmlSerializer serializer = new XmlSerializer(typeof(List<string>)); //serializer.Serialize(sw,userNameList); //sw.Close(); //string userNameListString = sw.ToString(); UserNameList userNameListString = new UserNameList(); userNameListString.NameList.AddRange(userNameList); Dictionary <byte, object> data = DictTool.GetDtoDataByProto(userNameListString, ParameterCode.UserNameList); OperationResponse response = new OperationResponse(operationRequest.OperationCode); response.Parameters = data; peer.SendOperationResponse(response, sendParameters); NewPlayer newPlayer = new NewPlayer(); newPlayer.UserName = peer.userName; EventData eventData = new EventData((byte)EventCode.NewPlayer); Dictionary <byte, object> data2 = DictTool.GetDtoDataByProto(newPlayer, ParameterCode.UserName); eventData.Parameters = data2; foreach (var tempPeer in MyGameServer.Instance.peerList) { if (!string.IsNullOrEmpty(tempPeer.userName) && tempPeer != peer) { tempPeer.SendEvent(eventData, sendParameters); } } }
private async void CreateAdmin() { if (Regex.Matches(_phoneNumber, @"[a-zA-Z]").Count > 0) { await MessageDialogUtil.MessageDialogAsync("Bogstav i dit telefon nummer", "Der er et eller flere bogstaver i dit telefon nummer\nprøv venligst igen kun med tal"); } else { await FillUserList(); NewAdmin = new Admin(Username, Password, PhoneNumber); if (!UserNameList.Contains(NewAdmin.UserName)) { adminHandler.CreateAdmin(NewAdmin); } else { await MessageDialogUtil.MessageDialogAsync("Username Already taken", "brugernavnet du har angivet er allerede i brug \nbenyt venligst et andet brugernavn"); } } }
private async void CreateParticipant() { if (PersonType == Participant.PersonType.Vælg_type) { await MessageDialogUtil.MessageDialogAsync("Ingen PersonType", "Der er ikke valgt en PersonType\nVælg venligst persontype"); } else { await FillUserList(); NewParticipant = new Participant(Username, Password, PersonType); if (!UserNameList.Contains(NewParticipant.UserName)) { participantHandler.CreateParticipant(NewParticipant); } else { await MessageDialogUtil.MessageDialogAsync("Username Already taken", "brugernavnet du har angivet er allerede i brug \nbenyt venligst et andet brugernavn"); } } }
/// <summary> /// Handles find users button click event. /// </summary> protected void FindUsers_Click(object sender, EventArgs e) { // try to find users by user name using (DataTable dt = DB.user_find(PageContext.PageBoardID, true, UserName.Text, null)) { if (dt.Rows.Count > 0) { // we found a user(s) UserNameList.DataSource = dt; UserNameList.DataValueField = "UserID"; UserNameList.DataTextField = "Name"; UserNameList.DataBind(); // hide To text box and show To drop down UserNameList.Visible = true; UserName.Visible = false; // find is no more needed FindUsers.Visible = false; // we need clear button displayed now Clear.Visible = true; } } }