public void CloseForm() { SignUpEvent.Invoke(this, new SignUpEventArgs() { CloseSignUpProcess = true }); }
private void MessageSorter(byte[] buffer, int start, int length, Socket clientSocket) { string content = Encoding.Default.GetString(buffer, 0, length); MessageDictionary messageD = new MessageDictionary(content); ShowMessage("从" + clientSocket.RemoteEndPoint.ToString() + "接收消息:" + content + "\n"); CommandType command = (CommandType)Enum.Parse(typeof(CommandType), messageD[MesKeyStr.CommandType]); switch (command) { case CommandType.Login: { LoginEvent?.Invoke(this, new LoginEventArgs() { UserID = messageD[MesKeyStr.UserID], PassWord = messageD[MesKeyStr.PassWord], ReceiveSocket = clientSocket }); break; } case CommandType.Logout: { LogoutEvent?.Invoke(this, new User(messageD[MesKeyStr.UserID], messageD[MesKeyStr.NickName])); break; } case CommandType.SignUp: { SignUpEvent?.Invoke(this, new SignUpEventArgs(clientSocket, messageD[MesKeyStr.NickName], messageD[MesKeyStr.PassWord])); break; } case CommandType.GroupMessage: { GroupMessageEvent?.Invoke(this, messageD); break; } case CommandType.PrivateMessage: { PrivateMessageEvent?.Invoke(this, messageD); break; } case CommandType.UserJoin: case CommandType.UserQuit: case CommandType.LoginResult: case CommandType.SignUpResult: case CommandType.ServerDisconnect: case CommandType.Remove: { ShowMessage("收到错误的消息类型!"); throw new Exception("收到错误的消息类型!"); } } }
public void LogSignUp(string signUpMethod, bool signUpSucceeded, Dictionary <string, object> customAttributes = null) { var answersEvent = new SignUpEvent(); answersEvent.PutMethod(signUpMethod); answersEvent.PutSuccess(signUpSucceeded); answersEvent.PutCustomAttributes(customAttributes); Bindings.AnswersKit.Answers.Instance.LogSignUp(answersEvent); }
/// <summary> /// This method is in charge of retrieving the data entered by the user in the Sign Up dialog fragment. /// </summary> /// <param name="sender"> Reference to the object that raised the event </param> /// <param name="e"> Contains the event data </param> private void SignUpResult(object sender, SignUpEvent e) { string toastText; switch (e.Message) { case "2": toastText = "Please fill in all of the information"; break; case "1": toastText = "The email entered is already taken"; break; default: { toastText = "You have successfully signed up to the platform"; var newUserName = e.UserName; var newUserLastName = e.UserLastName; var newUserAge = e.UserAge; var newUserEmail = e.UserEmail; var newUserPassword = e.UserPassword; var user = new User(int.Parse(newUserAge), newUserEmail, newUserName, newUserLastName, newUserPassword); var jsonResult = JsonConvert.SerializeObject(user); using var webClient = new WebClient { BaseAddress = "http://" + Ipv4 + ":8080/CookTime_war/cookAPI/" }; const string url = "resources/createUser"; webClient.Headers[HttpRequestHeader.ContentType] = "application/json"; webClient.UploadString(url, jsonResult); break; } } _toast = Toast.MakeText(this, toastText, ToastLength.Short); _toast.Show(); }
public async Task Handle(SignUpEvent message, CancellationToken cancellationToken) { await Task.Run(() => { }); }
/// <summary> /// Initializes a new instance of the <see cref="SignUpForm"/> class. /// </summary> /// <param name="callback">The callback.</param> public SignUpForm(SignUpEvent callback) { this.callback = callback; InitializeComponent(); }
public async Task Handle(SignUpEvent message, CancellationToken cancellationToken) { }