Example #1
0
        /// <summary>
        /// delete Note function for delete button of cards.
        /// </summary>
        /// <param name="sender">
        /// the card's delete button.
        /// </param>
        private void Button_Delete_Click(object sender, RoutedEventArgs e)
        {
            Button   senderButton = (Button)sender;
            Grid     parentGrid   = (Grid)senderButton.Parent;
            NoteCard card         = (NoteCard)parentGrid.Parent;

            this.database.DeleteNote(card.noteID);
            this.Refresh();
        }
Example #2
0
        /// <summary>
        /// open card on mouse up.
        /// </summary>
        private void NoteCard_MouseUp(object sender, MouseButtonEventArgs e)
        {
            NoteCard card = (NoteCard)sender;

            if (card != null)
            {
                this.page_Note = card.GetEditePage(this, this.database);
                this.page_Note.Show();
                this.Hide();
            }
        }
Example #3
0
        /// <summary>
        /// clear board and fill it again( get data from database ).
        /// </summary>
        public void Refresh()
        {
            DataSet t = database.GetUserNotes(this.userID);

            wrapPanel_NoteCards.Children.Clear();
            foreach (DataRow pRow in t.Tables[0].Rows)
            {
                NoteCard noteCard = new NoteCard(Int32.Parse(pRow.ItemArray.GetValue(0).ToString()),
                                                 pRow.ItemArray.GetValue(2).ToString(),
                                                 pRow.ItemArray.GetValue(3).ToString());
                noteCard.Padding              = new Thickness(3);
                noteCard.Width                = 280;
                noteCard.Height               = 200;
                noteCard.MouseUp             += NoteCard_MouseUp;
                noteCard.button_Delete.Click += Button_Delete_Click;
                wrapPanel_NoteCards.Children.Add(noteCard);
            }
        }