예제 #1
0
        private void CreateButton_Click(object sender, RoutedEventArgs e)
        {
            // Check if necessary fields are not empty
            if (FirstNameInput.Text != string.Empty && EmailInput.Text != string.Empty && PasswordInput.Text != string.Empty && PasswordInput.Text.Equals(ConfirmPasswordInput.Text))
            {
                // All necessary inputs are entered

                // Check if user doesn't already exist
                if (!dbConnect.UserExists(EmailInput.Text))
                {
                    // Insert user information into user data
                    newUserID = dbConnect.CreateUser(FirstNameInput.Text, LastNameInput.Text, EmailInput.Text, PasswordInput.Text, StateInput.Text, CityInput.Text, BioInput.Text);

                    // Save default icon image to Profile Images (size 125x125)
                    GlobalMethodResource.SaveAvatar(GlobalMethodResource.ProjectDirectory + @"\Placeholder Images\profile.png", newUserID);

                    // Add to default topic for demonstration
                    dbConnect.AddTopic(newUserID, 4);

                    this.DialogResult = true; // Set result of window to true
                    this.Close();
                }

                // User already exists
                else
                {
                    MessageBox.Show("Email provided is already used. Please try again", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("One of the required fields is empty", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #2
0
 private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
 {
     GlobalMethodResource.HorizontalScrollEvent(sender, e);
 }