Ejemplo n.º 1
0
 private static Control CreateDetailsView(ControlDetails i)
 {
     return(new ItemsControl
     {
         DataTemplates = new DataTemplates
         {
             new DataTemplate <PropertyDetails>(x =>
                                                new StackPanel
             {
                 Gap = 16,
                 Orientation = Orientation.Horizontal,
                 Children = new Controls
                 {
                     new TextBlock {
                         Text = x.Name
                     },
                     new TextBlock {
                         [!TextBlock.TextProperty] = x.WhenAnyValue(v => v.Value).Select(v => v.ToString())
                     },
                     new TextBlock {
                         Text = x.Priority
                     },
                 },
             }),
         },
         Items = i.Properties,
     });
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Assign the control value
        /// </summary>
        /// <param name="controlName"></param>
        /// <param name="value">bool</param>
        private bool AssignFieldvalue(ControlDetails controlDetails)
        {
            bool controlResponse = false;

            try
            {
                if (!string.IsNullOrEmpty(controlDetails.Value))
                {
                    if (controlDetails.Type == ControlType.TextBox || controlDetails.Type == ControlType.DateTime)
                    {
                        _driver.FindElement(By.Id(controlDetails.Name)).SendKeys(controlDetails.Value);
                        controlResponse = true;
                    }
                    else if (controlDetails.Type == ControlType.DropDownList)
                    {
                        var dropdown = new SelectElement(_driver.FindElement(By.Id(controlDetails.Name)));
                        dropdown.SelectByText(controlDetails.Value);
                        controlResponse = true;
                    }
                    else if (controlDetails.Type == ControlType.CheckBox)
                    {
                        ((IJavaScriptExecutor)_driver).ExecuteScript("document.getElementById('IsEnabled').checked=" + controlDetails.Value + "");
                        controlResponse = true;
                    }
                }
            }
            catch
            {
                return(controlResponse);
            }

            return(controlResponse);
        }