Пример #1
0
        public override List <ChannelOption> EnumerateChannelOptions()
        {
            ChannelOptions           = new List <ChannelOption>();
            ChannelDataSourceIndices = new int[4];
            for (int index = 0; index < 4; index++)
            {
                ChannelDataSourceIndices[index] = index;
                ChannelOption ops = new GroupHeadOption("Channel Options");
                typeOp.Add(new GroupHeadOption("Type"));
                //var sourceOp = new GroupHeadOption("Source");
                differentialGainOps.Add(new GroupHeadOption("Input Range"));
                typeOp[index].Parent = ops;
                //sourceOp.Parent = ops;
                differentialGainOps[index].Parent = ops;
                typeOp[index].SubOptions.Add(new ChannelTypeOption(ChannelType.AnalogInDifferential));
                typeOp[index].SubOptions.Add(new ChannelTypeOption(ChannelType.AnalogInRSE));
                typeOp[index].SubOptions[0].Checked = true;

                for (int i = 0; i < 2; i++)
                {
                    typeOp[index].SubOptions[i].MenuItem.Click += TypeChange_Click;
                    typeOp[index].SubOptions[i].Parent          = typeOp[index];
                }
                for (int i = 0; i < 3; i++)
                {
                    var op = new ADCRangeSelectionOption(MaxInputVoltage / SupportedGains[i], true);
                    op.Checked         = i == 0;
                    op.MenuItem.Click += RangeChange_Click;
                    op.Parent          = differentialGainOps[index];
                    differentialGainOps[index].SubOptions.Add(op);
                }

                // RSE gain (only one option)
                var rsegOp = new ADCRangeSelectionOption(MaxInputVoltage / SupportedGains[0], false);
                rsegOp.Checked = true;
                RSEGainOps.Add(new GroupHeadOption("Input Range"));
                rsegOp.Parent = RSEGainOps[index];
                RSEGainOps[index].SubOptions.Add(rsegOp);
                var allInstruments = Instrument.GetInstruments();
                AvailableInstruments.Add(allInstruments.Items);
                //instrumentTypeOps.Add(new GroupHeadOption("Instrument Type"));
                foreach (var iIns in allInstruments.Items)
                {
                    var iOp = iIns.TitleItem;
                    iOp.MenuItem.Click += InstrumentTypeChange_Click;
                    iOp.Parent          = typeOp[index];
                    typeOp[index].SubOptions.Add(iOp);
                }
                // at least, add null.
                SelectedInstruments.Add(null);

                ops.SubOptions.Add(typeOp[index]);
                //ops.SubOptions.Add(sourceOp);
                ops.SubOptions.Add(differentialGainOps[index]);
                ChannelOptions.Add(ops);
                //instrumentTypeOps[index].Parent = ChannelOptions[index];
            }
            return(ChannelOptions);
        }
Пример #2
0
 public InstrumentCollection()
 {
     menuItem = new GroupHeadOption("Instrument Type");
 }