private void OnLeftButtonClick( XnaMouseState xnaMouseState )
 {
     var clicedControl = this.FindControlAtPoint( xnaMouseState.Location );
     if ( clicedControl != null )
     {
         this._eventAggregator.Publish( new GuiCommdnEdit( clicedControl ) );
     }
 }
 private void OnLeftButtonClicked( XnaMouseState xnaMouseState )
 {
     var clickedControl = this._allControls.FirstOrDefault( s => s.IsHitted( xnaMouseState.Location ) );
     if ( clickedControl != null )
     {
         this._eventAggreagor.Publish( new GuiCommandControlClicked( clickedControl ) );
     }
 }
        public void OnMove( XnaMouseState state )
        {
            if ( this._mouseOwner == null )
            {
                return;
            }

            this._mouseOwner.MouseHandler.OnMove( state );
        }
        public void OnLeftButtonReleased( XnaMouseState state )
        {
            if ( this._mouseOwner == null )
            {
                return;
            }

            this._mouseOwner.MouseHandler.OnLeftButtonReleased( state );
            this._mouseOwner = null;
        }
 public void OnLeftButtonClick( XnaMouseState state )
 {
     var control = this.FindControlAtPoint( state.Location ) as IControl;
     if ( control != null )
     {
         control.MouseHandler.OnLeftButtonClick( state );
     }
     else
     {
         this._selectedControls.Clear();
     }
 }
 public void OnLeftButtonPressed( XnaMouseState state )
 {
     Debug.Assert( this._mouseOwner == null, "this._selectedControl == null" );
     //TODO CHange it
     this._mouseOwner = this.FindControlAtPoint( state.Location ) as IControl;
     if ( this._mouseOwner != null )
     {
         this._mouseOwner.MouseHandler.OnLeftButtonPressed( state );
     }
     else
     {
         this._selectedControls.Clear();
     }
 }
        private void MousePressed( XnaMouseState mouseState )
        {
            var edge = this.GetRoadJuctionEdge( mouseState.Location );

            if ( this._isFirst )
            {
                if ( this.CanStartFrom( edge ) == false ) { return; }
                this.ProcessFirstControl( edge );
            }
            else
            {
                if ( this.CanProcess( edge ) == false ) { return; }
                this.ProcessControl( edge, mouseState.Location );
            }
        }
        private void LeftButtonClicked( XnaMouseState mouseState )
        {
            var edges = this.FindControlAtPoint( mouseState.Location );
            if ( edges == null )
            {
                return;
            }

            if ( this._lastClickedEdges == null )
            {
                this._lastClickedEdges = edges;
                this._lastClickedEdges.IsSelected = true;
            }
            else
            {
                this.Begin( this._lastClickedEdges, edges );
                this._lastClickedEdges = null;
            }
        }
        private void AddJunction( XnaMouseState mouseState )
        {
            const float halfRoadSize = Constans.RoadHeight / 2;
            var leftTop = this._factories.ControlFactory.CreateRoadJunctioBlockWithEdges( mouseState.Location - new Vector2( halfRoadSize, -halfRoadSize ) );
            var rightTop = this._factories.ControlFactory.CreateRoadJunctioBlockWithEdges( mouseState.Location - new Vector2( -halfRoadSize, -halfRoadSize ) );
            var rightBottom = this._factories.ControlFactory.CreateRoadJunctioBlockWithEdges( mouseState.Location - new Vector2(-halfRoadSize, halfRoadSize ) );
            var leftBottom = this._factories.ControlFactory.CreateRoadJunctioBlockWithEdges( mouseState.Location - new Vector2( halfRoadSize, halfRoadSize ) );


            leftTop.Connector.BottomEdge.Connector.ConnectBeginFrom( leftBottom.Connector.TopEdge );
            leftBottom.Connector.TopEdge.Connector.ConnectEndsOn( leftTop.Connector.BottomEdge );

            leftTop.Connector.RightEdge.Connector.ConnectBeginFrom( rightTop.Connector.LeftEdge );
            rightTop.Connector.LeftEdge.Connector.ConnectEndsOn( leftTop.Connector.RightEdge );

            rightTop.Connector.BottomEdge.Connector.ConnectBeginFrom( rightBottom.Connector.TopEdge );
            rightBottom.Connector.TopEdge.Connector.ConnectEndsOn( rightTop.Connector.BottomEdge );

            rightBottom.Connector.LeftEdge.Connector.ConnectBeginFrom( leftBottom.Connector.RightEdge );
            leftBottom.Connector.RightEdge.Connector.ConnectEndsOn( rightBottom.Connector.LeftEdge );
        }
 public void OnMove( XnaMouseState state )
 {
 }
 public void OnLeftButtonReleased( XnaMouseState state )
 {
 }
 public void OnLeftButtonPressed( XnaMouseState state )
 {
 }
 public void OnLeftButtonClick( XnaMouseState state )
 {
 }