Databindings.Add真的很慢

时间:2012-06-27 15:31:36

标签: c# .net winforms data-binding

我昨天问了一个问题并提供参考:Keeping track of 40+ control values

我将一堆控件绑定到属性类;但是,它确实减慢了应用程序的GUI部分。例如,使用以下代码:

        numericUpDownPhysicalAIs.DataBindings.Add("Value", configurationValues, "PhysicalAIs");
        numericUpDownInternalAIs.DataBindings.Add("Value", configurationValues, "InteralAIs");
        numericUpDownPhysicalAOs.DataBindings.Add("Value", configurationValues, "PhysicalAOs");
        numericUpDownInternalAOs.DataBindings.Add("Value", configurationValues, "InternalAOs");
        numericUpDownSetpoints.DataBindings.Add("Value", configurationValues, "Setpoints");
        numericUpDownIndexRegisters.DataBindings.Add("Value", configurationValues, "IndexRegisters");
        numericUpDownNetworkID.DataBindings.Add("Value", configurationValues, "NetworkID");
        numericUpDownQuiescentOperationStartupDelay.DataBindings.Add("Value", configurationValues, "QuiescentOperationStartupDelay");
        numericUpDownQuiescentTelemetryTable.DataBindings.Add("Value", configurationValues, "QuiescentTelemetryTableScanRate");
        numericUpDownPercentQuiescentThreshold.DataBindings.Add("Value", configurationValues, "PercentQuiescentThreshold");
        numericUpDownPercentageOfQuiescentInterval.DataBindings.Add("Value", configurationValues, "PercentQuiescentInterval");
        numericUpDownAODayWeek.DataBindings.Add("Value", configurationValues, "AODayWeek");
        numericUpDownAODayMonth.DataBindings.Add("Value", configurationValues, "AODayMonth");
        numericUpDownAOMonthYear.DataBindings.Add("Value", configurationValues, "AOMonthYear");
        numericUpDownAOYear.DataBindings.Add("Value", configurationValues, "AOYear");
        numericUpDownTimeDay.DataBindings.Add("Value", configurationValues, "TimeDay");
        numericUpDownDebugStatementNumberSetpoint.DataBindings.Add("Value", configurationValues, "DebugStatementNumberSetpoint");
        numericUpDownTelemetryControlSetpoint.DataBindings.Add("Value", configurationValues, "TelemetryControlSetpoint");
        numericUpDownCommunicationFailDI.DataBindings.Add("Value", configurationValues, "CommunicationFailDI");
        numericUpDownCommunicationFailAddressAO.DataBindings.Add("Value", configurationValues, "CommunicationFailAddressAO");
        numericUpDownAddressUnreachableAO.DataBindings.Add("Value", configurationValues, "AddressUnreachableUnitAO");
        numericUpDownPowerCountAO.DataBindings.Add("Value", configurationValues, "PowerCountAO");
        numericUpDownResetCountAO.DataBindings.Add("Value", configurationValues, "ResetCountAO");
        numericUpDownRandomNumberAO.DataBindings.Add("Value", configurationValues, "RandomNumberAO"); 

表格显示所有数字上/下框需要30秒到一分钟。如果我将此代码注释掉,GUI会立即弹出。这是DataBindings.Add方法的限制吗?

由于

0 个答案:

没有答案