Пример #1
0
        public void BindUiControls()
        {
            //URL fields:

            URLUCValueExpression.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.EndPointURL), true, false, UCValueExpression.eBrowserType.Folder);
            URLUserUCValueExpression.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.URLUser), true, false, UCValueExpression.eBrowserType.Folder);
            URLDomainUCValueExpression.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.URLDomain), true, false, UCValueExpression.eBrowserType.Folder);
            URLPasswordUCValueExpression.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.URLPass), true, false, UCValueExpression.eBrowserType.Folder);

            //Network Credential selection radio button:
            NetworkCredentialsRadioButton.Init(typeof(ApplicationAPIUtils.eNetworkCredentials), NetworkCeredentials, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.NetworkCredentialsRadioButton, ApplicationAPIUtils.eNetworkCredentials.Default.ToString()), NetworkCreds_SelectionChanged);

            //Request Body Selection radio button:
            RequestBodyTypeRadioButton.Init(typeof(ApplicationAPIUtils.eRequestBodyType), BodySelection, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.RequestBodyTypeRadioButton, ApplicationAPIUtils.eRequestBodyType.FreeText.ToString()), RequestBodyType_Selection);

            //CertficiateRadioButtons :
            CertificateTypeRadioButton.Init(typeof(ApplicationAPIUtils.eCretificateType), CertificateSelection, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.CertificateTypeRadioButton, ApplicationAPIUtils.eCretificateType.AllSSL.ToString()), CertificateSelection_Changed);

            //Response validation checkbox:
            GingerCore.GeneralLib.BindingHandler.ActInputValueBinding(DoNotFailActionOnBadRespose, CheckBox.IsCheckedProperty, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.DoNotFailActionOnBadRespose, "False"));

            //Use Legacy JSON Parsing
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(UseLegacyJSONParsingCheckBox, CheckBox.IsCheckedProperty, mAct, ActWebAPIBase.Fields.UseLegacyJSONParsing);

            //Request Body fields:
            RequestBodyUCValueExpression.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.RequestBody), true, false, UCValueExpression.eBrowserType.Folder, "*", null);
            RequestBodyUCValueExpression.AdjustHight(200);
            RequestBodyUCValueExpression.ValueTextBox.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;

            //Import Request File
            GingerCore.GeneralLib.BindingHandler.ActInputValueBinding(DoNotImportRequestFile, CheckBox.IsCheckedProperty, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.ImportRequestFile, "False"));

            //SSL Certificates:
            CertificatePath.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.CertificatePath), true, true, UCValueExpression.eBrowserType.File, "*.*", new RoutedEventHandler(BrowseSSLCertificate));
            CertificatePasswordUCValueExpression.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.CertificatePassword), true, false, UCValueExpression.eBrowserType.Folder);

            //Import Certificate
            GingerCore.GeneralLib.BindingHandler.ActInputValueBinding(DoNotCertificateImportFile, CheckBox.IsCheckedProperty, mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.ImportCetificateFile, "False"));

            //Security:
            SecurityTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.SecurityType, ApplicationAPIUtils.eSercurityType.None.ToString()), typeof(ApplicationAPIUtils.eSercurityType), false, null);

            //Authorization:
            AuthTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.AuthorizationType, ApplicationAPIUtils.eAuthType.NoAuthentication.ToString()), typeof(ApplicationAPIUtils.eAuthType), false, AuthorizationBox);

            //Authorization
            AuthUserUCValueExpression.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.AuthUsername), true, false, UCValueExpression.eBrowserType.Folder);
            AuthPasswordUCValueExpression.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.AuthPassword), true, false, UCValueExpression.eBrowserType.Folder);

            DynamicElementsGrid.Init(Context.GetAsContext(mAct.Context), mAct.DynamicElements, "Body Content Parameters", "Place Holder", "Value", "Calculated Value");

            HttpHeadersGrid.Init(Context.GetAsContext(mAct.Context), mAct.HttpHeaders, "Request Headers", "Header", "Value", "Calculated Value");

            //FormDataGrid.btnAdd.AddHandler(Button.ClickEvent, new RoutedEventHandler(AddRow));
            SetKeyValuesGrid(mAct.RequestKeyValues);

            CheckNetworkCredentials();
            CheckRequestBodySelection();
            CheckCertificateSelection();
        }
Пример #2
0
        public void BindUiControls()
        {
            //URL fields:
            ControlsBinding.ObjFieldBinding(EndPointURLTextBox, TextBox.TextProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.EndpointURL));
            ControlsBinding.ObjFieldBinding(URLUserTextBox, TextBox.TextProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.URLUser));
            ControlsBinding.ObjFieldBinding(URLDomainTextBox, TextBox.TextProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.URLDomain));
            ControlsBinding.ObjFieldBinding(URLPasswordTextBox, TextBox.TextProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.URLPass));

            //Network Credential selection radio button:
            switch (mApplicationAPIModel.NetworkCredentials)
            {
            case ApplicationAPIUtils.eNetworkCredentials.Default:
                DefaultNetworkCredentialsRadioButton.IsChecked = true;
                break;

            case ApplicationAPIUtils.eNetworkCredentials.Custom:
                CustomNetworkCredentialsRadioButton.IsChecked = true;
                break;
            }

            //Request Body Selection radio button:
            switch (mApplicationAPIModel.RequestBodyType)
            {
            case ApplicationAPIUtils.eRequestBodyType.FreeText:
                FreeTextRadioButton.IsChecked = true;
                break;

            case ApplicationAPIUtils.eRequestBodyType.TemplateFile:
                TemplateFileRadioButton.IsChecked = true;
                break;
            }

            //CertficiateRadioButtons :
            switch (mApplicationAPIModel.CertificateType)
            {
            case ApplicationAPIUtils.eCretificateType.AllSSL:
                SSLCertificateTypeAllCertificatesRadioButton.IsChecked = true;
                break;

            case ApplicationAPIUtils.eCretificateType.Custom:
                SSLCertificateTypeCustomRadioButton.IsChecked = true;
                break;
            }

            //Do Not Fail Action On Bad Response
            GingerWPF.BindingLib.ControlsBinding.ObjFieldBinding(DoNotFailActionOnBadRespose, CheckBox.IsCheckedProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.DoNotFailActionOnBadRespose));

            //Request Body fields:
            ControlsBinding.ObjFieldBinding(RequestBodyTextBox, TextBox.TextProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.RequestBody));
            RequestBodyTextBox.Height = 200;

            //Import Request File
            GingerWPF.BindingLib.ControlsBinding.ObjFieldBinding(DoNotImportRequestFile, CheckBox.IsCheckedProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.ImportRequestFile));

            //SSL Certificates:
            ControlsBinding.ObjFieldBinding(CertificatePath, TextBox.TextProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.CertificatePath));
            ControlsBinding.ObjFieldBinding(CertificatePasswordUCValueExpression, TextBox.TextProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.CertificatePassword));

            //Import Certificate
            GingerWPF.BindingLib.ControlsBinding.ObjFieldBinding(DoNotCertificateImportFile, CheckBox.IsCheckedProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.ImportCetificateFile));

            //Security:
            SecurityTypeComboBox.Init(mApplicationAPIModel, nameof(mApplicationAPIModel.SecurityType), typeof(ApplicationAPIUtils.eSercurityType));
            SecurityTypeComboBox.ComboBox.Style = this.FindResource("$FlatInputComboBoxStyle") as Style;

            //Authorization:
            AuthTypeComboBox.Init(mApplicationAPIModel, nameof(mApplicationAPIModel.AuthorizationType), typeof(ApplicationAPIUtils.eAuthType), false, AuthorizationBox);
            AuthTypeComboBox.ComboBox.Style = this.FindResource("$FlatInputComboBoxStyle") as Style;
            ControlsBinding.ObjFieldBinding(AuthUserTextBox, TextBox.TextProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.AuthUsername));
            ControlsBinding.ObjFieldBinding(AuthPasswordTextBox, TextBox.TextProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.AuthPassword));

            SetHTTPHeadersGrid();
            SetKeyValuesGrid();
            CheckRequestBodySelection();
            CheckCertificateSelection();
        }