public void PBIEmbedded_Invoke() { PBIContentObject embed = null; object[] parameters = null; if (DashboardSelected.IsChecked.Value && appWorkSpacesDashboardList.SelectedItem != null) { embed = (PBIContentObject)appWorkSpacesDashboardList.SelectedItem; parameters = new object[] { embed.EmbeddedUrl, Token, embed.EmbeddedId, PBIObjectType.Dashboard, 0, string.Empty }; PBIEmbeddedWB.InvokeScript("LoadEmbeddedObject", parameters); } else if (ReportSelected.IsChecked.Value && appWorkSpacesReportList.SelectedItem != null) { embed = (PBIContentObject)appWorkSpacesReportList.SelectedItem; parameters = new object[] { embed.EmbeddedUrl, Token, embed.EmbeddedId, PBIObjectType.Report, 0, string.Empty }; PBIEmbeddedWB.InvokeScript("LoadEmbeddedObject", parameters); } else if (TileSelected.IsChecked.Value && appWorkSpacesDashboardList.SelectedItem != null & appWorkSpacesTileList.SelectedItem != null) { string dashboardId = ((PBIContentObject)appWorkSpacesDashboardList.SelectedItem).EmbeddedId; embed = (PBIContentObject)appWorkSpacesTileList.SelectedItem; parameters = new object[] { embed.EmbeddedUrl, Token, embed.EmbeddedId, PBIObjectType.Tile, 0, dashboardId }; PBIEmbeddedWB.InvokeScript("LoadEmbeddedObject", parameters); } }
private void appWorkSpacesDashboardList_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (appWorkSpacesDashboardList.SelectedItem != null) { using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials)) { var WorkSpace = appWorkSpacesList.SelectedItem as workSpaceList; PBIContentObject dashboard = (PBIContentObject)appWorkSpacesDashboardList.SelectedItem; appWorkSpacesTileList.ItemsSource = client.Dashboards.GetTilesInGroup(WorkSpace.Id, dashboard.EmbeddedId).Value.Select(t => new PBIContentObject(t.Title, t.EmbedUrl, t.Id)); appWorkSpacesTileList.SelectedIndex = 0; } } else { appWorkSpacesTileList.ItemsSource = null; } }