private void updateElements() { updatingPulse = true; if (pulse != null) { // TODO: TIMUR // Read and understand this if-else code, // then delete this comment. if (pulse.AutoName) { pulseNameTextBox.Enabled = false; pulse.updateAutoName(); pulseNameTextBox.Text = pulse.PulseName; } else { pulseNameTextBox.Enabled = true; } if (pulse.startCondition == Pulse.PulseTimingCondition.Duration) { this.startDelayTime.Enabled = false; this.startDelayEnabled.Enabled = false; this.startDelayed.Enabled = false; } else { this.startDelayTime.Enabled = true; this.startDelayEnabled.Enabled = true; if (this.startDelayEnabled.Checked) { this.startDelayed.Enabled = true; this.startDelayTime.Enabled = true; } else { this.startDelayed.Enabled = false; this.startDelayTime.Enabled = false; } } if (pulse.endCondition == Pulse.PulseTimingCondition.Duration) { this.endDelayTime.Enabled = false; this.endDelayEnabled.Enabled = false; this.endDelayed.Enabled = false; } else { this.endDelayTime.Enabled = true; this.endDelayEnabled.Enabled = true; if (endDelayEnabled.Checked) { endDelayTime.Enabled = true; endDelayed.Enabled = true; } else { endDelayTime.Enabled = false; endDelayed.Enabled = false; } } if (pulse.endCondition == Pulse.PulseTimingCondition.Duration || pulse.startCondition == Pulse.PulseTimingCondition.Duration) { this.pulseDuration.Enabled = true; } else { this.pulseDuration.Enabled = false; } string dataValidityText = pulse.dataInvalidUICue(); if (dataValidityText == null) { this.validityLabel.Text = "Data valid"; } else { this.validityLabel.Text = dataValidityText; } } else { foreach (Control con in this.Controls) { con.Enabled = false; } } updatingPulse = false; }