public override async Task ExecuteLoadDataTypesCommand() { try { //go through each of the datatypes and work out all the company accesses for each var dataTypes = await UserInfo.GetPermissions().GetDataTypesAsync(true); var companies = await UserInfo.GetPermissions().GetCompaniesAsync(true); var logDictionary = await UserInfo.GetPermissions().RetrieveAllRelevantLogs(); TypeSortedLogs.Clear(); //clear the logs, we will reestablish it foreach (DataType dataType in dataTypes) { //create an indexed log collection, create this for all datatypes, but only add it to the TypeSortedLogs if it has an entry IndexedLogCollection dataTypeLogCollection = new IndexedLogCollection() { DataType = dataType, Logs = new ObservableCollection <Log>(), LogsWithMaxElements = new ObservableCollection <Log>() }; bool toAdd = false; //whether to add this indexed log collection to the full list, set true if there is a log added foreach (Company company in companies) { if (logDictionary.ContainsKey((dataType.Id, company.Id))) { toAdd = true; //there was at least one entry, this data type should be displayed //there is a list, iterate through it and add all the foreach (DateTime dateTime in logDictionary[(dataType.Id, company.Id)])
async void OnCompanyHistoryButtonSelected(IndexedLogCollection indexedLogCollection) { if (indexedLogCollection == null) { return; } LogHistoryCompanyViewModel logHistoryCompanyViewModel = new LogHistoryCompanyViewModel(indexedLogCollection.Company, indexedLogCollection.Logs); await Application.Current.MainPage.Navigation.PushAsync(new LogHistoryCompanyPage(logHistoryCompanyViewModel)); }