public BitViewModel(BITOptionWrapper options, int bitIndex)
        {
            if (options == null) throw new ArgumentNullException(nameof(options));

            _options = options;
            _bitIndex = bitIndex;
        }
        internal BitFieldOptionsViewModel(BITOptionWrapper options)
        {
            _options = options;

            OkCommand = new RelayCommand(Ok, CanOk);
            CancelCommand = new RelayCommand(Cancel);

            var bitIndexRange = Enumerable.Range(0, options.NumberOfBits);

            _bitNameViewModels = bitIndexRange
                .Select(bitIndex => new BitViewModel(options, bitIndex))
                .ToArray();
        }
        public override sealed FieldOptionModel[] EditOptions(FieldOptionModel[] options)
        {
            var optionsWrapper = new BITOptionWrapper(options, _numberOfBits);

            var viewModel = new BitFieldOptionsViewModel(optionsWrapper);

            var view = new BITFieldOptionsView()
            {
                DataContext = viewModel
            };

            if (view.ShowDialog() == true)
            {
                return optionsWrapper.GetOptions();
            }

            return null;
        }
        protected BITRuntimeFieldBase(FieldModel fieldModel, int numberOfBits)
            : base(fieldModel)
        {
            var optionWrapper = new BITOptionWrapper(fieldModel.Options, numberOfBits);

            string[] names = optionWrapper.GetNames();

            //Create tuples that contain the display name
            var tuples = names
                .Select(n => new Tuple<string, RuntimeFieldEditor<CheckBox>>(
                    n,
                    new RuntimeFieldEditor<CheckBox>(fieldModel.Name + " - " + n, new CheckBox())))
                .ToArray();

            _allFieldEditors = tuples
                .Select(t => t.Item2)
                .ToArray();

            _displayedFieldEditors = tuples
                .Where(t => !string.IsNullOrWhiteSpace(t.Item1))
                .Select(t => t.Item2)
                .ToArray();
        }