Beispiel #1
0
        private async void submitBtn_Click(object sender, RoutedEventArgs e)
        {
            string tempKeywords = "";

            Keywords.Document.GetText(TextGetOptions.AllowFinalEop, out tempKeywords);
            ViewModel.BlockEntry.Keywords = tempKeywords;
            AddRecordClick?.Invoke(sender, null);
        }
Beispiel #2
0
        private async void submitBtn_Click(object sender, RoutedEventArgs e)
        {
            Windows.UI.Color red     = Windows.UI.Color.FromArgb(255, 255, 0, 0);
            bool             isValid = true;

            if (String.IsNullOrEmpty(usernameTb.Text))
            {
                isValid          = false;
                ShowErrorMessage = true;
                ErrorMessage     = "Username is required";
                // usernameTb.BorderBrush = new SolidColorBrush(red);
            }
            else if (String.IsNullOrEmpty(nicknameTb.Text))
            {
                isValid          = false;
                ShowErrorMessage = true;
                ErrorMessage     = "Nickname is required";
                // nicknameTb.BorderBrush = new SolidColorBrush(red);
            }
            else if (null != userList)
            {
                if (userList.Select(x => x.Username).Contains(Userinfo.Username))
                {
                    isValid          = false;
                    ShowErrorMessage = true;
                    ErrorMessage     = "Username is Uniqued";
                }
                else if (userList.Select(x => x.Nickname).Contains(Userinfo.Nickname))
                {
                    isValid          = false;
                    ShowErrorMessage = true;
                    ErrorMessage     = "Nickname is Uniqued";
                }
            }
            else if (String.IsNullOrEmpty(passwordpb.Password))
            {
                isValid          = false;
                ShowErrorMessage = true;
                ErrorMessage     = "Password is required";
                //passwordpb.BorderBrush = new SolidColorBrush(red);
            }
            else if (confirmpasswordpb.Password != passwordpb.Password)
            {
                isValid          = false;
                ShowErrorMessage = true;
                ErrorMessage     = "confirmPassword is incorrect";
                // confirmpasswordpb.BorderBrush =new SolidColorBrush(red);
            }
            else if (String.IsNullOrEmpty(STC_UserNameTB.Text))
            {
                isValid          = false;
                ShowErrorMessage = true;
                ErrorMessage     = "STC_Username is required";
                //passwordpb.BorderBrush = new SolidColorBrush(red);
            }
            else if (String.IsNullOrEmpty(STC_PasswordPB.Password))
            {
                isValid          = false;
                ShowErrorMessage = true;
                ErrorMessage     = "STC_Password is required";
                // confirmpasswordpb.BorderBrush =new SolidColorBrush(red);
            }
            else
            {
                var emailAddress = EmailTb.Text.Trim().ToLower();

                if (string.IsNullOrWhiteSpace(emailAddress))
                {
                    isValid          = false;
                    ShowErrorMessage = true;
                    ErrorMessage     = "EmailAddress is required";
                    //EmailTb.BorderBrush = new SolidColorBrush(red);
                }
                else if (!Regex.IsMatch(emailAddress, ConstStrings.EmailAddressRegex))
                {
                    isValid          = false;
                    ShowErrorMessage = true;
                    ErrorMessage     = "EmailAddress format is incorrect";
                }
            }
            if (isValid)
            {
                ShowErrorMessage = false;
                if (Userinfo.Role.Count == 0)
                {
                    Userinfo.Role.Add(RoleType.User);
                }
                AddRecordClick?.Invoke(sender, null);
            }
        }