public DigitalOverride(LogicalChannel channel, int channelID)
            : this()
        {
            this.channel = channel;
            this.overrideCheck.Checked = channel.overridden;
            this.valueBox.Checked = channel.digitalOverrideValue;
            if (this.overrideCheck.Checked)
            {
                this.valueBox.Enabled = true;
            }
            else
            {
                this.valueBox.Enabled = false;
            }

            this.label1.Text =  channelID.ToString() + " " + channel.Name;
            toolTip1.SetToolTip(label1, channel.Description);
            if (channel.hotkeyChar != 0)
            {
                this.hotkeyLabel.Text = "{" + channel.hotkeyChar + "}";
            }

            if (channel.overrideHotkeyChar != 0)
            {
                this.overrideHotkeyLabel.Text = "{" + channel.overrideHotkeyChar + "}";
            }
        }
 public GroupChannelSelection()
 {
     InitializeComponent();
     groupChannelData = new AnalogGroupChannelData(null, false, false);
     logicalChannel = new LogicalChannel();
     logicalChannel.Name = "Placeholder Channel";
     this.commonWaveformSelector.Items.Add("Manual");
     this.commonWaveformSelector.SelectedItem = "Manual";
     this.setButtonAppearance();
 }
 public AnalogOverride(LogicalChannel channel, int channelID)
     : this()
 {
     this.channel = channel;
     this.checkBox1.Checked = channel.overridden;
     this.numericUpDown1.Value = (decimal) channel.analogOverrideValue;
     this.numericUpDown1.Enabled = this.checkBox1.Checked;
     toolTip1.SetToolTip(label1, channel.Description);
     label1.Text = channelID.ToString() + " " + channel.Name;
 }
        public GroupChannelSelection(LogicalChannel logicalChannel, AnalogGroupChannelData groupChannelData, int channelID)
            : this()
        {
            this.groupChannelData = groupChannelData;
            setCommonWaveforms();
            layout();

            this.logicalChannel = logicalChannel;
            this.toolTip1.SetToolTip(channelNameLabel, logicalChannel.Description);

            channelNameLabel.Text = channelID.ToString() + " " + logicalChannel.Name;
        }
        public RS232GroupChannelSelection()
        {
            InitializeComponent();
            groupChannelData = new RS232GroupChannelData();
            logicalChannel = new LogicalChannel();
            this.layout();

            foreach (RS232GroupChannelData.RS232DataType type in RS232GroupChannelData.allDataTypes)
            {
                this.dataTypeSelector.Items.Add(type);
            }
        }
        public GpibGroupChannelSelection()
        {
            InitializeComponent();
            groupChannelData = new GPIBGroupChannelData();
            logicalChannel = new LogicalChannel();
            this.layout();

            foreach (GPIBGroupChannelData.GpibChannelDataType type in GPIBGroupChannelData.GpibChannelDataType.allTypes)
            {
                this.dataTypeSelector.Items.Add(type);
            }
        }
 /// <summary>
 /// A poor CompareTo method that treats null as being less than a logical channel, and otherwise the input as > the channel that called this method (unless the two channels are the same).
 /// </summary>
 public int CompareTo(LogicalChannel compareTo)
 {
     if (compareTo == null)
     {
         return(1);
     }
     else if (this == compareTo)
     {
         return(0);
     }
     else
     {
         return(-1);
     }
 }
        public RS232GroupChannelSelection(LogicalChannel logicalChannel, RS232GroupChannelData groupChannelData)
            : this()
        {
            this.groupChannelData = groupChannelData;
            this.logicalChannel = logicalChannel;

            this.toolTip1.SetToolTip(channelNameLabel, logicalChannel.Description);

            this.layout();

            this.dataTypeSelector.Items.Clear();
            foreach (RS232GroupChannelData.RS232DataType type in RS232GroupChannelData.allDataTypes) {
                this.dataTypeSelector.Items.Add(type);
            }
            //this.dataTypeSelector.Items.AddRange(GPIBGroupChannelData.GpibChannelDataType.allTypes);
            this.dataTypeSelector.SelectedItem = groupChannelData.DataType;
            this.rawStringTextBox.Text = groupChannelData.RawString;
        }
        /// <summary>
        /// Compares the channels by the alphabetical position of their names, if they have the same name then by CompareTo for channels.
        /// </summary>
        /// <returns>Returns 1 if channel1 > channel2, -1 if channel2 > channel1, and 0 if channel1 = channel2</returns>
        public int CompareByAlphabeticalPositionTo(LogicalChannel channel, bool useGroups)
        {
            //Check if either channel is null, and treat null as less than an actual channel
            if (this == null && channel == null)
            {
                return(0);
            }
            else if (this == null && channel != null)
            {
                return(-1);
            }
            else if (this != null && channel == null)
            {
                return(1);
            }

            int comparison = 0;

            //If we're sorting with groups, then compare the groups by alphabetical position.
            //Only if the groups are the same will we then compare the channels
            if (useGroups)
            {
                comparison = String.Compare(this.OrderingGroup, channel.OrderingGroup, StringComparison.CurrentCulture);
            }

            //If the ordering groups are the same (or aren't being used),
            //then the channel whose name has an earlier alphabetical position will come first
            if (comparison == 0)
            {
                comparison = String.Compare(this.Name, channel.Name, StringComparison.CurrentCulture);
            }

            //If the names were also the same, then resort to the normal comparison
            if (comparison == 0)
            {
                comparison = this.CompareTo(channel);
            }

            return(comparison);
        }
Esempio n. 10
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();
        }
 public void AddChannel(LogicalChannel lc)
 {
     channels.Add(GetNextSuggestedKey(), lc);
 }
 public void AddChannel(LogicalChannel lc)
 {
     channels.Add(GetNextSuggestedKey(), lc);
 }
 private void EmitLogicalDeviceToGrid(HardwareChannel.HardwareConstants.ChannelTypes ct, int logicalID, LogicalChannel lc)
 {
     string[] row = { ct.ToString(),
                      logicalID.ToString(),
                      lc.Name,
                      lc.Description,
                      lc.HardwareChannel.ToString() };
     logicalDevicesDataGridView.Rows.Add(row);
 }