public bool AddCellToRowCheck() { if (_selectedRowVM != null && RowViewModelList.Count > 1 && _selectMode == SelectMode.Multiple) { if (_selectedRowVM == RowViewModelList.First()) { return(RowViewModelList[RowViewModelList.IndexOf(_selectedRowVM) + 1].CellsCollection.Count > 1); } else if (RowViewModelList.IndexOf(_selectedRowVM) > 0) { return(RowViewModelList[RowViewModelList.IndexOf(_selectedRowVM) - 1].CellsCollection.Count > 1); } } return(false); }
public void DelCellFromRow() { if (_selectedRowVM == RowViewModelList.First()) { var lastCell = _selectedRowVM.GetLastCell(); var nextRowViewModel = RowViewModelList[RowViewModelList.IndexOf(_selectedRowVM) + 1]; lastCell.CellData.RowNum = RowViewModelList.IndexOf(nextRowViewModel) + 1; lastCell.IsSelected = false; nextRowViewModel.CellsCollection.Add(lastCell); nextRowViewModel.UpdateDirection(); nextRowViewModel.UpdateBusPositions(); nextRowViewModel.UpdateFacade(); nextRowViewModel.UpdateCellPanel(); _selectedRowVM.UpdateDirection(); _selectedRowVM.UpdateBusPositions(); _selectedRowVM.UpdateFacade(); _selectedRowVM.UpdateDoorDirection(); _selectedRowVM.UpdateCellPanel(); } else { var firstCell = _selectedRowVM.GetFirstCell(); var prevRowViewModel = RowViewModelList[RowViewModelList.IndexOf(_selectedRowVM) - 1]; firstCell.CellData.RowNum = RowViewModelList.IndexOf(prevRowViewModel) + 1; firstCell.IsSelected = false; prevRowViewModel.CellsCollection.Add(firstCell); prevRowViewModel.UpdateDirection(); prevRowViewModel.UpdateBusPositions(); prevRowViewModel.UpdateFacade(); prevRowViewModel.UpdateCellPanel(); _selectedRowVM.UpdateDirection(); _selectedRowVM.UpdateBusPositions(); _selectedRowVM.UpdateFacade(); _selectedRowVM.UpdateDoorDirection(); _selectedRowVM.UpdateCellPanel(); } UpdateAll(); StageSave(); }