private void okButton_Click(object sender, EventArgs e) { // Construct the logical channel LogicalChannel lc = new LogicalChannel(); lc.Name = this.deviceNameText.Text; lc.Description = this.deviceDescText.Text; lc.AnalogChannelOutputNowUsesDwellWord = checkBox1.Checked; lc.TogglingChannel = togglingCheck.Checked; if (this.availableHardwareChanCombo.SelectedItem is HardwareChannel) { lc.HardwareChannel = (HardwareChannel)this.availableHardwareChanCombo.SelectedItem; } else { lc.HardwareChannel = HardwareChannel.Unassigned; } // Add to the appropriate collection selectedChannelCollection.AddChannel(lc); // Refresh the screen of the ChannelManager for visual feedback cm.RefreshLogicalDeviceDataGrid(); // Close this.Close(); }
private void okButton_Click(object sender, EventArgs e) { // Construct the logical channel LogicalChannel lc = new LogicalChannel(); lc.Name = this.deviceNameText.Text; lc.Description = this.deviceDescText.Text; lc.AnalogChannelOutputNowUsesDwellWord = checkBox1.Checked; lc.TogglingChannel = togglingCheck.Checked; int ID = selectedChannelCollection.GetNextSuggestedKey(); lc.OrderingGroup = orderingGroups.SelectedItem as String; //If turnOffBox is checked, add this channel to the set of channels to be turned off //if the analog input check fails if (turnOffBox.Checked) { if (!Storage.settingsData.ChannelsToTurnOff[lc.HardwareChannel.ChannelType].ContainsKey(ID)) { Storage.settingsData.ChannelsToTurnOff[lc.HardwareChannel.ChannelType].Add(ID, lc); } } else { Storage.settingsData.ChannelsToTurnOff[lc.HardwareChannel.ChannelType].Remove(ID); } if (this.availableHardwareChanCombo.SelectedItem is HardwareChannel) { lc.HardwareChannel = (HardwareChannel)this.availableHardwareChanCombo.SelectedItem; } else { lc.HardwareChannel = HardwareChannel.Unassigned; } // Add to the appropriate collection selectedChannelCollection.AddChannel(lc); // Refresh the screen of the ChannelManager for visual feedback cm.RefreshLogicalDeviceDataGrid(); // Close this.Close(); }