Exemplo n.º 1
0
        private void ButtonAddBoard_Click(object sender, EventArgs e)
        {
            Card card = new Card();

            card.Deleted          += Card_Deleted;
            card.NameCard          = "Card (" + (listCard.Count + 1) + ")";
            card.CardNameTB.Text   = card.NameCard;
            card.SecondFormShowed += Card_SecondFormShowed;
            card.SecondFormClosed += Card_SecondFormClosed;
            listCard.Add(card);
            if (IsObserve == true)
            {
                card.BackColor = Color.Yellow;
            }
            CardListPanel.Controls.Remove(ButtonAddCard);
            CardListPanel.Controls.Add(card);
            CardListPanel.Controls.Add(ButtonAddCard);

            Data.CardProp cardProp = new Data.CardProp();
            cardProp.Card_Name        = card.NameCard;
            cardProp.Card_Description = "";
            cardProp.Card_Observing   = listProp.List_Observing;
            cardProp.Card_Position    = listCard.Count - 1;
            cardProp.List_ID          = listProp.List_ID;
            Data.DataService.InsertCard(cardProp);
            cardProps     = Data.DataService.GetCardByListID(listProp.List_ID);
            card.cardProp = cardProps[cardProps.Count - 1];
            card.CheckContent();
        }
Exemplo n.º 2
0
 public void LoadData(Data.CardProp _cardProp)
 {
     cardProp        = new Data.CardProp();
     cardProp        = _cardProp;
     NameCard        = cardProp.Card_Name;
     CardNameTB.Text = NameCard;
     CheckContent();
 }
Exemplo n.º 3
0
        private void CardListPanel_DragDrop(object sender, DragEventArgs e)
        {
            Card  element = e.Data.GetData("Object") as Card;
            Point p       = CardListPanel.PointToClient(new Point(e.X, e.Y));
            Card  item    = CardListPanel.GetChildAtPoint(p) as Card;

            if (element == null)
            {
                return;
            }
            if (element == item)
            {
                return;
            }
            if (element.Parent as FlowLayoutPanel == CardListPanel)
            {
                if (item == null)
                {
                    item = listCard[listCard.Count - 1];
                }
                int indexi = CardListPanel.Controls.GetChildIndex(item, false);
                int indexe = CardListPanel.Controls.GetChildIndex(element, false);
                CardListPanel.Controls.SetChildIndex(element, indexi);
                CardListPanel.Controls.SetChildIndex(item, indexe);
                indexi = listCard.IndexOf(item);
                indexe = listCard.IndexOf(element);
                Card temp = listCard[indexi];
                listCard[indexi] = listCard[indexe];
                listCard[indexe] = temp;
                ResetCardPosition();
            }
            else
            {
                if (IsObserve == true)
                {
                    element.BackColor = Color.Yellow;
                }
                else
                {
                    element.BackColor = Color.White;
                }
                if (item == null)
                {
                    Data.CardProp _cardProp = new Data.CardProp();
                    _cardProp.Card_Name        = element.cardProp.Card_Name;
                    _cardProp.Card_Observing   = IsObserve;
                    _cardProp.Card_Description = element.cardProp.Card_Description;
                    _cardProp.List_ID          = listProp.List_ID;
                    _cardProp.Card_ID          = element.cardProp.Card_ID;



                    ((element.Parent as FlowLayoutPanel).Parent as Lists).listCard.Remove(element);
                    listCard.Add(element);
                    CardListPanel.Controls.Clear();
                    for (int i = 0; i < listCard.Count; i++)
                    {
                        CardListPanel.Controls.Add(listCard[i]);
                        listCard[i].Deleted += Card_Deleted;
                    }
                    CardListPanel.Controls.Add(ButtonAddCard);
                    _cardProp.Card_Position = CardListPanel.Controls.GetChildIndex(listCard[listCard.Count - 1]);

                    Data.DataService.UpdateCard(_cardProp);
                }
                else
                {
                    listCard.Add(element);
                    element.Deleted += Card_Deleted;
                    ((element.Parent as FlowLayoutPanel).Parent as Lists).listCard.Remove(element);
                    List <Card> temp = new List <Card>();
                    for (int i = 0; i < listCard.Count; i++)
                    {
                        if (i < listCard.IndexOf(item))
                        {
                            temp.Add(listCard[i]);
                        }
                        else if (i > listCard.IndexOf(item))
                        {
                            temp.Add(listCard[i - 1]);
                        }
                        else
                        {
                            temp.Add(element);
                        }
                    }
                    listCard.Clear();
                    listCard = temp;
                    CardListPanel.Controls.Remove(ButtonAddCard);
                    CardListPanel.Controls.Clear();
                    for (int i = 0; i < listCard.Count; i++)
                    {
                        CardListPanel.Controls.Add(listCard[i]);
                    }
                    CardListPanel.Controls.Add(ButtonAddCard);
                }
            }
        }