/// <summary> /// Displays a ParentUser in a panel. /// </summary> private Panel LoadParent(Model.ParentUser parent, int yLocation) { //Creates a panel with User info var individualUserPanel = LoadUser(parent, yLocation); //Adds edit button individualUserPanel.Controls.Add(AddEditParentButton(365, individualUserPanel.Height / 2, parent)); return(individualUserPanel); }
/// <summary> /// Creates a button to edit ParentUser /// </summary> private Control AddEditParentButton(int locationX, int locationY, Model.ParentUser parentUser) { //Creates a standard button from library var editParentButton = TechnicalPlatform.UILibrary.StandardElements.AddImageButton(new Point(locationX, locationY - 15), parentUser, global::ChoreApplication.Properties.Resources.pencil); //Adds event handler editParentButton.Click += new EventHandler(EditParentButton_Click); return(editParentButton); }
/// <summary> /// Creates and displays elements in the designer. /// Fills in textboxes with existing information from DB /// </summary> public EditParentUI(Model.ParentUser parent) { InitializeComponent(); _parent = parent; firstNameTextBox.Text = parent.FirstName; lastNameTextBox.Text = parent.LastName; emailTextBox.Text = parent.Email; passwordTextBox.Text = parent.Password; pincodeTextBox.Text = parent.Pincode; welcomeLabel.Text = "Editing " + parent.FirstName; }
/// <summary> /// Creates and displays elements in the designer. /// Initializes helpers and sets UI to ChoresUI by default. /// </summary> public ParentMenu(Model.ParentUser currentUser) { //Creates session _session = currentUser; //Creates and displays elements in designer InitializeComponent(); //Initializes _statusValues dictionary InitializeStatusValues(); //Initializes _childrenNames dictionary LoadChildrenNames(); //Displays amount of notifications for _session LoadAmountOfNotifications(); //Loads ChoresUI ChoresUI(); }
/// <summary> /// Sends user to EditParentUI to edit chosen User /// </summary> private void EditParentButton_Click(object sender, System.EventArgs e) { //Disable ParentMenu this.Enabled = false; Button clickedButton = (Button)sender; try { //Sets selectedParent to ParentUser from clicked button's tag Model.ParentUser selectedParent = (Model.ParentUser)clickedButton.Tag; //Opens EditParentUI var editSelectedParentUI = new EditParentUI(selectedParent); editSelectedParentUI.Show(); //Enables ParentMenu on close editSelectedParentUI.FormClosing += UsersNavigationButton_Click; } catch { MessageBox.Show("Could not edit Parent: Parent not found", "Error"); } }