Ejemplo n.º 1
0
        public POMEditPage(ApplicationPOMModel POM)
        {
            InitializeComponent();
            mPOM = POM;
            ControlsBinding.ObjFieldBinding(xNameTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.Name));
            ControlsBinding.ObjFieldBinding(xDescriptionTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.Description));
            ControlsBinding.ObjFieldBinding(xPageURLTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.PageURL));

            xTargetApplicationComboBox.ComboBox.Style = this.FindResource("$FlatInputComboBoxStyle") as Style;
            FillTargetAppsComboBox();
            xTargetApplicationComboBox.Init(mPOM, nameof(ApplicationPOMModel.TargetApplicationKey));
            xTagsViewer.Init(mPOM.TagsKeys);

            ePlatformType          mAppPlatform       = App.UserProfile.Solution.GetTargetApplicationPlatform(POM.TargetApplicationKey);
            ObservableList <Agent> optionalAgentsList = GingerCore.General.ConvertListToObservableList((from x in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>() where x.Platform == mAppPlatform select x).ToList());

            xAgentControlUC.Init(optionalAgentsList);
            App.ObjFieldBinding(xAgentControlUC, ucAgentControl.SelectedAgentProperty, this, nameof(Agent));

            BitmapSource source = null;

            if (mPOM.ScreenShotImage != null)
            {
                source = Ginger.General.GetImageStream(Ginger.General.Base64StringToImage(mPOM.ScreenShotImage.ToString()));
            }

            mScreenShotViewPage      = new ScreenShotViewPage(mPOM.Name, source);
            xScreenShotFrame.Content = mScreenShotViewPage;

            mPomAllElementsPage      = new PomAllElementsPage(mPOM);
            xUIElementsFrame.Content = mPomAllElementsPage;

            UIElementTabTextBlockUpdate();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Bind the combo box to ObservableList
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="ComboBox"></param>
        /// <param name="obj">Object to bind to</param>
        /// <param name="Field">Object field to bind</param>
        /// <param name="list">List of Observable items to display in the combo box</param>
        /// <param name="DisplayMemberPath">list item field to display</param>
        /// <param name="SelectedValuePath">list item value to to return when selected</param>
        public static void BindControl <T>(this ComboBox ComboBox, Object obj, string Field, ObservableList <T> list, string DisplayMemberPath, string SelectedValuePath, BindingMode bindingMode = BindingMode.TwoWay)
        {
            ControlsBinding.ObjFieldBinding(ComboBox, ComboBox.SelectedValueProperty, obj, Field, bindingMode);

            ComboBox.ItemsSource       = list;
            ComboBox.DisplayMemberPath = DisplayMemberPath;
            ComboBox.SelectedValuePath = SelectedValuePath;
        }
Ejemplo n.º 3
0
 public AddAPIModelSelectTypePage()
 {
     InitializeComponent();
     ControlsBinding.FillComboFromEnumType(APITypeComboBox, typeof(eAPIType), null);
     APITypeComboBox.Style = this.FindResource("$FlatInputComboBoxStyle") as Style;
     APITypeComboBox.Text  = eAPIType.WSDL.ToString();
     XMLTemplatesGrid.SetTitleLightStyle = true;
     SetFieldsGrid();
 }
Ejemplo n.º 4
0
        public AddOptionalValuesModelSelectTypePage(ApplicationAPIModel AAMB)
        {
            InitializeComponent();
            mAAMB = AAMB;
            importOptionalValues.ParameterType = ImportOptionalValuesForParameters.eParameterType.Local;
            ControlsBinding.FillComboFromEnumType(xSourceTypeComboBox, typeof(eSourceType), null);

            xSourceTypeComboBox.Style = this.FindResource("$FlatInputComboBoxStyle") as Style;
            SetFieldsGrid(); //XML & JSON
            SetDefaultPresentation();
        }
Ejemplo n.º 5
0
        public AddOptionalValuesModelSelectTypePage(ObservableList <GlobalAppModelParameter> GlobalParamterList)
        {
            InitializeComponent();
            mGlobalParamterList = GlobalParamterList;
            importOptionalValues.ParameterType = ImportOptionalValuesForParameters.eParameterType.Global;
            ControlsBinding.FillComboFromEnumType(xSourceTypeComboBox, typeof(eSourceType), new List <object>()
            {
                eSourceType.Excel, eSourceType.DB
            });

            xSourceTypeComboBox.Style = this.FindResource("$FlatInputComboBoxStyle") as Style;
            SetFieldsGrid(); //XML & JSON
            SetDefaultPresentation();
        }
Ejemplo n.º 6
0
        public OutputTemplatePage(ApplicationAPIModel applicationAPIModel)
        {
            InitializeComponent();
            mApplicationAPIModel = applicationAPIModel;

            xOutputValuesGrid.AddToolbarTool("@Share_16x16.png", "Push Changes to All Relevant Actions", new RoutedEventHandler(PushChangesClicked));
            xOutputValuesGrid.AddToolbarTool("@Import_16x16.png", "Import output values from Response sample file", new RoutedEventHandler(ImpurtButtonClicked));

            xOutputValuesGrid.btnAdd.AddHandler(Button.ClickEvent, new RoutedEventHandler(AddReturnValue));
            xOutputValuesGrid.AddSeparator();

            ControlsBinding.ObjFieldBinding(xOutputValuesGrid.AddCheckBox("Support Simulation", new RoutedEventHandler(RefreshOutputColumns)), CheckBox.IsCheckedProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.SupportSimulation));
            SetActReturnValuesGrid();

            xOutputValuesGrid.DataSourceList = mApplicationAPIModel.ReturnValues;
        }
Ejemplo n.º 7
0
        private void BindControlsToAction(Panel container)
        {
            foreach (UIElement e in container.Children)
            {
                // recursive bind for example for StackPanel or other controls Panel
                if (e is Panel)
                {
                    BindControlsToAction((Panel)e);
                }

                // If we have property Tag filled it means it will be Binded to InputValue - Tag value = Param name
                string tag = (string)e.GetValue(TagProperty);

                // We bind control based on their tag value
                if (!string.IsNullOrEmpty(tag))
                {
                    ActInputValue v = mAct.GetOrCreateInputParam(tag);
                    if (e is TextBox)
                    {
                        ControlsBinding.ObjFieldBinding((Control)e, TextBox.TextProperty, v, "Value");
                    }

                    if (e is ComboBox)
                    {
                        //TODO: fill combo from enum val
                        ControlsBinding.ObjFieldBinding((Control)e, ComboBox.SelectedValueProperty, v, "Value");
                    }
                    //TODO: check control type and bind per type
                }

                //TODO: automatic styling
                if (e is Label)
                {
                    ((Label)e).Style = App.GetStyle("@InputFieldLabelStyle");     // TODO: use const/enum so will pass compile check
                }
                else if (e is TextBox)
                {
                    ((TextBox)e).Style = App.GetStyle("@TextBoxStyle");    // TODO: use const/enum so will pass compile check
                }
            }
        }
Ejemplo n.º 8
0
        public AddOptionalValuesModelSelectTypePage(eOptionalValuesTargetType OptionalValuesTargetType)
        {
            InitializeComponent();
            mOptionalValuesTargetType = OptionalValuesTargetType;
            switch (mOptionalValuesTargetType)
            {
            case eOptionalValuesTargetType.ModelLocalParams:
                ControlsBinding.FillComboFromEnumType(xSourceTypeComboBox, typeof(eSourceType), null);
                break;

            case eOptionalValuesTargetType.GlobalParams:
                ControlsBinding.FillComboFromEnumType(xSourceTypeComboBox, typeof(eSourceType), new List <object>()
                {
                    eSourceType.Excel, eSourceType.DB
                });
                break;
            }

            xSourceTypeComboBox.Style = this.FindResource("$FlatInputComboBoxStyle") as Style;
            SetFieldsGrid(); //XML & JSON
            SetDefaultPresentation();
        }
Ejemplo n.º 9
0
        private void InitializeUIByActionType()
        {
            ControlsBinding.ObjFieldBinding(txtName, TextBox.TextProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.Name));
            ControlsBinding.ObjFieldBinding(txtDescription, TextBox.TextProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.Description));

            FillTargetAppsComboBox();
            xTargetApplicationComboBox.Init(mApplicationAPIModel, nameof(ApplicationAPIModel.TargetApplicationKey));
            xTagsViewer.Init(mApplicationAPIModel.TagsKeys);

            xAPITypeComboBox.Init(mApplicationAPIModel, nameof(mApplicationAPIModel.APIType), typeof(ApplicationAPIUtils.eWebApiType));
            xAPITypeComboBox.ComboBox.SelectionChanged += ComboBox_SelectionChanged;

            CookieMode.Init(mApplicationAPIModel, nameof(mApplicationAPIModel.CookieMode), typeof(ApplicationAPIUtils.eCookieMode));
            RequestTypeComboBox.Init(mApplicationAPIModel, nameof(mApplicationAPIModel.RequestType), typeof(ApplicationAPIUtils.eRequestType));
            HttpVersioncombobox.Init(mApplicationAPIModel, nameof(mApplicationAPIModel.ReqHttpVersion), typeof(ApplicationAPIUtils.eHttpVersion));
            ContentTypeComboBox.Init(mApplicationAPIModel, nameof(mApplicationAPIModel.ContentType), typeof(ApplicationAPIUtils.eContentType), false, ContentTypeChange);
            ResponseTypeComboBox.Init(mApplicationAPIModel, nameof(mApplicationAPIModel.ResponseContentType), typeof(ApplicationAPIUtils.eContentType));
            //Check maybe the binding of TemplateFileNameFileBrowser need to be different between soap and rest
            ControlsBinding.ObjFieldBinding(TemplateFileNameFileBrowser, TextBox.TextProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.TemplateFileNameFileBrowser));

            xTargetApplicationComboBox.ComboBox.Style = this.FindResource("$FlatInputComboBoxStyle") as Style;
            xAPITypeComboBox.ComboBox.Style           = this.FindResource("$FlatInputComboBoxStyle") as Style;
            CookieMode.ComboBox.Style           = this.FindResource("$FlatInputComboBoxStyle") as Style;
            RequestTypeComboBox.ComboBox.Style  = this.FindResource("$FlatInputComboBoxStyle") as Style;
            HttpVersioncombobox.ComboBox.Style  = this.FindResource("$FlatInputComboBoxStyle") as Style;
            ContentTypeComboBox.ComboBox.Style  = this.FindResource("$FlatInputComboBoxStyle") as Style;
            ResponseTypeComboBox.ComboBox.Style = this.FindResource("$FlatInputComboBoxStyle") as Style;


            ApplicationAPIModel AAMS = mApplicationAPIModel as ApplicationAPIModel;

            ControlsBinding.ObjFieldBinding(SoapActionTextBox, TextBox.TextProperty, mApplicationAPIModel, nameof(AAMS.SOAPAction));
            ControlsBinding.ObjFieldBinding(TemplateFileNameFileBrowser, TextBox.TextProperty, mApplicationAPIModel, nameof(mApplicationAPIModel.TemplateFileNameFileBrowser));

            SetViewByAPIType(mApplicationAPIModel.APIType);
        }
Ejemplo n.º 10
0
 public FlowElement(eElementType ElementType, object obj, string prop, double left, double top)
 {
     this.ElementType = ElementType;
     Init(left, top);
     ControlsBinding.ObjFieldBinding(CaptionLabel, ContentProperty, obj, prop, BindingMode.OneWay);
 }
Ejemplo n.º 11
0
 public void BindStatusLabel(object obj, string prop)
 {
     ControlsBinding.ObjFieldBinding(StatusLabel, ContentProperty, obj, prop, BindingMode.OneWay);
 }
Ejemplo n.º 12
0
 // ------------------------------------------------------------
 //Image Maker
 // ------------------------------------------------------------
 public static void BindControl(this ImageMakerControl Label, Object obj, string Field)
 {
     ControlsBinding.ObjFieldBinding(Label, ImageMakerControl.ImageTypeProperty, obj, Field, BindingMode.OneWay);
 }
Ejemplo n.º 13
0
        // ------------------------------------------------------------
        // Label
        // ------------------------------------------------------------

        public static void BindControl(this Label Label, Object obj, string Field)
        {
            ControlsBinding.ObjFieldBinding(Label, Label.ContentProperty, obj, Field, BindingMode.OneWay);
        }
Ejemplo n.º 14
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();
        }
Ejemplo n.º 15
0
        public POMEditPage(ApplicationPOMModel POM)
        {
            InitializeComponent();
            mPOM = POM;
            ControlsBinding.ObjFieldBinding(xNameTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.Name));
            ControlsBinding.ObjFieldBinding(xDescriptionTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.Description));

            xTargetApplicationComboBox.ComboBox.Style = this.FindResource("$FlatInputComboBoxStyle") as Style;
            FillTargetAppsComboBox();
            xTargetApplicationComboBox.Init(mPOM, nameof(ApplicationPOMModel.TargetApplicationKey));
            xTagsViewer.Init(mPOM.TagsKeys);

            BitmapSource source = null;

            if (mPOM.ScreenShotImage != null)
            {
                source = Ginger.Reports.GingerExecutionReport.ExtensionMethods.GetImageStream(Ginger.Reports.GingerExecutionReport.ExtensionMethods.Base64ToImage(mPOM.ScreenShotImage.ToString()));
            }

            //Bitmap ScreenShot = BitmapFromSource(Ginger.Reports.GingerExecutionReport.ExtensionMethods.GetImageStream(Ginger.Reports.GingerExecutionReport.ExtensionMethods.Base64ToImage(mPOM.LogoBase64Image.ToString())));

            ScreenShotViewPage p = new ScreenShotViewPage(mPOM.Name, source);

            xScreenShotFrame.Content = p;

            //PomElementsMappingPage mappedUIElementsPage = new PomElementsMappingPage(mPOM,null);
            PomAllElementsPage pomAllElementsPage = new PomAllElementsPage(mPOM, null);

            //pomAllElementsPage.mappedUIElementsPage.MainElementsGrid.ValidationRules.Add(ucGrid.eUcGridValidationRules.CantBeEmpty);
            //pomAllElementsPage.unmappedUIElementsPage.MainElementsGrid.ValidationRules.Add(ucGrid.eUcGridValidationRules.CantBeEmpty);
            xUIElementsFrame.Content = pomAllElementsPage;

            //PageNameTextBox.BindControl(mApplicationPOM, nameof(ApplicationPOM.Name));

            //ObservableList<ApplicationPlatform> Apps = App.UserProfile.Solution.ApplicationPlatforms;
            //ApplicationPlatform AP = (from x in Apps where x.Guid == mApplicationPOM.TargetApplicationKey.Guid select x).FirstOrDefault();
            //mApplicationPOM.TargetApplicationKey = AP.Key;  // Create new binding and get updates if exist as key app name might changed

            //Yuval Uncomment
            //TargetApplicationComboBox.BindControl<ApplicationPlatform>(mApplicationPOM, nameof(mApplicationPOM.TargetAppplicationKey), Apps, nameof(ApplicationPlatform.AppName), nameof(ApplicationPlatform.Key));

            //TODO: lazy load based on tabs with cache
            //if (mPOM.ScreenShot == null)
            //{
            //    string filename = mPOM.FileName.Replace("xml", "Screenshot.bmp");  // TODO: use same const
            //    //mPom.ScreenShot = General.LoadBitmapFromFile(filename);
            //}


            //POMSimulatorFrame.Content = new POMSimulatorPage(mPom);


            //LearnWizardPage p2 = new LearnWizardPage(mPom);
            //UIElementsFrame.Content = p2;

            //MappingFrame.Content = new MapUIElementsWizardPage(mPom);

            //NaviagtionsFrame.Content = new NavigationsPage(mPom);

            ////TODO: create a page and move code to design page
            //pd = new ScreenShotViewPage(mPom.Name, mPom.ScreenShot);
            //pd.MouseClickOnScreenshot += MouseClickOnScreenshot;
            //pd.MouseUpOnScreenshot += MouseUpOnScreenshot;
            //pd.MouseMoveOnScreenshot += MouseMoveOnScreenshot;
            //DesignFrame.Content = pd;

            //InitControlPropertiesGrid();
        }