I have a winforms application, and there is a lot of schronization (events firing) between open forms. I have to update calculations on one form based on a change in another form.
The approach works great, except for some reason after a few hours, the events just do not fire. If I close and reopen the application everything is fine. Any ideas?
Some sample code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MarketForecastBLL;
using System.Windows.Forms;
using System.Data;
using Infragistics.Win.UltraWinGrid;
namespace MarketForecastApp
{
public class DataEvent
public event MyHandler_PatientShareDependencyUpdate Event_PatientShareDependencyUpdate;
public event MyHandler_PatientShareDependencyRowDelete Event_PatientShareDependencyRowDelete;
public event MyHandler_PatientShareUpdate Event_PatientShareUpdate;
public event MyHandler_PatientShareUpdateByCurveCalculation Event_PatientShareUpdateByCurveCalculation;
public event MyHandler_PatientShareGroupGridReload Event_PatientShareGroupGridReload;
public event MyHandler_PopulationMappingUpdate Event_PopulationMappingUpdate;
public event MyHandler_EpidemiologyValueUpdate Event_EpidemiologyValueUpdate;
public event MyHandler_TreatedDaysValueUpdate Event_TreatedDaysValueUpdate;
public event MyHandler_ComplianceValueUpdate Event_ComplianceValueUpdate;
public event MyHandler_CurrentTherapyDosingBrandGenericUpdate Event_CurrentTherapyDosingBrandGenericUpdate;
public event MyHandler_CurrentTherapyDosingDrugPriceUpdate Event_CurrentTherapyDosingDrugPriceUpdate;
public event MyHandler_CurrentTherapyDosingDrugChange Event_CurrentTherapyDosingDrugChange;
public event MyHandler_EmergingBrandAddOrDelete Event_EmergingBrandAddOrDelete;
public event MyHandler_EmergingGenericsAddOrDelete Event_EmergingGenericsAddOrDelete;
public event MyHandler_EmergingBrandStartPriceUpdate Event_EmergingBrandStartPriceUpdate;
public event MyHandler_EmergingBrandLaunchDateUpdate Event_EmergingBrandLaunchDateUpdate;
public event MyHandler_EmergingGenericLaunchDateUpdate Event_EmergingGenericLaunchDateUpdate;
public event MyHandler_BrandPercentBrandValueUpdate Event_BrandPercentBrandValueUpdate;
public event MyHandler_GenericPercentGenericValueUpdate Event_GenericPercentGenericValueUpdate;
public event MyHandler_GenericPercentBrandValueUpdate Event_GenericPercentBrandValueUpdate;
public event MyHandler_GenericErosionValueUpdate Event_GenericErosionValueUpdate;
public event MyHandler_RegimenDeleteUpdate Event_RegimenDeleteUpdate;
public event MyHandler_RegimenPricingDrugMappingUpdate Event_RegimenPricingDrugMappingUpdate;
public event MyHandler_RegimenDefinitionPriceUpdate Event_RegimenDefinitionPriceUpdate;
public event MyHandler_EmergingRegimenLaunchDateUpdate Event_EmergingRegimenLaunchDateUpdate;
public event MyHandler_PricingDrugAddOrDelete Event_PricingDrugAddOrDelete;
public event MyHandler_CountryAddOrDelete Event_CountryAddOrDelete;
public event MyHandler_PopulationAddOrDelete Event_PopulationAddOrDelete;
public event MyHandler_TimelineAddOrDelete Event_TimelineAddOrDelete;
public event MyHandler_DrugClassMappingUpdate Event_DrugClassMappingUpdate;
//Market Forecaster Events
public void Trigger_Event_PatientShareDependencyUpdate(DataEventArgs e)
if (Event_PatientShareDependencyUpdate != null)
Event_PatientShareDependencyUpdate(this, e);
}
public void Trigger_Event_PatientShareDependencyRowDelete(DataEventArgs e)
if (Event_PatientShareDependencyRowDelete != null)
Event_PatientShareDependencyRowDelete(this, e);
public void Trigger_Event_PatientShareUpdate(DataEventArgs e)
if (Event_PatientShareUpdate != null)
Event_PatientShareUpdate(this, e);
public void Trigger_Event_PatientShareUpdateByCurveCalculation(DataEventArgs e)
if (Event_PatientShareUpdateByCurveCalculation != null)
Event_PatientShareUpdateByCurveCalculation(this, e);
public void Trigger_Event_PatientShareGroupGridReload(DataEventArgs e)
if (Event_PatientShareGroupGridReload != null)
Event_PatientShareGroupGridReload(this, e);
public void Trigger_Event_PopulationMappingUpdate(DataEventArgs e)
if (Event_PopulationMappingUpdate != null)
Event_PopulationMappingUpdate(this, e);
public void Trigger_Event_EpidemiologyValueUpdate(DataEventArgs e)
if (Event_EpidemiologyValueUpdate != null)
Event_EpidemiologyValueUpdate(this, e);
public void Trigger_Event_TreatedDaysValueUpdate(DataEventArgs e)
if (Event_TreatedDaysValueUpdate != null)
Event_TreatedDaysValueUpdate(this, e);
public void Trigger_Event_ComplianceValueUpdate(DataEventArgs e)
if (Event_ComplianceValueUpdate != null)
Event_ComplianceValueUpdate(this, e);
//Price Forecaster Events
public void Trigger_Event_CurrentTherapyDosingBrandGenericUpdate(DataEventArgs e)
if (Event_CurrentTherapyDosingBrandGenericUpdate != null)
Event_CurrentTherapyDosingBrandGenericUpdate(this, e);
public void Trigger_Event_CurrentTherapyDosingDrugPriceUpdate(DataEventArgs e)
if (Event_CurrentTherapyDosingDrugPriceUpdate != null)
Event_CurrentTherapyDosingDrugPriceUpdate(this, e);
public void Trigger_Event_CurrentTherapyDosingDrugChange(DataEventArgs e)
if (Event_CurrentTherapyDosingDrugChange != null)
Event_CurrentTherapyDosingDrugChange(this, e);
public void Trigger_Event_EmergingBrandAddOrDelete(DataEventArgs e)
if (Event_EmergingBrandAddOrDelete != null)
Event_EmergingBrandAddOrDelete(this, e);
public void Trigger_Event_EmergingGenericsAddOrDelete(DataEventArgs e)
if (Event_EmergingGenericsAddOrDelete != null)
Event_EmergingGenericsAddOrDelete(this, e);
public void Trigger_Event_EmergingBrandStartPriceUpdate(DataEventArgs e)
if (Event_EmergingBrandStartPriceUpdate != null)
Event_EmergingBrandStartPriceUpdate(this, e);
public void Trigger_Event_EmergingBrandLaunchDateUpdate(DataEventArgs e)
if (Event_EmergingBrandLaunchDateUpdate != null)
Event_EmergingBrandLaunchDateUpdate(this, e);
public void Trigger_Event_EmergingGenericLaunchDateUpdate(DataEventArgs e)
if (Event_EmergingGenericLaunchDateUpdate != null)
Event_EmergingGenericLaunchDateUpdate(this, e);
public void Trigger_Event_BrandPercentBrandValueUpdate(DataEventArgs e)
if (Event_BrandPercentBrandValueUpdate != null)
Event_BrandPercentBrandValueUpdate(this, e);
public void Trigger_Event_GenericPercentGenericValueUpdate(DataEventArgs e)
if (Event_GenericPercentGenericValueUpdate != null)
Event_GenericPercentGenericValueUpdate(this, e);
public void Trigger_Event_GenericPercentBrandValueUpdate(DataEventArgs e)
if (Event_GenericPercentBrandValueUpdate != null)
Event_GenericPercentBrandValueUpdate(this, e);
public void Trigger_Event_GenericErosionValueUpdate(DataEventArgs e)
if (Event_GenericErosionValueUpdate != null)
Event_GenericErosionValueUpdate(this, e);
public void Trigger_Event_RegimenPricingDrugMappingUpdate(DataEventArgs e)
if (Event_RegimenPricingDrugMappingUpdate != null)
Event_RegimenPricingDrugMappingUpdate(this, e);
public void Trigger_Event_RegimenDefinitionPriceUpdate(DataEventArgs e)
if (Event_RegimenDefinitionPriceUpdate != null)
Event_RegimenDefinitionPriceUpdate(this, e);
public void Trigger_Event_EmergingRegimenLaunchDateUpdate(DataEventArgs e)
if (Event_EmergingRegimenLaunchDateUpdate != null)
Event_EmergingRegimenLaunchDateUpdate(this, e);
public void Trigger_Event_RegimenDeleteUpdate(DataEventArgs e)
if (Event_RegimenDeleteUpdate != null)
Event_RegimenDeleteUpdate(this, e);
public void Trigger_Event_RegimenSequenceOrderUpdate(DataEventArgs e)
//Forecast level synchronization
public void Trigger_Event_PricingDrugAddOrDelete(DataEventArgs e)
if (Event_PricingDrugAddOrDelete != null)
Event_PricingDrugAddOrDelete(this, e);
public void Trigger_Event_CountryAddOrDelete(DataEventArgs e)
if (Event_CountryAddOrDelete != null)
Event_CountryAddOrDelete(this, e);
public void Trigger_Event_PopulationAddOrDelete(DataEventArgs e)
if (Event_PopulationAddOrDelete != null)
Event_PopulationAddOrDelete(this, e);
public void Trigger_Event_TimelineAddOrDelete(DataEventArgs e)
if (Event_TimelineAddOrDelete != null)
Event_TimelineAddOrDelete(this, e);
public void Trigger_Event_DrugClassMappingUpdate(DataEventArgs e)
if (Event_DrugClassMappingUpdate != null)
Event_DrugClassMappingUpdate(this, e);
public class DataEventArgs : EventArgs
public PatientShareDependency[] patientShareDependencyList = null;
public PatientShare[] patientShareList = null;
public PatientShare patientShare = null;
public frmMain form = null; // main form
public PricingDrugCurrentTherapyDosing pricingDrugCurrentTherapyDosing = null;
public Epi epi = null;
public MarketForecastAdjustment marketForecastAjustment = null;
public ForecastAdjustment ForecastAdjustment = null;
public int PricingDrugID = 0;
public int CountryID = 0;
public int ForecastCountryID = 0;
public int RegimenID = 0;
public int PopulationID = 0;
Hi,
For a situation such as this, I would like to suggest running your application through a profiler software application. It can indicate memory usage performance bottlenecks, and other metrics that can point you to an area of the application that may be responsible. Something like this may not be 100% apparent from reviewing the code, especially if the condition deteriorates after several hours of use.