public override void ConfigChannel(object chObject) { DigitizerInfo.ChannelConfig ch = (DigitizerInfo.ChannelConfig)chObject; if (ch.EnableCh) { if (aiTask.Channels.Exists(x => x.ChannelID == ch.ChNum)) { aiTask.Channels.Find(x => x.ChannelID == ch.ChNum).RangeHigh = double.Parse(ch.Range); aiTask.Channels.Find(x => x.ChannelID == ch.ChNum).RangeLow = double.Parse(ch.Range) * (-1); aiTask.Channels.Find(x => x.ChannelID == ch.ChNum).Coupling = (AICoupling)Enum.Parse(typeof(AICoupling), ch.Coupling); aiTask.Channels.Find(x => x.ChannelID == ch.ChNum).Impedance = (AIImpedance)Enum.Parse(typeof(AIImpedance), ch.Impedance); } else { aiTask.AddChannel( ch.ChNum, double.Parse(ch.Range) * (-1), double.Parse(ch.Range), (AICoupling)Enum.Parse(typeof(AICoupling), ch.Coupling), (AIImpedance)Enum.Parse(typeof(AIImpedance), ch.Impedance) ); } } else { aiTask.RemoveChannel(ch.ChNum); } }
public override BindingList <object> GetChannelMap() { BindingList <object> list = new BindingList <object>(); for (int i = 0; i < DigitizerInformation.MaxChannels; i++) { DigitizerInfo.ChannelConfig ch = new DigitizerInfo.ChannelConfig(); ch.ConfigureLUT("Range", DigitizerInformation.Ranges); ch.ConfigureLUT("Impedance", DigitizerInformation.Impedances); ch.ConfigureLUT("Coupling", DigitizerInformation.Couplings); ch.EnableCh = false; ch.ChNum = i; ch.Range = DigitizerInformation.Ranges[0]; ch.Impedance = DigitizerInformation.Impedances[0]; ch.Coupling = DigitizerInformation.Couplings[0]; list.Add(ch); } return(list); }