Events 方法作为事件处理程序

Events 方法作为事件处理程序,events,asynchronous,methods,handler,instances,Events,Asynchronous,Methods,Handler,Instances,有人能帮我解决这个问题吗? 我有两门课 public partial class StationTabItem : UserControl { SessionServiceClass.Instance.getHistoricalStationData(Convert.ToUInt32(station.stationNumber), setHistoricalStationData); public void setHistoricalStationData(object sender

有人能帮我解决这个问题吗? 我有两门课

public partial class StationTabItem : UserControl

{
SessionServiceClass.Instance.getHistoricalStationData(Convert.ToUInt32(station.stationNumber), setHistoricalStationData);    
 public void setHistoricalStationData(object sender, readStationDataHistoryCompletedEventArgs e)
    {

        if (!e.Cancelled && (e.Error == null))
        {
            historicalStationData = new List<StationData>();
            historicalStationData = e.Result.ToList();
            fillHistoricalData(historicalStationData);

            InitializeComponent();
            ComboBox_Left.SelectedIndex = leftIndex;
            ComboBox_Right.SelectedIndex = rightIndex;
            TextBlock_StationName.Text = stationName;
            TextBox_DetailsInfo.Text = evidUdajeStanice;
            fillStationData(station);
            updateDataGrids(localDynamicData_weatherData.variables, localDynamicData_alignedSurfaceData.variables, localDynamicData_oppositeSurfaceData.variables);

        }
    }
公共部分类StationTableItem:UserControl
{
SessionServiceClass.Instance.getHistoricalStationData(Convert.ToUInt32(station.stationNumber),setHistoricalStationData);
public void setHistoricalStationData(对象发送方,readStationDataHistoryCompletedEventArgs e)
{
如果(!e.Cancelled&&(e.Error==null))
{
historicalStationData=新列表();
historicalStationData=e.Result.ToList();
填写历史数据(historicalStationData);
初始化组件();
组合框_Left.SelectedIndex=leftIndex;
组合框_Right.SelectedIndex=rightIndex;
TextBlock_StationName.Text=站名;
TextBox_DetailsInfo.Text=evidUdajeStanice;
加油站数据(加油站);
updateDataGrids(localDynamicData\u weatherData.variables、localDynamicData\u alignedSurfaceData.variables、localDynamicData\u OppositieSurfaceData.variables);
}
}
二等舱

public class SessionServiceClass
{
public void getHistoricalStationData(uint stationID, EventHandler<readStationDataHistoryCompletedEventArgs> setHistoricalStationData)
    {
        rwisClient.readStationDataHistoryAsync(stationID, System.DateTime.Today.AddHours(System.DateTime.Now.Hour).AddMinutes(System.DateTime.Now.Minute), -86400);

        rwisClient.readStationDataHistoryCompleted -= setHistoricalStationData;
        rwisClient.readStationDataHistoryCompleted += setHistoricalStationData;

    }
}
公共类SessionServiceClass
{
public void getHistoricalStationData(uint stationID,EventHandler setHistoricalStationData)
{
rwisClient.readStationDataHistoryAsync(stationID,System.DateTime.Today.AddHours(System.DateTime.Now.Hour)。AddMinutes(System.DateTime.Now.Minute),-86400);
rwisClient.readStationDataHistoryCompleted-=setHistoricalStationData;
rwisClient.readStationDataHistoryCompleted+=setHistoricalStationData;
}
}
问题是,如果我创建了更多StationTabItem实例,则每个实例中的每个方法都会调用allways SetHistoricalStationData,但最后一个实例的结果是,e.result。这意味着我的变量historicalStationData会被覆盖,就像它的最后一个值一样。 提前谢谢你的建议