private void LoadSource(object state) { try { lock (DataModel.SyncRoot) { BlotterConfigurationRow blotterConfigurationRow = DataModel.BlotterConfiguration.BlotterConfigurationKeyBlotterIdReportTypeId.Find( this.blotterId, DataModel.ReportType.ReportTypeKeyReportTypeCode.Find(ReportType.CreditCardDetail).ReportTypeId); if (blotterConfigurationRow != null) { FluidTrade.Guardian.ReportRow reportRow = blotterConfigurationRow.ReportRow; if (reportRow != null && reportRow.ReportId != this.reportId) { this.reportId = reportRow.ReportId; StringReader stringReader = new StringReader(reportRow.Xaml); XDocument xDocument = XDocument.Load(stringReader); this.Dispatcher.BeginInvoke( DispatcherPriority.Normal, (SourceDelegate)((XDocument source) => { this.Source = source; }), xDocument); } } } } catch (Exception exception) { EventLog.Warning(String.Format("{0}: {1}\n{2}", exception.GetType(), exception.Message, exception.StackTrace)); } }
/// <summary> /// Handles a change to a Report record. /// </summary> /// <param name="sender">The object that originated the event.</param> /// <param name="e">The record change event arguments.</param> private void OnReportRowChanged(object sender, ReportRowChangeEventArgs e) { // The main idea here is to determin if this update is relevant for the currently displayed document. If it is, then the document needs to be // redrawn. if (e.Action == DataRowAction.Commit && e.Row.RowState != DataRowState.Detached) { // We want to find out what report is currently assigned to this blotter for displaying working orders. ReportTypeRow reportTypeRow = DataModel.ReportType.ReportTypeKeyReportTypeCode.Find(ReportType.WorkingOrder); if (reportTypeRow != null) { // This determines what report is used as a template based on the blotter being displayed and the need for a Working Order template. BlotterConfigurationRow blotterConfigurationRow = DataModel.BlotterConfiguration.BlotterConfigurationKeyBlotterIdReportTypeId.Find( this.blotterId, reportTypeRow.ReportTypeId); // Now taht we have the blotter configuration row we can check to see if the report that was changed was the one that is supposed to be // used by this report. Note that you can't use the 'reportId' member because that may not be set at this time. if (blotterConfigurationRow != null) { FluidTrade.Guardian.ReportRow reportRow = blotterConfigurationRow.ReportRow; if (reportRow != null && e.Row.ReportId == reportRow.ReportId) { this.reportId = Guid.Empty; LoadSource(); } } } } }
private void LoadSource(object state) { lock (DataModel.SyncRoot) { BlotterConfigurationRow blotterConfigurationRow = DataModel.BlotterConfiguration.BlotterConfigurationKeyBlotterIdReportTypeId.Find( this.blotterId, DataModel.ReportType.ReportTypeKeyReportTypeCode.Find(ReportType.Settlement).ReportTypeId); if (blotterConfigurationRow != null) { FluidTrade.Guardian.ReportRow reportRow = blotterConfigurationRow.ReportRow; if (reportRow != null && reportRow.ReportId != this.reportId) { this.reportId = reportRow.ReportId; StringReader stringReader = new StringReader(reportRow.Xaml); XDocument xDocument = XDocument.Load(stringReader); this.Dispatcher.BeginInvoke( DispatcherPriority.Normal, (SourceDelegate)((XDocument source) => { this.Source = source; }), xDocument); } } } }