Пример #1
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (value != null)
     {
         Theme theme = RepositoryServer.GetTheme(value.ToString());
         if (theme != null)
         {
             return(theme.Name);
         }
     }
     return(base.ConvertFrom(context, culture, value));
 }
Пример #2
0
        private void PreLoadThread()
        {
            try
            {
                WebHelper.WriteLogEntryWeb(EventLogEntryType.Information, "Starting Preload Templates");
                RepositoryServer.PreLoadTemplates();

                WebHelper.WriteLogEntryWeb(EventLogEntryType.Information, "Starting Preload Widgets");
                var widgets = DashboardWidgetsPool.Widgets;

                List <string> reportList = new List <string>();
                foreach (var widget in widgets.Values)
                {
                    var filePath = Repository.Instance.ReportsFolder + widget.ReportPath;
                    if (System.IO.File.Exists(filePath) && !reportList.Contains(filePath))
                    {
                        reportList.Add(filePath);
                    }
                }

                WebHelper.WriteLogEntryWeb(EventLogEntryType.Information, "Starting Preload of {0} Widget Reports", reportList.Count);
                var repository = Repository.Instance.CreateFast();
                foreach (var reportPath in reportList)
                {
                    try {
                        var report = Report.LoadFromFile(reportPath, repository);

                        report.ExecutionContext = ReportExecutionContext.TaskScheduler;
                        //Disable basics
                        report.ExecutionView.InitParameters(false);
                        report.ExecutionView.SetParameter(Parameter.DrillEnabledParameter, false);
                        report.ExecutionView.SetParameter(Parameter.SubReportsEnabledParameter, false);
                        report.ExecutionView.SetParameter(Parameter.ServerPaginationParameter, false);
                        //set HTML Format
                        report.ExecutionView.SetParameter(Parameter.ReportFormatParameter, ReportFormat.html.ToString());
                        //Force load of all models
                        report.ExecutionView.SetParameter(Parameter.ForceModelsLoad, true);

                        var execution = new ReportExecution()
                        {
                            Report = report
                        };
                        execution.Execute();
                        while (report.IsExecuting)
                        {
                            Thread.Sleep(100);
                        }
                    }
                    catch (Exception ex)
                    {
                        WebHelper.WriteLogEntryWeb(EventLogEntryType.Error, "Pre Load: Error executing '{0}\r\n{1}", reportPath, ex.Message);
                    }
                }

                WebHelper.WriteLogEntryWeb(EventLogEntryType.Information, "Ending Preload");
            }
            catch (Exception ex)
            {
                WebHelper.WriteLogEntryWeb(EventLogEntryType.Error, ex.Message);
            }
        }