Ejemplo n.º 1
0
        private void EventListener(Object sender, EventArgs e)
        {
            if (sender == this.signUpButton)
            {
                if (this.AllSignupConstraintsOk())
                {
                    VisualizingTools.ShowWaitingAnimation(new Point(this.signUpButton.Left, this.signUpButton.Bottom + 20), new Size(this.signUpButton.Width, this.signUpButton.Height / 2), this);
                    childThreadDB = new System.Threading.Thread(delegate()
                    {
                        JObject signupData        = new JObject();
                        signupData["type"]        = "consumer";
                        signupData["username"]    = this.usernameBox.Text;
                        signupData["email"]       = this.emailBox.Text;
                        signupData["name"]        = Universal.NameValidator(this.nameBox.Text);
                        signupData["mac_address"] = Universal.SystemMACAddress;

                        long?userId = ServerRequest.SignupUser(signupData);

                        if (this.InvokeRequired)
                        {
                            this.Invoke(new Action(() =>
                            {
                                if (userId != null)
                                {
                                    Universal.ParentForm.Controls.Remove(this);
                                    this.Dispose();
                                    VisualizingTools.HideWaitingAnimation();
                                }
                                else
                                {
                                    this.signUpButtonMessage.Text = "Error in connection!";
                                    VisualizingTools.HideWaitingAnimation();
                                }
                            }));
                        }
                        if (userId != null)
                        {
                            BackendManager.LoginProcessRun();
                        }
                    });
                    childThreadDB.Start();
                }
            }
            else if (sender == this.policiesLinkLabel)
            {
                this.policiesLinkLabel.ForeColor = Color.FromArgb(106, 0, 154);
            }
        }