public override System.Web.UI.Control CreateUIControl(HtmlGenericControl parent, object dataContext,
                                                              AddressResx addressResx)
        {
            this.dataContext = dataContext;
            var tb = new System.Web.UI.WebControls.TextBox();

            tb.ID       = Name;
            tb.CssClass = Style;
            if (!string.IsNullOrEmpty(MaximumLength))
            {
                tb.MaxLength = int.Parse(MaximumLength);
            }
            tb.TabIndex = short.Parse(IndexForTab);
            //tb.Text = ResolveBinding(dataContext);
            tb.EnableViewState = true;
            parent.Controls.Add(tb);
            if (!string.IsNullOrEmpty(ChangeHandler))
            {
                tb.Attributes.Add("onChange", ChangeHandler);
            }

            if (!string.IsNullOrEmpty(KeyPressHandler))
            {
                tb.Attributes.Add("onkeypress", KeyPressHandler);
            }

            if (!string.IsNullOrEmpty(KeyPressAndBlurHandler))
            {
                tb.Attributes.Add("onkeypress", KeyPressAndBlurHandler);
                tb.Attributes.Add("onblur", KeyPressAndBlurHandler);
            }

            if (!string.IsNullOrEmpty(ReadOnly))
            {
                tb.ReadOnly = ReadOnly.ToLower().Equals("true");
            }

            if (!string.IsNullOrEmpty(HasFocus) && HasFocus.ToLower().Equals("true"))
            {
                tb.Focus();
            }
            return(uiControl = tb);
        }
        public override int GetHashCode()
        {
            var hash = 17;

            hash = hash * 31 + Repository.GetHashCode();

            if (!string.IsNullOrEmpty(RepositoryBranch))
            {
                hash = hash * 31 + RepositoryBranch.GetHashCode();
            }

            hash = hash * 31 + IdeUserIdentity.Id.GetHashCode();
            hash = hash * 31 + BeingEdited.GetHashCode();
            hash = hash * 31 + HasFocus.GetHashCode();
            hash = hash * 31 + (CaretPositionInfo?.LeafMemberCaretOffset.GetHashCode() ?? 0);
            hash = hash * 31 + (CaretPositionInfo?.LeafMemberLineOffset.GetHashCode() ?? 0);
            hash = hash * 31 + (CaretPositionInfo?.SyntaxNodeIds.GetHashCode() ?? 0);

            return(hash);
        }
示例#3
0
        /// -------------------------------------------------------------------
        /// <summary></summary>
        /// -------------------------------------------------------------------
        void TestMove1(bool canMove, CheckType checkType, Type expectedException, WindowPosition placement, EventFired eventFired, Point point, bool moveWindowBackToOriginalPostion, HasFocus hasFocus)
        {
            Point oldPoint = new Point(m_le.Current.BoundingRectangle.Left, m_le.Current.BoundingRectangle.Top);

            try
            {
                //"Precondition: TransformPattern.CanMove == true", 
                TSC_VerifyPropertyEqual(pCanMove, canMove, TransformPattern.CanMoveProperty, CheckType.IncorrectElementConfiguration);

                //"Step: Ensure the AutomationElement does not have focus by calling SetFocus(AutomationElement.RootElement.FirstChild) - "OS's Start Button"",
                switch (hasFocus)
                {
                    case HasFocus.No:
                        TSC_SetFocusVerifyWithEvent(ControlFirstChild(AutomationElement.RootElement), CheckType.Verification);
                        break;

                    case HasFocus.DontCare:
                        break;

                    default:
                        throw new ArgumentException("Need to handle a HasFocus enum");
                }

                //"Step: Setup a BoundingRectangle PropertyChange event", 
                TSC_AddPropertyChangedListener(m_le, TreeScope.Element, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);

                //"Step: Verify that Move with the random point is called successfully", 
                TS_Move(point, expectedException, CheckType.Verification);

                //"Step: Wait for event to get fired",
                TSC_WaitForEvents(2);

                if (placement == WindowPosition.Exact)
                {
                    //"Verify: The BoundingRectangle PropertyChange event is fired",
                    TSC_VerifyPropertyChangedListener(m_le, new EventFired[] { eventFired }, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);
                    if (eventFired == EventFired.True)
                    {
                        // Verify element was moved to the correct position by validating the BoundingRectangle
                        TS_VerifyBoundingRect(new Rect(point.X, point.Y, m_le.Current.BoundingRectangle.Width, m_le.Current.BoundingRectangle.Height), m_le.Current.BoundingRectangle, CheckType.Verification);
                    }
                    else
                    {
                        // Verify element was not moved to the correct position by validating the BoundingRectangle
                        TS_VerifyBoundingRect(new Rect(oldPoint.X, oldPoint.Y, m_le.Current.BoundingRectangle.Width, m_le.Current.BoundingRectangle.Height), m_le.Current.BoundingRectangle, CheckType.Verification);
                    }
                }
                else if (placement == WindowPosition.Within)
                {
                    // "Verify: The BoundingRectangle PropertyChange event is fired if the element is moved",
                    if (m_le.Current.BoundingRectangle.Left == point.X && m_le.Current.BoundingRectangle.Top == point.Y)
                    {
                        TSC_VerifyPropertyChangedListener(m_le, new EventFired[] { EventFired.False }, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);
                    }
                    else
                    {
                        TSC_VerifyPropertyChangedListener(m_le, new EventFired[] { EventFired.True }, new AutomationProperty[] { AutomationElement.BoundingRectangleProperty }, CheckType.Verification);
                    }

                    // OS does not allow off the screen so will move it back to a good location
                    TS_VerifyPlacedWithinScreen(CheckType.Verification);

                }

            }
            finally // incase we throw expection, come back and clean up
            {
                if (moveWindowBackToOriginalPostion)
                {
                    //"Step: Move the window back to it's original position",
                    Comment("Moving window back to it's original position");
                    if (oldPoint != new Point(m_le.Current.BoundingRectangle.Left, m_le.Current.BoundingRectangle.Top))
                        TS_Move(oldPoint, null, CheckType.Verification);
                    else
                        m_TestStep++;
                }
            }
        }
示例#4
0
 private void Editor_Focused(object sender, FocusEventArgs e)
 {
     HasFocus.Raise(this, new FocusEventArgs(this, true));
 }