Пример #1
0
        /// <summary>
        /// Constructor for the AddDevice form. The ChannelManager parameter is used so that the AddDevice form can
        /// fetch information from the owner ChannelManager form.
        /// </summary>
        public AddDevice(ChannelManager cm)
        {
            InitializeComponent();
            this.cm = cm;   // We create the appropriate reference to the parent form ChannelManager.
                            // In particular so that we can access its availableHardwareChannels list

            okButton.Enabled = false; // We do not enable the OK button, until the user has selected a device type

            // Add entries to the deviceTypeCombo
            foreach (HardwareChannel.HardwareConstants.ChannelTypes ct in HardwareChannel.HardwareConstants.allChannelTypes)
                this.deviceTypeCombo.Items.Add(ct);
        }
Пример #2
0
        public EditDevice(SelectedDevice sd, ChannelManager cm)
        {
            InitializeComponent();

            this.cm = cm;
            this.sd = sd;

            // Initialize the fields with relevant information
            this.logicalIDText.Text = sd.logicalID.ToString();
            this.deviceTypeText.Text = sd.channelTypeString;
            this.deviceNameText.Text = sd.lc.Name;
            this.deviceDescText.Text = sd.lc.Description;

            this.availableHardwareChanCombo.Items.Clear();
            this.availableHardwareChanCombo.Items.Add(HardwareChannel.Unassigned);
            if (sd.lc.HardwareChannel!=null)
                this.availableHardwareChanCombo.Items.Add(sd.lc.HardwareChannel);

            // Fill the availableHardwareChanCombo with relevant items
            foreach (HardwareChannel hc in cm.knownHardwareChannels)
                if (hc.ChannelType == sd.channelType)
                    if (!Storage.settingsData.logicalChannelManager.AssignedHardwareChannels.Contains(hc))
                        this.availableHardwareChanCombo.Items.Add(hc);

            this.availableHardwareChanCombo.SelectedItem = sd.lc.HardwareChannel;

            togglingCheck.Checked = sd.lc.TogglingChannel;

            if (sd.channelType == HardwareChannel.HardwareConstants.ChannelTypes.analog)
            {
                checkBox1.Visible = true;
            }
            else
            {
                checkBox1.Visible = false;
            }

            if (sd.channelType == HardwareChannel.HardwareConstants.ChannelTypes.analog ||
                sd.channelType == HardwareChannel.HardwareConstants.ChannelTypes.digital)
            {
                togglingCheck.Visible = true;
            }
            else
            {
                togglingCheck.Visible = false;
            }

            checkBox1.Checked = sd.lc.AnalogChannelOutputNowUsesDwellWord;
        }
 private void editLogicalDevicesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ChannelManager.ChannelManager logicalChannelManager =
         new ChannelManager.ChannelManager();
     logicalChannelManager.ShowDialog();
 }