コード例 #1
0
 public void RegisterControls(IControlFactory controlFactory)
 {
     _controlManager.Register("MainWindow", _mainWindow);
     _controlManager.Register("LoginControl", controlFactory.Create <LoginControl>());
     _controlManager.Register("RegisterControl", controlFactory.Create <RegisterControl>());
     _controlManager.Register("DashboardControl", controlFactory.Create <DashboardControl>());
 }
コード例 #2
0
        private void CreateInputs()
        {
            TextBox CreateTextInput()
            {
                var textBox = _controlFactory.Create <TextBox>();

                return(textBox);
            }

            _filenameInput = CreateTextInput();
            _passwordInput = CreateTextInput();
            //_passwordInput.IsEnabled = false;
        }
コード例 #3
0
        public IForm Create(BizFormInfo info)
        {
            if (info == null)
            {
                return(new Form());
            }

            var autoresponder = new Autoresponder
            {
                Sender   = info.FormConfirmationSendFromEmail,
                Subject  = info.FormConfirmationEmailSubject,
                Template = info.FormConfirmationTemplate
            };

            var notification = new Notification
            {
                Sender     = info.FormSendFromEmail,
                Recipients = info.FormSendToEmail,
                Subject    = info.FormEmailSubject,
                Template   = info.FormEmailTemplate,
                AttachUploadedDocuments = info.FormEmailAttachUploadedDocs
            };

            var submissionOptions = new SubmissionOptions
            {
                DisplayText    = info.FormDisplayText,
                ClearAfterSave = info.FormClearAfterSave,
                RedirectUrl    = info.FormRedirectToUrl
            };

            var hasAutoResponder     = !String.IsNullOrWhiteSpace(autoresponder.Sender);
            var hasNotificationEmail = !String.IsNullOrWhiteSpace(notification.Sender) && !String.IsNullOrWhiteSpace(notification.Recipients);

            var form = new Form
            {
                Name              = info.FormName,
                SubmitText        = !string.IsNullOrEmpty(info.FormSubmitButtonText) ? info.FormSubmitButtonText : "Save",
                Autoresponder     = hasAutoResponder ? autoresponder : null,
                Notification      = hasNotificationEmail ? notification : null,
                SubmissionOptions = submissionOptions
            };

            foreach (var controlInfo in info.Form.GetFields(true, false))
            {
                var control = _controlFactory.Create(controlInfo);
                if (control == null)
                {
                    continue;
                }

                form.Controls.Add(control);
            }

            return(form);
        }
コード例 #4
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;
        }