private async Task showData(string pageName) { try { IonPage page = await Ion.getInstance(AppController.instance.ampConfig).getPageAsync(pageName); _allContent = DataConverters.convertContent(page.getContents()); // Load files for page content await Ion.getInstance(AppController.instance.ampConfig).loadContentFilesAsync(_allContent); //await Ion.getInstance( AppController.instance.ampConfig ).DownloadSearchDatabase(); //List<SearchResult> results = await Ion.getInstance( AppController.instance.ampConfig ).FullTextSearch("test", "de_DE"); // Set the data context of the lists imageContentList.DataContext = _allContent.imageContent; textContentList.DataContext = _allContent.textContent; colorContentList.DataContext = _allContent.colorContent; flagContentList.DataContext = _allContent.flagContent; fileContentList.DataContext = _allContent.fileContent; mediaContentList.DataContext = _allContent.mediaContent; dateTimeContentList.DataContext = _allContent.dateTimeContent; optionContentList.DataContext = _allContent.optionContent; } catch (Exception exception) { // Error handling, if no data could be loaded Debug.WriteLine("Error loading page: " + exception.Message); } setDataLoaded(); initPage(); }
public async Task loadContentFilesAsync(IonPageObservableCollection content) { foreach (IonImageContent ampImageContent in content.imageContent) { await ampImageContent.loadImage(this).ConfigureAwait(false); } foreach (IonFileContent ampFileContent in content.fileContent) { await ampFileContent.loadFile(this).ConfigureAwait(false); } }
/// <summary> /// Helps to convert a list of IonContent to a PageObservableCollection /// </summary> /// <param name="list"></param> /// <returns>ObservableCollection with all the content of the list given</returns> public static IonPageObservableCollection convertContent(List <IonContent> list) { IonPageObservableCollection oc = new IonPageObservableCollection(); for (int i = 0; i < list.Count; i++) { // Check if the item is avialible (means that is has all properties filled with data) if (!list[i].isAvailable) { continue; } switch (list[i].type) { case IonConstants.TextContentIdentifier: { oc.textContent.Add((IonTextContent)list[i]); break; } case IonConstants.ImageContentIdentifier: { oc.imageContent.Add((IonImageContent)list[i]); break; } case IonConstants.ColorContentIdentifier: { oc.colorContent.Add((IonColorContent)list[i]); break; } case IonConstants.DateTimeContentIdentifier: { oc.dateTimeContent.Add((IonDateTimeContent)list[i]); break; } case IonConstants.FileContentIdentifier: { oc.fileContent.Add((IonFileContent)list[i]); break; } case IonConstants.FlagContentIdentifier: { oc.flagContent.Add((IonFlagContent)list[i]); break; } case IonConstants.MediaContentIdentifier: { oc.mediaContent.Add((IonMediaContent)list[i]); break; } case IonConstants.OptionContentIdentifier: { oc.optionContent.Add((IonOptionContent)list[i]); break; } case IonConstants.NumberContentIdentifier: { oc.numberContent.Add((IonNumberContent)list[i]); break; } case IonConstants.ConnectionContentIdentifier: { oc.connectionContent.Add((IonConnectionContent)list[i]); break; } case IonConstants.ChartContentIdentifier: { oc.chartContent.Add((IonChartContent)list[i]); break; } } } return(oc); }