/// <summary> /// get the values Name/Description/Xml from the ListBox item /// </summary> /// <param name="item">usually the selected item in the list box as ReportListBoxItem</param> /// <param name="createTmpFile">true if should create the file in the xml on disk</param> /// <param name="reportName">ref to the report Name</param> /// <param name="reportDesc">ref to the report Description</param> /// <param name="filePath">ref to the reportFilePath</param> private void GetItemValues(ReportListBoxItem item, bool createTmpFile, ref string reportName, ref string reportDesc, ref string filePath, ref FluidTrade.Reporting.Interfaces.IStaticReportTranslation translator) { if (item.Row != null) { //the item is pointing to a row in the dataModel ReportXmlHelper.XmlToTempFile(item.Row.Xaml, createTmpFile, out reportName, out reportDesc, out filePath, out translator); } else if (string.IsNullOrEmpty(item.LocalFilePath) == false) { //item is pointing at a local file reportName = filePath = item.LocalFilePath; reportDesc = string.Empty; } else if (string.IsNullOrEmpty(item.Xml) == false) { //item is pointing at a newly imported report ReportXmlHelper.XmlToTempFile(item.Xml, createTmpFile, out reportName, out reportDesc, out filePath, out translator); } else { //error return; } }
private void LoadReports() { FileInfo fInfo = new FileInfo(Assembly.GetExecutingAssembly().Location); string filePath = Path.Combine(fInfo.DirectoryName, ReportInfo.RelativeReportsPath); _reports = ReportXmlHelper.LoadReportListFromXmlFile(Path.Combine(filePath, ReportInfo.RDLXmlFileName)); }
/// <summary> /// handler for ok button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void okBtn_Click(object sender, RoutedEventArgs e) { this.reportImportPath = this.importFromTextBox.Text; this.translationImportPath = this.translationTextBox.Text; this.reportName = this.nameTextBox.Text; this.reportDescription = this.descriptionTextBox.Text; if (!string.IsNullOrEmpty(this.reportImportPath)) { //get the xml from the file to be imported this.importedXml = ReportXmlHelper.FilesToXml(this.reportName, this.reportDescription, this.reportImportPath, this.translationImportPath); //crete the reportObject to use in the webservice FluidTrade.Guardian.TradingSupportReference.Report report = new FluidTrade.Guardian.TradingSupportReference.Report(); report.Name = this.reportName; report.ReportTypeId = DataModel.ReportType.ReportTypeKeyReportTypeCode.Find(ReportType.StaticReport).ReportTypeId; report.Xaml = this.importedXml; //make the webservice call to create the new report record on a worker thread FluidTrade.Core.ThreadPoolHelper.QueueUserWorkItem(new WaitCallback(this.CreateReportCallback), report); //disable the window and do not close until the webservice is complete this.IsEnabled = false; } else { //!!!RM show an error? this.DialogResult = false; this.Close(); } }