Exemple #1
0
        /// <summary>
        /// Performs all the necessary checks to the data,
        /// validating the length of them, and sends a request to the server
        /// through the AsyncClientEvent class;
        /// </summary>

        private void materialRaisedButton1_Click(object sender, EventArgs e)
        {
            Guid   guid = Guid.NewGuid();
            string ID   = guid.ToString();

            userID       = ID;
            userNickname = InputNickname.Text;
            string userPassword = InputPassword.Text;



            if (!String.IsNullOrEmpty(userNickname) && !String.IsNullOrEmpty(userPassword))
            {
                if (userPassword.Length < 6)
                {
                    MessageBox.Show("The password must be at least 6 characters.");
                }
                else
                {
                    RegisterForm currentForm = this;

                    var asyncClientEvent = new AsyncClientEvent {
                    };

                    asyncClientEvent.StartClientWithRegisterForm(userNickname, userPassword, "Register", userID, currentForm);
                }
            }
            else
            {
                MessageBox.Show("Please fill in all the balnks");
            }
        }
 /**
  * This method is used to start the client in order to send a register request to the sever;
  * @param userName - username for registration
  * @param userPassword - password for registration
  * @param eventName - eventName, that will be equal to Register, for the server to recognise the response
  * @param userID - ID of the user
  * @param form2 - the Register form, where the function is called from, to call methods on it later
  */
 public void StartClientWithRegisterForm(String userName, String userPassword, String eventName, string userID, RegisterForm form2)
 {
     currentRegisterForm = form2;
     StartClient(userName, userPassword, eventName, userID);
 }