예제 #1
0
        private void CreateCheckBoxes()
        {
            CheckBox Init(string title)
            {
                var checkBox = _controlFactory.Create <CheckBox>();

                checkBox.Text = title;
                checkBox.Margin.SetTopAndBottom(5);
                return(checkBox);
            }

            _encryptionCheckBox           = Init("Encryption ?");
            _encryptionCheckBox.IsChecked = true;
            _pbeCheckBox       = Init("PBE ?");
            _integrityCheckBox = Init("Integrity ?");

            var isEncryptActiveProperty = new PropertyWrapper <CryptoConfig, bool>(_config,
                                                                                   p => p.IsEncryptActive, (p, v) => p.IsEncryptActive = v);

            isEncryptActiveProperty.BindTo(_encryptionCheckBox.PropertyIsChecked);
            _encryptionCheckBox.InputState.Clicked += ToggleEncryptionSection;

            var isPbeActiveProperty = new PropertyWrapper <CryptoConfig, bool>(_config,
                                                                               p => p.IsPbeActive, (p, v) => p.IsPbeActive = v);

            isPbeActiveProperty.BindTo(_pbeCheckBox.PropertyIsChecked);
            _pbeCheckBox.InputState.Clicked += TogglePbeSection;
            _pbeCheckBox.PropertyIsChecked.PropertyChanged += OnPbeCheckBoxIsCheckedChanged;

            var isIntegrityActiveProperty = new PropertyWrapper <CryptoConfig, bool>(_config,
                                                                                     p => p.IsIntegrityActive, (p, v) => p.IsIntegrityActive = v);

            isIntegrityActiveProperty.BindTo(_integrityCheckBox.PropertyIsChecked);
            _integrityCheckBox.InputState.Clicked += ToggleIntegritySection;
        }