Example #1
0
        void Submit(object sender, RoutedEventArgs e)
        {
            if (CheckForUserNameValitity())
            {
                string SaveFileLocation = @"SaveFile.txt";//Location where the save file is stored

                List <string> NewUserCreation = new List <string>();
                NewUserCreation.Add("#" + UsernameField.Text);
                NewUserCreation.Add(Controller.CurrentUser.EncryptPW(FirstPWField.Password));
                NewUserCreation.Add("@" + FirstNameField.Text + "," + LastNameField.Text);
                NewUserCreation.Add("$" + DateTime.Now.ToString());
                NewUserCreation.Add("&" + Controller.CurrentUser.ProfileImage);
                NewUserCreation.Add("^" + Theme);
                NewUserCreation.Add("%" + EmailField.Text);

                NewUserCreation.Add("[end]");

                if (FirstPWField.Password.Length > 8 && FirstPWField.Password == SecondPWField.Password)
                {
                    if (!IsAlreadyName)
                    {
                        if (FirstNameField.Text.Length > 0 && LastNameField.Text.Length > 0)
                        {
                            if (EmailCheck(EmailField.Text))
                            {
                                System.IO.File.AppendAllLines(SaveFileLocation, NewUserCreation);
                                this.Close();
                                return;
                            }
                        }
                    }
                }

                Controller.CurrentUser.errorMessage = "Account could not be created. Please edit current proccess and try again.";
                Window Errrrrrrr = new ErrorWindow();
                Errrrrrrr.ShowDialog();
            }
        }