Example #1
0
        public void Process(IScreenBinder binder)
        {
            binder.InsideLatch(
                delegate
            {
                foreach (Control control in _allControls.AllControls)
                {
                    IScreenElement element = binder.FindElementForControl(control);
                    if (element == null)
                    {
                        control.Hide();
                    }
                    else
                    {
                        element.Hide();
                    }
                }

                foreach (Control control in _controls.AllControls)
                {
                    IScreenElement element = binder.FindElementForControl(control);
                    if (element == null)
                    {
                        control.Show();
                    }
                    else
                    {
                        element.Show();
                    }
                }
            });
        }
        private void ShowMessagesCore([NotNull] IScreenElement element,
                                      [NotNull] ICollection messages)
        {
            Assert.ArgumentNotNull(element, nameof(element));
            Assert.ArgumentNotNull(messages, nameof(messages));

            var control = element.Control as Control;

            if (control == null)
            {
                return;
            }

            if (messages.Count == 0)
            {
                _errorProvider.SetError(control, string.Empty);
            }
            else
            {
                string message = StringUtils.Concatenate(messages,
                                                         Environment.NewLine);

                _errorProvider.SetError(control, message);
            }
        }
        public void MarkElementForNormalActivation(Control control)
        {
            IScreenElement element = Assert.NotNull(_binder.FindElementForControl(control),
                                                    $"element not found for {control}");

            element.ActivationMode = ActivationMode.Normal;
            element.EnableControl(CurrentState);
        }
Example #4
0
        public void CopyFrom(IScreenElement element)
        {
            Assert.ArgumentNotNull(element, nameof(element));

            Label     = element.Label;
            Alias     = element.Alias;
            PostLabel = element.PostLabel;
        }
Example #5
0
        public void CopyFrom(IScreenDriver driver)
        {
            IScreenElement peer = driver.FindElementForControl(Driver.Control);

            if (peer != null)
            {
                CopyFrom(peer);
            }
        }
        public PropertyBindingExpression ToEnabledOf(params Control[] controls)
        {
            foreach (Control control in controls)
            {
                IScreenElement element = _binder.FindElementForControl(control) ??
                                         new ScreenElement <Control>(control);

                element.BindEnabledTo(_accessor);
                _binder.AddElement(element);
            }

            return(this);
        }
Example #7
0
        public void Focus(string label)
        {
            IScreenElement element = FindElement(label);

            if (element == null)
            {
                return;
            }

            var control = element.Control as Control;

            if (control != null)
            {
                Focus(control);
            }
        }
Example #8
0
        public void RemoveElementForControl([NotNull] Control control)
        {
            IScreenElement element = FindElementForControl(control);

            if (element == null)
            {
                return;
            }

            _allElements.Remove(element);

            var boundScreenElement = element as IBoundScreenElement;

            if (boundScreenElement != null)
            {
                boundScreenElement.StopBinding();
                _boundElements.Remove(boundScreenElement);
            }
        }
Example #9
0
        public void AddElement(IScreenElement element)
        {
            Assert.ArgumentNotNull(element, nameof(element));

            _allElements.Add(element);
            var boundElement = element as IBoundPart;

            if (boundElement == null)
            {
                return;
            }

            boundElement.Binder = this;
            _boundElements.Add(boundElement);

            if (Model != null)
            {
                boundElement.Bind(Model);
            }
        }
Example #10
0
        public void Focus(object control)
        {
            Assert.ArgumentNotNull(control, nameof(control));

            IScreenElement element = FindElementForControl(control);

            if (element == null)
            {
                return;
            }

            bool oldLatched = IsLatched;

            IsLatched = true;
            try
            {
                element.Focus();
            }
            finally
            {
                IsLatched = oldLatched;
            }
        }
 public BasicElementExpression(IScreenElement element) : base(element)
 {
 }
Example #12
0
 public void AddElement(IScreenElement element)
 {
     // no-op;
 }
 public CheckboxElementExpression(IScreenElement element) : base(element)
 {
 }
 public BooleanComboboxElementExpression([NotNull] IScreenElement element)
     : base(element)
 {
 }
Example #15
0
 public void ShowErrorMessages(IScreenElement element, params string[] messages)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ScreenElementExpression&lt;EXPRESSIONTYPE&gt;"/> class.
        /// </summary>
        /// <param name="element">The element.</param>
        protected ScreenElementExpression([NotNull] IScreenElement element)
        {
            Assert.ArgumentNotNull(element, nameof(element));

            _element = element;
        }
 public void ShowErrorMessages(IScreenElement element, params string[] messages)
 {
     ShowMessagesCore(element, messages);
 }