Example #1
0
        private void ContinueButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(nameInput.Text) && !string.IsNullOrWhiteSpace(surnameInput.Text) && !string.IsNullOrWhiteSpace(emailInput.Text) && Verifier.IsValidEmail(emailInput.Text))
            {
                AutomaticFormPosition.SaveFormStatus(this);

                User = new User {
                    Name = nameInput.Text, Surname = surnameInput.Text, Email = emailInput.Text
                };
                Register?.Invoke(this, new UserRelatedEventArgs {
                    PendingUser = User
                });
                Hide();
            }
            else
            {
                if (string.IsNullOrWhiteSpace(nameInput.Text))
                {
                    nameLabel.Text = StringConstants.nameRequirement;
                }
                if (string.IsNullOrWhiteSpace(surnameInput.Text))
                {
                    surnameLabel.Text = StringConstants.surnameRequirement;
                }
                if (string.IsNullOrWhiteSpace(emailInput.Text) || !Verifier.IsValidEmail(emailInput.Text))
                {
                    emailLabel.Text = StringConstants.emailRequirement;
                }
            }
        }
Example #2
0
 private void OnExistingUserRecognised(object sender, FaceRecognisedEventArgs e)
 {
     AutomaticFormPosition.SaveFormStatus(this);
     LoggedIn?.Invoke(this, new UserRelatedEventArgs {
         UserID = e.Label
     });
     //BeginInvoke(new Action(() => Close()));
     Invoke(new Action(() => Close()));
 }
Example #3
0
        private void UI_Load(object sender, EventArgs e)
        {
            //loading UI form window parameters
            AutomaticFormPosition.loadUIFormDelegate(this);

            // On load show homepage user control
            containerPanel.Controls.Add(Homepage.Instance);
            Search.Instance.Dock = DockStyle.Fill;
            Search.Instance.BringToFront();

            // Remove outline on all buttons
            foreach (Control button in this.Controls)
            {
                if (button is Button)
                {
                    ChangeCursor((Button)button);
                }
            }
        }
Example #4
0
        private void OnSaveBook(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(titleBox.Text) && !string.IsNullOrWhiteSpace(isbnBox.Text) &&
                !string.IsNullOrWhiteSpace(publisherBox.Text) && !string.IsNullOrWhiteSpace(authorListBox.Text) &&
                !string.IsNullOrWhiteSpace(genreBox.Text) && !string.IsNullOrWhiteSpace(qtyBox.Text))
            {
                BookGenre  genres  = new BookGenre();
                List <int> authors = new List <int>();
                int.TryParse(qtyBox.Text, out int qty);

                foreach (var genre in genreBox.CheckedItems)
                {
                    genres = genres | (BookGenre)Enum.Parse(typeof(BookGenre), genre.ToString());
                }

                foreach (Author author in authorListBox.SelectedItems)
                {
                    authors.Add(author.ID);
                }

                for (int i = 0; i < qty; i++)
                {
                    Book = new Book(title: titleBox.Text, isbn: isbnBox.Text, authorID: authors,
                                    publisher: publisherBox.Text, genre: genres, description: descriptionBox.Text);

                    NewBook?.Invoke(this, new BookRelatedEventArgs {
                        Book = Book
                    });
                }
                MessageBox.Show(StringConstants.BookRegistered(titleBox.Text, isbnBox.Text));
                RefreshAndClear();
            }
            else
            {
                MessageBox.Show(StringConstants.missingInfo);
            }
            AutomaticFormPosition.SaveFormStatus(this);
        }
Example #5
0
 private void UI_FormClosing(object sender, FormClosingEventArgs e)
 {
     AutomaticFormPosition.SaveFormStatus(this);
     Speaker.TellUser(StringConstants.aiGoodbye);
     this.Controls.Clear();
 }
Example #6
0
 private void LogoutButton_Click(object sender, EventArgs e)
 {
     AutomaticFormPosition.SaveFormStatus(this);
     Close();
 }
Example #7
0
 private void ExistingUserForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     AutomaticFormPosition.SaveFormStatus(this);
 }
Example #8
0
 private void ExistingUserForm_Load(object sender, EventArgs e)
 {
     AutomaticFormPosition.loadingFormDelegate(this);
 }
Example #9
0
 //TEMP
 private void adminButton_Click(object sender, EventArgs e)
 {
     AutomaticFormPosition.SaveFormStatus(this);
     Administrate?.Invoke(this, e);
     Hide();
 }
Example #10
0
 private void FirstPage_Load(object sender, EventArgs e)
 {
     AutomaticFormPosition.loadStartingFormDelegate(this);
 }
Example #11
0
 private void FirstPage_FormClosing(object sender, FormClosingEventArgs e)
 {
     AutomaticFormPosition.SaveFormStatus(this);
     Application.Exit();
 }
Example #12
0
 private void AdminForm_Load(object sender, EventArgs e)
 {
     AutomaticFormPosition.LoadAutoPosition(this);
     authorListBox.ClearSelected();
     genreBox.ClearSelected();
 }
Example #13
0
 private void ShowFirstPage(object sender, EventArgs e)
 {
     AutomaticFormPosition.loadingFormDelegate(FirstPage);
     FirstPage.Show();
 }