public BotGrid(int rows, int cols, int rowHeight, int colWidth, Canvas mapCanvas, int scale, RobotPose botPose, ObstaclePositions obstaclePositions) { _rows = rows; _cols = cols; _mapCanvas = mapCanvas; _rowHeight = rowHeight; _colWidth = colWidth; _scale = scale; _botPose = botPose; _instance = this; _obstaclePositions = obstaclePositions; _obstaclePositions.PropertyChanged += ObstaclePositionsOnPropertyChanged; _botPose.PropertyChanged += BotPoseOnPropertyChanged; }
protected override void OnNavigatedTo(NavigationEventArgs e) { RefreshSerialDevices(); //int rows = 24, cols = 40; int rows = 50, cols = 50; int scale = 5; // 5cm Real World per pixel MapCanvas.Width = cols * 50; MapCanvas.Height = rows * 50; int colWidth = (int)MapCanvas.Width / (2 * cols); int rowHeight = colWidth; mapController = new MapController(); RobotShape.DataContext = mapController.BotPose; botGrid = new BotGrid(rows, cols, rowHeight, colWidth, MapCanvas, scale, mapController.BotPose, mapController.obstaclePositons); botGrid.DrawGrid(); }