async Task ILoadableContent.LoadAsync(CancellationToken cancellationToken) { _object = await UserChampionshipsManager.Instance.GetByIdAsync(_id); if (_object != null) { foreach (var driver in _object.Drivers) { if (driver.CarId == null) { continue; } await CarsManager.Instance.GetByIdAsync(driver.CarId); } foreach (var round in _object.Rounds) { if (round.TrackId == null) { continue; } await TracksManager.Instance.GetByIdAsync(round.TrackId); } } }
public static void NavigateToChampionshipPage(UserChampionshipObject championship) { var mainWindow = Application.Current?.MainWindow as MainWindow; var group = mainWindow?.MenuLinkGroups.FirstOrDefault(x => x.GroupKey == "drive" && x.DisplayName == AppStrings.Main_Single); var links = group?.Links; links?.Remove(links.OfType <CustomLink>().FirstOrDefault(x => x.Source.OriginalString.StartsWith(@"/Pages/Drive/UserChampionships_SelectedPage.xaml"))); if (championship == null) { mainWindow?.NavigateTo(new Uri("/Pages/Drive/UserChampionships.xaml", UriKind.RelativeOrAbsolute)); return; } var uri = UriExtension.Create("/Pages/Drive/UserChampionships_SelectedPage.xaml?Id={0}", championship.Id); if (links == null) { LinkCommands.NavigateLink.Execute(uri, null); return; } var link = new CustomLink { DisplayName = championship.DisplayName, Source = uri }; links.Insert(4, link); mainWindow.NavigateTo(link.Source); }
void ILoadableContent.Load() { _object = UserChampionshipsManager.Instance.GetById(_id); }
public ViewModel(UserChampionshipObject careerObject) { _acObject = careerObject; UpdateConditions(true).Forget(); }