Beispiel #1
0
        public void UpdateHeader()
        {
            int cardCount = GetCardCount();

            header.Content = Data.Title.ToUpper() + " (" + cardCount + ")";
            if (Data.HasCardMinimum() && cardCount < Data.MinCards)
            {
                border.BorderBrush = Brushes.LightSkyBlue;
            }
            else if (Data.HasCardMaximum() && cardCount > Data.MaxCards)
            {
                border.BorderBrush = Brushes.LightSalmon;
            }
            else
            {
                border.BorderBrush = Brushes.White;
            }

            if (Data.IsBacklog)
            {
                foreach (object item in Items)
                {
                    if (item is KanbanTaskCard)
                    {
                        KanbanTaskCard taskCard    = item as KanbanTaskCard;
                        bool           alternating = Items.IndexOf(item) % 2 == 1;
                        taskCard.SetDefaultBrush(alternating ? Brushes.White : new SolidColorBrush(Color.FromArgb(255, 245, 245, 245)));
                    }
                }
            }
        }
Beispiel #2
0
        public void AddRow(TaskData task, int index)
        {
            task.Status = Data;
            KanbanTaskCard item = new KanbanTaskCard(kanbanBoard, task);

            Items.Insert(index, item);
            UpdateHeader();
        }
        public void ItemPreviewShow(object sender, DragEventArgs e)
        {
            KanbanTaskCard target       = sender as KanbanTaskCard;
            Point          dropPosition = e.GetPosition(sender as IInputElement);
            bool           showBelow    = target.ActualHeight / 2 < dropPosition.Y;

            Label        itemPreviewShadow = GetItemPreviewShadow();
            KanbanColumn newColumn         = target.Parent as KanbanColumn;
            int          targetIndex       = newColumn.Items.IndexOf(target);

            newColumn.Items.Insert(showBelow ? targetIndex + 1 : targetIndex, itemPreviewShadow);
            this.DragDropPreviewShadow = itemPreviewShadow;
        }
Beispiel #4
0
        public void SaveData()
        {
            Data.Tasks.Clear();
            for (int index = 1; index <= GetCardCount(); index++)
            {
                KanbanTaskCard item = (KanbanTaskCard)Items.GetItemAt(index);
                item.Data.Status = Data;
                Data.Tasks.Add(item.Data);

                new TaskModel(item.Data)
                {
                    SortOrder = Data.Tasks.IndexOf(item.Data)
                }.Save();
            }
        }
        public void MoveTaskCard(KanbanColumn column, KanbanTaskCard item, int index)
        {
            KanbanColumn oldColumn = item.Parent as KanbanColumn;

            if (column.Equals(oldColumn) && column.Items.IndexOf(item) < index)
            {
                index--;
            }

            oldColumn.Items.Remove(item);
            column.AddRow(item.Data, index);
            item = null;

            oldColumn.UpdateHeader();
            column.UpdateHeader();

            oldColumn.SaveData();
            column.SaveData();
        }