コード例 #1
0
        private void ReportItem_DoubleClick(object sender, HtmlElementEventArgs e)
        {
            HtmlElement el = wbReports.Document != null
                                 ? wbReports.Document.GetElementFromPoint(e.ClientMousePosition)
                                 : null;

            string guid = el != null ? el.Id : string.Empty;
            Report ri   = ReportService.GetInstance().GetReport(new Guid(guid));

            if (ri != null && !_timers.ContainsKey(guid))
            {
                bool showReport = true;
                if (ri.Params.Count > 0)
                {
                    try
                    {
                        ReportParamsForm frm = new ReportParamsForm(ri.Params, ri.Title);
                        if (frm.ShowDialog() != DialogResult.OK)
                        {
                            showReport = false;
                        }
                    }
                    catch (Exception error)
                    {
                        FireException(error);
                        showReport = false;
                    }
                }
                if (showReport)
                {
                    SetItemLoading(guid);
                    StartTimer(guid);
                    _lastSelected = null;
                    BackgroundWorker bwReportLoader = new ReportWorker
                    {
                        WorkerReportsProgress = true
                        , Report = ri
                        , WorkerSupportsCancellation = true
                    };
                    bwReportLoader.DoWork             += OnLoadReport;
                    bwReportLoader.RunWorkerCompleted += OnReportLoaded;
                    bwReportLoader.RunWorkerAsync(ri);
                }
            }
        }
コード例 #2
0
ファイル: PrintButton.cs プロジェクト: aelhadi/opencbs
        private void PrintReport(Guid guid)
        {
            ReportService rs = ReportService.GetInstance();
            Report report = rs.GetReport(guid);
            if (null == report) return;

            try
            {
                List<ReportParamV2> additionalParams
                    = report.Params
                        .Where(p => p.Additional && p.Visible)
                        .ToList();
                if (additionalParams.Count != 0)
                {
                    ReportParamsForm reportParamsForm = new ReportParamsForm(additionalParams, report.Title);
                    if (reportParamsForm.ShowDialog() != DialogResult.OK) return;
                }

                ReportInitializer(report);

                try
                {
                    StartProgress();
                    rs.LoadReport(report);
                }
                finally
                {
                    StopProgress();
                }
            }
            catch (Exception exception)
            {
                new frmShowError(
                    CustomExceptionHandler.ShowExceptionText(exception)
                    ).ShowDialog();
                throw;
            }

            ReportViewerForm frm = new ReportViewerForm(report);
            frm.Show();
        }
コード例 #3
0
        private void ReportItem_DoubleClick(object sender, HtmlElementEventArgs e)
        {
            HtmlElement el = wbReports.Document != null
                                 ? wbReports.Document.GetElementFromPoint(e.ClientMousePosition)
                                 : null;
            string guid = el != null ? el.Id : string.Empty;
            Report ri = ReportService.GetInstance().GetReport(new Guid(guid));

            if (ri != null && !_timers.ContainsKey(guid))
            {
                bool showReport = true;
                if (ri.Params.Count > 0)
                {
                    try
                    {
                        ReportParamsForm frm = new ReportParamsForm(ri.Params, ri.Title);
                        if (frm.ShowDialog() != DialogResult.OK)
                        {
                            showReport = false;
                        }
                    }
                    catch (Exception error)
                    {
                        FireException(error);
                        showReport = false;
                    }
                }
                if (showReport)
                {
                    SetItemLoading(guid);
                    StartTimer(guid);
                    _lastSelected = null;
                    BackgroundWorker bwReportLoader = new ReportWorker
                    {
                        WorkerReportsProgress = true
                        , Report = ri
                        , WorkerSupportsCancellation = true
                    };
                    bwReportLoader.DoWork += OnLoadReport;
                    bwReportLoader.RunWorkerCompleted += OnReportLoaded;
                    bwReportLoader.RunWorkerAsync(ri);
                }
            }
        }