private void cmdConfig_Click(object sender, RoutedEventArgs e) { if (rpt == null) { return; } MReportConfig cfg = rpt.GetReportConfig(); WinFormConfigParam wc = new WinFormConfigParam("", cfg); wc.ShowDialog(); if (wc.IsOK) { cfg = wc.Config; cfg.IsModified = true; rpt.UpdateReportConfig(wc.Config); cmdSave.IsEnabled = cfg.IsModified; rpt.UpdateReportConfig(cfg); rpt.isPageRange = false; rpt.SetDataSourceAndParam(dataSource, cfg); rpt.CreateFixedDocument(); docViewer.Document = rpt.GetFixedDocument(); //CUtil.LoadPageNavigateCombo(cboPageNo, rpt.PageCount); //CUtil.LoadPageCombo(cboFromPage, rpt.PageCount); //CUtil.LoadPageCombo(cboToPage, rpt.PageCount); } }
private void cmdPrint_Click(object sender, RoutedEventArgs e) { if (trvMain.SelectedItem is MReportGroup) { return; } MReportFilter mr = (MReportFilter)trvMain.SelectedItem; if (mr == null) { return; } CBaseReport paginator = (CBaseReport)reportObjs[mr.ReportName]; if (paginator == null) { return; } Boolean isPageRange = (Boolean)cbxPageRange.IsChecked; if (isPageRange) { populatePageRange(paginator); if (paginator.toPage < paginator.fromPage) { CHelper.ShowErorMessage("", "ERROR_PAGE_RANGE", null); return; } } dialog.PrintQueue = LocalPrintServer.GetDefaultPrintQueue(); dialog.PrintTicket = dialog.PrintQueue.DefaultPrintTicket; dialog.PrintTicket.PageOrientation = paginator.GetPageOrientation(); dialog.PrintTicket.PageMediaSize = new PageMediaSize(PageMediaSizeName.Unknown, paginator.PageSize.Width, paginator.PageSize.Height); bool?result = dialog.ShowDialog(); if (result == true) { paginator.isPageRange = isPageRange; FixedDocument fd = null; if (!isPageRange) { fd = paginator.GetFixedDocument(); } else { fd = paginator.CreateFixedDocument(); } docViewer.Document = paginator.GetFixedDocument(); dialog.PrintDocument(fd.DocumentPaginator, ""); CUtil.LoadPageNavigateCombo(cboPageNo, paginator.PageCount); } }
private void cmdOK_Click(object sender, RoutedEventArgs e) { CTable param = verifyAndConstructObject(); if (param == null) { return; } tc = new CThreadSync(); Thread t = new Thread(ShowProgWin); t.SetApartmentState(ApartmentState.STA); t.Start(); CReportFactory.UpdateExtendedParam(dat, param); paginator.UpdateReportConfig(rptCfg); paginator.SetReportParam(param); paginator.SetProgressUpdateFunc(UpdateProgress); paginator.SetProgressDoneFunc(UpdateDone); if (paginator.IsNewVersion()) { paginator.CreateReportFixedDocument(); } else { paginator.CreateFixedDocument(); } isDone = true; this.Close(); }
private void trvMain_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { if (!(e.NewValue is MReportFilter)) { return; } if (isInLoad && IsConfigMode) { return; } MReportFilter mr = (MReportFilter)e.NewValue; String rptId = mr.ReportName; if (reportObjs.ContainsKey(rptId)) { rpt = (CBaseReport)reportObjs[rptId]; } else { CBaseReport r = createObject(rptId); CUtil.EnableForm(false, this); MReportConfig rptCfg = CReportConfigs.GetReportConfig(null, rptId); CUtil.EnableForm(true, this); MReportConfig defaultCfg = r.CreateDefaultConfigValues(); defaultCfg.ReportName = rptId; if (rptCfg == null) { rptCfg = defaultCfg; CReportConfigs.SaveReportConfig(null, rptCfg); } else { rptCfg.PopulateMissingValue(defaultCfg); } MBaseModel d = null; if (dataSource == null) { d = r.CreateDefaultData(); } else { d = dataSource; } r.SetDataSourceAndParam(d, rptCfg); r.isPageRange = false; r.CreateFixedDocument(); reportObjs.Add(rptId, r); rpt = r; } cmdSave.IsEnabled = rpt.GetReportConfig().IsModified; cbxPageRange.IsEnabled = rpt.IsPageRangeSupport; this.Title = mr.Description; docViewer.Document = rpt.GetFixedDocument(); CUtil.LoadPageNavigateCombo(cboPageNo, rpt.PageCount); CUtil.LoadPageCombo(cboFromPage, rpt.PageCount); CUtil.LoadPageCombo(cboToPage, rpt.PageCount); }