private void Window_Loaded(object sender, RoutedEventArgs e) { CReportFactory.InitReports(); paginator = CReportFactory.GetReportObject(dat); this.Title = this.Title + " : " + paginator.GetType().Name; CUtil.EnableForm(false, this); rptCfg = CReportConfigs.GetReportConfig(null, dat.Code); CUtil.EnableForm(true, this); String paperType = "1"; if (rptCfg == null) { radLandScape.IsChecked = true; rptCfg = new MReportConfig(new CTable("")); rptCfg.ReportName = dat.Code; } else { paperType = rptCfg.PaperType; if (rptCfg.PageOrientation.Equals("LANDSCAPE")) { radLandScape.IsChecked = true; } else { radPotrait.IsChecked = true; } } CUtil.LoadPaperType(cboPaperType, false, paperType); constructFieldEntry(); constructUI(); }
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); }