Exemplo n.º 1
0
        /// <summary>
        /// Creates a new board with BoardName and BoardNotes. Adds
        /// it to the database and collection
        /// </summary>
        public void CreateBoard()
        {
            BoardViewModel newBoard = new BoardViewModel
            {
                BoardName  = BoardName,
                BoardNotes = BoardNotes
            };

            // Add board to db and collection
            int newBoardId = DataProvider.AddBoard(BoardName, BoardNotes);

            newBoard.BoardId = newBoardId.ToString();
            newBoard.Tasks   = new ObservableCollection <CustomKanbanModel>();
            BoardList.Add(newBoard);
        }
Exemplo n.º 2
0
        public MainViewModel()
        {
            // Instantiate the collection object
            BoardList = DataProvider.GetBoards();

            if (BoardList.Count == 0)
            {
                // Create board
                BoardViewModel newBoard = new BoardViewModel
                {
                    BoardName = "New Board"
                };

                // Add to collection and db
                int newBoardId = DataProvider.AddBoard("New Board", "");
                newBoard.BoardId = newBoardId.ToString();
                newBoard.Tasks   = new ObservableCollection <CustomKanbanModel>();
                BoardList.Add(newBoard);
                Current = newBoard;
            }
            else
            {
                allTasks = new ObservableCollection <CustomKanbanModel>();
                allTasks = DataProvider.GetData();
                foreach (var board in BoardList)
                {
                    foreach (var task in allTasks)
                    {
                        if (task.BoardId == board.BoardId)
                        {
                            board.Tasks.Add(task);
                        }
                    }
                }

                Current = BoardList[0];
            }
        }
Exemplo n.º 3
0
        public void CreateBoard()
        {
            // Create board
            BoardViewModel newBoard = new BoardViewModel
            {
                BoardName  = BoardName,
                BoardNotes = BoardNotes
            };

            // Add board to db and collection
            int newBoardId = DataProvider.AddBoard(BoardName, BoardNotes);

            newBoard.BoardId = newBoardId.ToString();
            newBoard.Tasks   = new ObservableCollection <CustomKanbanModel>();
            foreach (var task in allTasks)
            {
                if (task.BoardId == newBoardId.ToString())
                {
                    newBoard.Tasks.Add(task);
                }
            }
            BoardList.Add(newBoard);
        }