Exemple #1
0
        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)
        {
            sd.lc.Name        = this.deviceNameText.Text;
            sd.lc.Description = this.deviceDescText.Text;
            sd.lc.AnalogChannelOutputNowUsesDwellWord = checkBox1.Checked;
            sd.lc.OrderingGroup = orderingGroups.SelectedItem as String;
            if (turnOffBox.Checked)
            {
                if (!Storage.settingsData.ChannelsToTurnOff[sd.channelType].ContainsKey(sd.logicalID))
                {
                    Storage.settingsData.ChannelsToTurnOff[sd.channelType].Add(sd.logicalID, sd.lc);
                }
            }
            else
            {
                Storage.settingsData.ChannelsToTurnOff[sd.channelType].Remove(sd.logicalID);
            }

            if (this.availableHardwareChanCombo.SelectedItem is HardwareChannel)
            {
                sd.lc.HardwareChannel = (HardwareChannel)this.availableHardwareChanCombo.SelectedItem;
            }
            else
            {
                sd.lc.HardwareChannel = HardwareChannel.Unassigned;
            }

            // Visual feedback
            cm.RefreshLogicalDeviceDataGrid();

            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();
        }
Exemple #4
0
        private void okButton_Click(object sender, EventArgs e)
        {
            sd.lc.Name        = this.deviceNameText.Text;
            sd.lc.Description = this.deviceDescText.Text;
            sd.lc.AnalogChannelOutputNowUsesDwellWord = checkBox1.Checked;

            if (this.availableHardwareChanCombo.SelectedItem is HardwareChannel)
            {
                sd.lc.HardwareChannel = (HardwareChannel)this.availableHardwareChanCombo.SelectedItem;
            }
            else
            {
                sd.lc.HardwareChannel = HardwareChannel.Unassigned;
            }

            // Visual feedback
            cm.RefreshLogicalDeviceDataGrid();

            this.Close();
        }