private void ConfigureGrid() { grid = appService.Kernel.Get <GridScreen>(); grid.AddColumn(); grid.AddRow(); var selfTrainingMenuItem = GetSelfTrainingMenuItem(); var manualTrainingMenuItem = GetHumanTrainingMenuItem(); var raceMenuItem = GetRaceMenuItem(); var mapMakingMenuItem = GetMapMakingMenuItem(); grid.AddMenuItem(0, 0, selfTrainingMenuItem); grid.AddMenuItem(0, 1, manualTrainingMenuItem); grid.AddMenuItem(1, 0, raceMenuItem); grid.AddMenuItem(1, 1, mapMakingMenuItem); eventService.RegisterMouseClickCallback(this.Id, new MouseClickCallbackEventArgs(Mouse.Button.Left), grid.OnMousePress); }
private void PopulateTrackVisuals() { var trackVisuals = new List <MenuItem>(); grid.Clear(); foreach (var track in tracks) { // We couldnt find the matching image for this track, don't add it. var texture = GetTrackTexture(track.FileLocation); MenuItem trackVisual; if (texture == null) { trackVisual = GetDefaultTrackVisual(track); } else { trackVisual = GetTrackVisual(track, texture); } trackVisuals.Add(trackVisual); } if (trackVisuals.Any()) { for (int i = 0; i < trackVisuals.Count - 1; i++) { grid.AddColumn(); grid.AddMenuItem(0, i, trackVisuals[i]); } grid.AddMenuItem(0, trackVisuals.Count - 1, trackVisuals.Last()); } }