public void ensureProperDeserialization(StreamingContext sc) { if (channelCollections == null) { channelCollections = new Dictionary <HardwareChannel.HardwareConstants.ChannelTypes, ChannelCollection>(); } else { channelCollections.OnDeserialization(this); } foreach (HardwareChannel.HardwareConstants.ChannelTypes ct in HardwareChannel.HardwareConstants.allChannelTypes) { if (!channelCollections.ContainsKey(ct)) { ChannelCollection dc = new ChannelCollection(); channelCollections.Add(ct, dc); } } }
/// <summary> /// In the small AddDevice form, everything begins as soon as the user specifies which ChannelType is to /// be modified. /// </summary> private void deviceTypeCombo_SelectedIndexChanged(object sender, EventArgs e) { // Point to the correct DeviceCollection string selectedTypeString = this.deviceTypeCombo.SelectedItem.ToString(); selectedChannelType = HardwareChannel.HardwareConstants.ParseChannelTypeFromString(selectedTypeString); selectedChannelCollection = Storage.settingsData.logicalChannelManager.GetDeviceCollection(selectedChannelType); // Initialize and enable the Name, Description text entries and the HardwareChannel drop-down list this.deviceNameText.Enabled = true; this.deviceDescText.Enabled = true; refreshHardwareChanCombo(); this.availableHardwareChanCombo.Enabled = true; // Indicate the logical ID to be used this.logicalIDText.Text = selectedChannelCollection.GetNextSuggestedKey().ToString(); okButton.Enabled = true; // Now we can allow the OK button if (selectedChannelType == HardwareChannel.HardwareConstants.ChannelTypes.analog) { checkBox1.Visible = true; } else { checkBox1.Visible = false; } if (selectedChannelType == HardwareChannel.HardwareConstants.ChannelTypes.analog || selectedChannelType == HardwareChannel.HardwareConstants.ChannelTypes.digital) { togglingCheck.Visible = true; } else { togglingCheck.Visible = false; } }
/// <summary> /// Helper function for findMyChannels. If a channel is found that is not contained in the current list of exportable channels, /// then that channel is returned as an error. /// </summary> /// <param name="collection"></param> /// <param name="channelMap"></param> private LogicalChannel findChannels(ChannelCollection collection, Dictionary<int, HardwareChannel> channelMap) { foreach (int id in collection.Channels.Keys) { LogicalChannel logical = collection.Channels[id]; if (logical.HardwareChannel != null) { if (!logical.HardwareChannel.isUnAssigned) { if (logical.HardwareChannel.ServerName == this.myServerSettings.ServerName) { if (this.MyHardwareChannels.Contains(logical.HardwareChannel)) { channelMap.Add(id, logical.HardwareChannel); } else { return logical; } } } } } return null; }
public void setChannelCollection(ChannelCollection analogChannelCollection) { this.analogChannelCollection = analogChannelCollection; this.layoutGroupChannelSelectors(); }
public void setChannelCollection(ChannelCollection gpibChannelCollection) { this.gpibChannelCollection = gpibChannelCollection; this.layoutGroupChannelSelectors(); }
public void ensureProperDeserialization(StreamingContext sc) { if (channelCollections == null) { channelCollections = new Dictionary<HardwareChannel.HardwareConstants.ChannelTypes, ChannelCollection>(); } else { channelCollections.OnDeserialization(this); } foreach (HardwareChannel.HardwareConstants.ChannelTypes ct in HardwareChannel.HardwareConstants.allChannelTypes) { if (!channelCollections.ContainsKey(ct)) { ChannelCollection dc = new ChannelCollection(); channelCollections.Add(ct, dc); } } }