async public static Task <List <StiGroupInfoList> > GetReportsByCategoryAsync(string fileName, bool useLocalFolder)
        {
            var         result = new List <StiGroupInfoList>();
            StorageFile storageFile;

            fileName = "StimulsoftResources\\Navigator\\" + fileName;
            if (useLocalFolder)
            {
                storageFile = await StiResourcesStorageHelper.LoadResourceFileFromLocalFolderAsync(fileName);
            }
            else
            {
                storageFile = await StiResourcesStorageHelper.LoadResourceFileAsync(fileName);
            }

            if (storageFile == null)
            {
                goto exitLabel;
            }

            result = await LoadReportsAsync(storageFile);

exitLabel:
            return(result);
        }
Beispiel #2
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            var storageFile = await StiResourcesStorageHelper.LoadResourceFileAsync("SimpleList.mdc");

            var report = new StiReport();
            await report.LoadDocumentAsync(storageFile);

            viewerControl.Report = report;

            this.dataTransferManager = DataTransferManager.GetForCurrentView();
            this.dataTransferManager.DataRequested += this.OnDataRequested;
        }
        private async void ItemsGridItemClick(object sender, ItemClickEventArgs e)
        {
            StiReport reportTmp = null;
            var       item      = e.ClickedItem as StiReportData.StiReportItem;

            if (item != null && !string.IsNullOrEmpty(item.FileName))
            {
                itemsGrid.IsEnabled     = false;
                bottomAppBar.IsEnabled  = false;
                progressRing.IsActive   = true;
                progressRing.Visibility = Visibility.Visible;

                StorageFile storageFile;

                if (StiDemoReportsPage.NavigatorReportsType == ReportsType.Demo)
                {
                    storageFile = await StiResourcesStorageHelper.LoadResourceFileAsync("StimulsoftResources\\Navigator\\Reports\\" + (item.FileName + ".mrt"));

                    if (storageFile != null)
                    {
                        reportTmp = new StiReport();
                        await reportTmp.LoadAsync(storageFile);

                        reportTmp.RegBusinessObject("Data", "Data", GetData());
                        await reportTmp.RenderAsync();
                    }
                }
                else
                {
                    storageFile = await StiResourcesStorageHelper.LoadResourceFileFromLocalFolderAsync("StimulsoftResources\\Navigator\\CustomReports\\Reports\\" + (item.FileName + ".mdc"));

                    if (storageFile != null)
                    {
                        reportTmp = new StiReport();
                        await reportTmp.LoadDocumentAsync(storageFile);
                    }
                }

                itemsGrid.IsEnabled     = true;
                bottomAppBar.IsEnabled  = true;
                progressRing.IsActive   = false;
                progressRing.Visibility = Visibility.Collapsed;
            }

            ((Frame)Window.Current.Content).Navigate(typeof(MainPage), reportTmp);
        }
        private async void StiSplashControlLoaded(object sender, RoutedEventArgs e)
        {
            panelProgress.Children.Clear();

            var item = new StiSplashLoadingItemControl(StiLocalization.Get("NavigatorRT", "ProgressInformations"), 0);

            panelProgress.Children.Add(item);

            item = new StiSplashLoadingItemControl(StiLocalization.Get("NavigatorRT", "ViewerImagesInitialization"), 1);
            panelProgress.Children.Add(item);
            bool result = await StiReportImagesStore.InitStoreAsync();

            if (!result)
            {
                goto errorLabel;
            }

            item = new StiSplashLoadingItemControl(StiLocalization.Get("NavigatorRT", "IndicatorImageInitialization"), 1);
            panelProgress.Children.Add(item);
            result = await StiIndicatorsImagesStore.InitStoreAsync();

            if (!result)
            {
                goto errorLabel;
            }

            #region Check

            StiReport report = null;

            if (!string.IsNullOrEmpty(args))
            {
                StorageFile storageFile;
                report = new StiReport();

                if (args.EndsWith(".mrt", System.StringComparison.Ordinal))
                {
                    storageFile = await StiResourcesStorageHelper.LoadResourceFileAsync("StimulsoftResources\\Navigator\\Reports\\" + args);

                    if (storageFile != null)
                    {
                        await report.LoadAsync(storageFile);

                        report.RegBusinessObject("Data", "Data", StiDemoCategoryPage.GetData());

                        await report.RenderAsync();
                    }
                }
                else if (args.EndsWith(".mdc", System.StringComparison.Ordinal))
                {
                    storageFile = await StiResourcesStorageHelper.LoadResourceFileFromLocalFolderAsync("StimulsoftResources\\Navigator\\CustomReports\\Reports\\" + args);

                    if (storageFile != null)
                    {
                        await report.LoadDocumentAsync(storageFile);
                    }
                }
            }
            else if (fileActivated != null)
            {
                var storageFile = (StorageFile)fileActivated;

                report = new StiReport();
                await report.LoadDocumentAsync(storageFile);

                if (storageFile.DisplayName.EndsWith("DeleteFile", System.StringComparison.Ordinal))
                {
                    await storageFile.DeleteAsync();
                }
            }

            if (report != null)
            {
                var frame = Window.Current.Content as Frame;

                if (frame == null)
                {
                    frame = new Frame();
                    Window.Current.Content = frame;
                }

                frame.Navigate(typeof(MainPage), report);
                return;
            }
            #endregion

            item = new StiSplashLoadingItemControl(StiLocalization.Get("NavigatorRT", "Starting"), 0);
            panelProgress.Children.Add(item);

            var rootFrame = new Frame();
            rootFrame.Navigate(typeof(StiDemoReportsPage));
            Window.Current.Content = rootFrame;

            return;

errorLabel:
            item = new StiSplashLoadingItemControl(StiLocalization.Get("NavigatorRT", "FailedLoadResources"), 2);
            panelProgress.Children.Add(item);
        }