private void NewBoardSaveButton_Clicked(object sender, RoutedEventArgs e) { var new_id = Guid.NewGuid().GetHashCode(); var new_board = new BoardModel(new_id, NewBoardNameTextBox.Text); BoardList.Add(new_board); // Update database DataAccess.AddBoard(new_id, NewBoardNameTextBox.Text); NewBoardNameTextBox.Text = string.Empty; NewBoard_SplitView.IsPaneOpen = false; }
/// <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); }
// load public void LoadData() { for (int i = 0; i < BUTTON; i++) { Board _newBoard = new Board(BOARD_NAME + (i + 1), COUNT + (i + 1) + TYPE + BOARD_NAME, (i + 1) * COST * TWO); Core _newCpu = new Core(CORE_NAME + (i + 1), COUNT + (i + 1) + TYPE + CORE_NAME, (i + 1) * COST * THREE); Disk _newDisk = new Disk(DISK_NAME + (i + 1), COUNT + (i + 1) + TYPE + DISK_NAME, (i + 1) * COST); Memory _newMemory = new Memory(MEMORY_NAME + (i + 1), COUNT + (i + 1) + TYPE + MEMORY_NAME, (i + 1) * COST); DisplayCard _newDisplayCard = new DisplayCard(CARD_NAME + (i + 1), COUNT + (i + 1) + TYPE + CARD_NAME, (i + 1) * COST * FOUR); ComboComputer _newComboComputer = new ComboComputer(COMPUTER_NAME + (i + 1), COUNT + (i + 1) + TYPE + COMPUTER_NAME, (i + 1) * COST * FIVE); BoardList.Add(_newBoard); CoreList.Add(_newCpu); DiskList.Add(_newDisk); MemoryList.Add(_newMemory); DisplayCardList.Add(_newDisplayCard); ComboComputerList.Add(_newComboComputer); } }
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]; } }
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); }