Ejemplo n.º 1
0
        //fires whenever the Add Term button is clicked - LS

        /*
         * Author: LS, LM
         * Notes: Levi wrote the original version of this method, Lucas later updated it to work with the addition of the card search functionality
         * Creates a new EditCardPanel populated with an empty card and adds it to the list
         * Makes the card list visible if it was hidden and empty, resets the search textbox if the list was already visible in case the user was actively searching for a card when they decided to create a new one
         */
        private void addTermButton_Click(object sender, EventArgs e)
        {
            //Disabling and later reenabling the searchbox to get it to give up focus, otherwise it causes some odd conflicts with button click functionality
            SearchBox.Enabled = false;
            EditCardPanel newPanel = new EditCardPanel(new Card(), this);

            termFlowLayoutPanel.Controls.Add(newPanel);
            cards.Add(newPanel);
            //Show the TableLayout if it was hidden due to being empty, otherwise resets the search bar
            if (tableLayoutPanel1.Visible == false)
            {
                tableLayoutPanel1.Visible = true;
            }
            else
            {
                this.ResetSearch();
            }
            SearchBox.Enabled = true;
        }
Ejemplo n.º 2
0
        /*
         * Author: LS, LM
         * Notes: Levi wrote the majority of this, Lucas added the lines regarding adding to the cards list and controlling the visibility of the table layout
         * Get the details and cards from the selected deck and create all the needed EditCardPanels
         * If there are any cards to show, then make the containing TableLayout visible
         */
        public void SetDeckToEdit(int DeckId)
        {
            DeckReference = DeckManager.GetDeckFromId(DeckId);
            termFlowLayoutPanel.Controls.Clear();
            if (DeckReference != null)
            {
                deckTitleTextbox.Text = DeckReference.Title;
                foreach (Card c in DeckReference.Cards)
                {
                    EditCardPanel newPanel = new EditCardPanel(c, this);
                    termFlowLayoutPanel.Controls.Add(newPanel);
                    cards.Add(newPanel);
                }

                if (DeckReference.Cards.Count > 0)
                {
                    tableLayoutPanel1.Visible = true;
                }
            }
        }