Example #1
0
        public static void LoadMobileReport(RSPortalAccessorV1 portalAccessor, string report)
        {
            lock (_lock)
            {
                var ctx = portalAccessor.CreateContext();

                // runtime
                ProceedIfOk(() => ctx.SafeGetSystemResourceContent("mobilereportruntime", "web").GetValue());

                // report
                MobileReport mobileReport = null;
                ProceedIfOk(() => mobileReport = ctx.CatalogItemByPath(report).GetValue() as MobileReport);

                // definition
                ProceedIfOk(() => ctx.CatalogItems.ByKey(mobileReport.Manifest.Definition.Id).GetValue());

                // resources
                foreach (var resource in mobileReport.Manifest.Resources)
                {
                    foreach (var item in resource.Items)
                    {
                        if (resource.Type == MobileReportResourceGroupType.Map && item.Key == "json")
                        {
                            LoadResource(portalAccessor, item.Id);
                        }
                        else if (resource.Type == MobileReportResourceGroupType.Style && new[] { "colors", "Windows8-Style.xaml" }.Contains(item.Key))
                        {
                            LoadResource(portalAccessor, item.Id);
                        }
                    }
                }

                // datasets
                foreach (var dataset in mobileReport.Manifest.DataSets.RandomWhere(x => x.Type == MobileReportDataSetType.Shared))
                {
                    ProceedIfOk(() => ctx.CatalogItems.ByKey(dataset.Id).CastToDataSet().GetData(new DataSetParameter[] { }, null).GetValue());
                }
            }
        }
Example #2
0
        private static void LoadResource(RSPortalAccessorV1 portalAccessor, Guid id)
        {
            var ctx = portalAccessor.CreateContext();

            ProceedIfOk(() => ctx.CatalogItems.ByKey(id).CastToResource().Select(x => x.Content).GetValue());
        }