Ejemplo n.º 1
0
        public ActRESTEditPage(ActREST a)
        {
            InitializeComponent();

            mActREST = a;
            URLUCValueExpression.Init(Context.GetAsContext(mActREST.Context), mActREST.EndPointURL);
            URLDomainUCValueExpression.Init(Context.GetAsContext(mActREST.Context), mActREST.URLDomain, nameof(ActInputValue.Value));
            URLPasswordUCValueExpression.Init(Context.GetAsContext(mActREST.Context), mActREST.URLPass, nameof(ActInputValue.Value));
            URLUserUCValueExpression.Init(Context.GetAsContext(mActREST.Context), mActREST.URLUser, nameof(ActInputValue.Value));
            RequestBodyUCValueExpression.Init(Context.GetAsContext(mActREST.Context), mActREST.RequestBody);
            RequestRespondXmlSaveTextBox.Init(Context.GetAsContext(mActREST.Context), mActREST.SaveRequestResponseFolderPath);

            TemplateFileNameFileBrowser.Init(Context.GetAsContext(mActREST.Context), mActREST.TemplateFile);
            GingerCore.General.FillComboFromEnumObj(RequestTypeComboBox, mActREST.RequestType);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(RequestTypeComboBox, ComboBox.TextProperty, mActREST, ActREST.Fields.RequestType);

            //httpversion content type
            GingerCore.General.FillComboFromEnumObj(HttpVersioncombobox, mActREST.ReqHttpVersion);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(HttpVersioncombobox, ComboBox.SelectedValueProperty, mActREST, ActREST.Fields.ReqHttpVersion);

            //Request content type
            GingerCore.General.FillComboFromEnumObj(ContentTypeComboBox, mActREST.ContentType);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ContentTypeComboBox, ComboBox.SelectedValueProperty, mActREST, ActREST.Fields.ContentType);

            //Response Content Type
            GingerCore.General.FillComboFromEnumObj(ResponseTypeComboBox, mActREST.ResponseContentType);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ResponseTypeComboBox, ComboBox.SelectedValueProperty, mActREST, ActREST.Fields.ResponseContentType);
            //Security Type
            GingerCore.General.FillComboFromEnumObj(SecurityTypeComboBox, mActREST.SecurityType);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(SecurityTypeComboBox, ComboBox.SelectedValueProperty, mActREST, ActREST.Fields.SecurityType);

            //Cookie Mode
            GingerCore.General.FillComboFromEnumObj(CookieMode, mActREST.CookieMode);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(CookieMode, ComboBox.SelectedValueProperty, mActREST, ActREST.Fields.CookieMode);

            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(restRequest, CheckBox.IsCheckedProperty, mActREST, ActREST.Fields.RestRequestSave);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(restResponse, CheckBox.IsCheckedProperty, mActREST, ActREST.Fields.RestResponseSave);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(templateFileRadioBtn, RadioButton.IsCheckedProperty, mActREST, ActREST.Fields.UseRequestBody);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(freeBodyRadioBtn, RadioButton.IsCheckedProperty, mActREST, ActREST.Fields.UseTemplateFile);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(RestFailActionOnBadRespose, CheckBox.IsCheckedProperty, mActREST, ActREST.Fields.DoNotFailActionOnBadRespose);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(AcceptAllSSLCertificate, CheckBox.IsCheckedProperty, mActREST, ActREST.Fields.AcceptAllSSLCertificate);

            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xUseLegacyJSONParsingCheckBox, CheckBox.IsCheckedProperty, mActREST, ActREST.Fields.UseLegacyJSONParsing);

            SetDynamicGrid();

            DynamicElementsGrid.btnAdd.AddHandler(Button.ClickEvent, new RoutedEventHandler(AddDynamicXMLelement));

            SetHeadersGrid();
            HttpHeadersGrid.btnAdd.AddHandler(Button.ClickEvent, new RoutedEventHandler(AddHttpHeader));
        }
Ejemplo n.º 2
0
        private void InitializeUIByActionType()
        {
            switch (mWebApiType)
            {
            case ApplicationAPIUtils.eWebApiType.REST:
                //binding
                //setting visibility :
                PanelSoap.Visibility           = Visibility.Collapsed;
                UseWSSecurityHeader.Visibility = Visibility.Collapsed;
                //Cookie Mode
                CookieMode.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.CookieMode, ApplicationAPIUtils.eCookieMode.New.ToString()), typeof(ApplicationAPIUtils.eCookieMode), false, null);

                //Request Type
                RequestTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.RequestType, ApplicationAPIUtils.eRequestType.GET.ToString()), typeof(ApplicationAPIUtils.eRequestType), false, null);

                //HttpVersion content type
                HttpVersioncombobox.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.ReqHttpVersion, ApplicationAPIUtils.eHttpVersion.HTTPV11.ToString()), typeof(ApplicationAPIUtils.eHttpVersion), false, null);

                //Request content type
                ContentTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.ContentType, ApplicationAPIUtils.eContentType.JSon.ToString()), typeof(ApplicationAPIUtils.eContentType), false, ContentTypeChange);

                //Response Content Type
                ResponseTypeComboBox.Init(mAct.GetOrCreateInputParam(ActWebAPIRest.Fields.ResponseContentType, ApplicationAPIUtils.eContentType.JSon.ToString()), typeof(ApplicationAPIUtils.eContentType), false, ResponseTypeComboBox_SelectionChanged);

                //Request Template file:
                TemplateFileNameFileBrowser.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.TemplateFileNameFileBrowser), true, true, UCValueExpression.eBrowserType.File, "txt; *.xml; *.json;", new RoutedEventHandler(BrowseTemplateFileButton_Click));
                break;

            case ApplicationAPIUtils.eWebApiType.SOAP:
                //binding visibility
                RequestContent.Visibility      = Visibility.Collapsed;
                RestHeader.Visibility          = Visibility.Collapsed;
                UseWSSecurityHeader.Visibility = Visibility.Visible;
                //binding
                //SOAP Action
                SoapActionUCValueExpression.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPISoap.Fields.SOAPAction), true, false, UCValueExpression.eBrowserType.Folder);

                //Request Template file:
                TemplateFileNameFileBrowser.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActWebAPIBase.Fields.TemplateFileNameFileBrowser), true, true, UCValueExpression.eBrowserType.File, "txt; *.xml;", new RoutedEventHandler(BrowseTemplateFileButton_Click));
                break;
            }
        }