Esempio n. 1
0
        public KanbanColumn(KanbanBoard kanbanBoard, StatusData data)
        {
            Data = data;
            TaskModel.FillStatus(Data);
            this.kanbanBoard = kanbanBoard;

            HorizontalAlignment        = HorizontalAlignment.Stretch;
            HorizontalContentAlignment = HorizontalAlignment.Stretch;
            VerticalAlignment          = VerticalAlignment.Stretch;
            Margin          = new Thickness(5);
            Background      = Brushes.LightGray;
            BorderThickness = new Thickness(0);
            Focusable       = false;

            border = new Border
            {
                Margin          = new Thickness(5),
                Background      = Brushes.LightGray,
                BorderBrush     = Brushes.White,
                BorderThickness = new Thickness(3),
                CornerRadius    = new CornerRadius(10),
                Child           = this
            };
            if (!Data.IsBacklog)
            {
                PreviewDragEnter += (sender, e) => kanbanBoard.ItemPreviewShow(this);
                PreviewDragLeave += (sender, e) => { if (!IsCursorInside(e))
                                                     {
                                                         kanbanBoard.ItemPreviewRemove();
                                                     }
                };
                Drop     += (sender, e) => kanbanBoard.ItemDrop(sender, e);
                AllowDrop = true;
            }

            AddHeader();
        }
Esempio n. 2
0
        public KanbanTaskCard(KanbanBoard kanbanBoard, TaskData data)
        {
            Data             = data;
            this.kanbanBoard = kanbanBoard;

            Margin          = new Thickness(0);
            Padding         = new Thickness(3);
            BorderThickness = new Thickness(0);
            BorderBrush     = Brushes.SkyBlue;
            Selected       += (sender, e) => IsSelected = false;

            panel = new StackPanel
            {
                Orientation = Orientation.Vertical,
                MinHeight   = 20,
                MinWidth    = 240,
                Background  = Brushes.White
            };
            panel.MouseEnter           += (sender, e) => panel.Background = new SolidColorBrush(Color.FromArgb(255, 190, 230, 253));
            panel.MouseLeave           += (sender, e) => panel.Background = defaultBrush;
            panel.MouseRightButtonDown += (sender, e) => kanbanBoard.View.OpenCreateDialog(Data);

            if (Data.Status.IsBacklog)
            {
                Button button = new Button
                {
                    Content    = "Send to Board",
                    Margin     = new Thickness(5),
                    Padding    = new Thickness(5, 0, 5, 0),
                    Background = Brushes.LightSkyBlue
                };
                button.Click += (sender, e) =>
                {
                    KanbanColumn column = Parent as KanbanColumn;
                    column.Items.Remove(this);
                    column.UpdateHeader();

                    ProjectData project   = Data.Status.Project;
                    StatusData  newStatus = project.Statuses[0];

                    Data.Status.Tasks.Remove(Data);
                    newStatus.Tasks.Add(Data);
                    Data.Status = newStatus;

                    new TaskModel(Data).Save();
                };
                panel.Children.Add(data.GetBacklogGrid(button));
            }
            else
            {
                panel.Children.Add(data.GetNameGrid());
                panel.Children.Add(data.GetInfoGrid());
                panel.PreviewMouseLeftButtonDown += (sender, e) => ItemMouseDown(sender, e);
                PreviewDragOver += (sender, e) => kanbanBoard.ItemPreviewShow(sender, e);
                GiveFeedback    += (sender, e) => DragDropWindowUpdate();
                Drop            += (sender, e) => kanbanBoard.ItemDrop(sender, e);
                AllowDrop        = true;
            }
            panel.Children.Add(GetColorRectangle());
            Content = panel;
        }