Object that defines the way the KeyScroller should travel through its elements tree.
コード例 #1
0
 public ScrollingStrategyBase()
 {
     LastDirective = new ScrollingDirective( ActionType.MoveNext, ActionTime.NextTick );
     Walker = new TreeWalker( this );
     _highlightTicksCount = new Dictionary<IHighlightableElement, int>();
     AutoPauseDefaultTick = 5;
 }
コード例 #2
0
 public ScrollingDirective BeginHighlight( BeginScrollingInfo beginScrollingInfo, ScrollingDirective scrollingDirective )
 {
     if( beginScrollingInfo.PreviousElement != this )
         IsHighlighting = true;
     return scrollingDirective;
 }
コード例 #3
0
        protected virtual void OnInternalBeat( object sender, EventArgs e )
        {
            if( LastDirective == null ) LastDirective = new ScrollingDirective( ActionType.MoveNext, ActionTime.NextTick );

            //Saving the currently highlighted element
            PreviousElement = Walker.Current;

            //Move the cursor to the next element
            MoveNext( LastDirective.NextActionType );

            //update the auto pause tick when the next element is selected
            UpdateAutoPauseTicks( LastDirective.NextActionType );

            //End highlight on the previous element (if different from the current one)
            if( PreviousElement != null )
                FireEndHighlight( PreviousElement, Walker.Current );

            //Begin highlight on the current element (even if the previous element is also the current element, we send the beginhighlight to give the component the beat)
            if( Walker.Current != null )
                FireBeginHighlight();

            //active the auto pause if CheckAutoPauseCondition return true
            ActiveAutoPause();
        }
コード例 #4
0
        public virtual void GoToElement( HighlightModel.IHighlightableElement element )
        {
            LastDirective = new ScrollingDirective( ActionType.MoveNext, ActionTime.Immediate );

            Walker.Current.EndHighlight( new EndScrollingInfo( Timer.Interval.Ticks, PreviousElement, element ), LastDirective );
            Walker.GoTo( element );
        }
コード例 #5
0
 public ScrollingDirective BeginHighlight( BeginScrollingInfo beginScrollingInfo, ScrollingDirective scrollingDirective )
 {
     ResetAutoPause();
     return scrollingDirective;
 }
コード例 #6
0
 public ScrollingDirective EndHighlight( EndScrollingInfo endScrollingInfo, ScrollingDirective scrollingDirective )
 {
     if( _highlightPrePostChildren )
     {
         foreach( var p in _preChildren ) p.EndHighlight( endScrollingInfo, scrollingDirective );
         foreach( var p in _postChildren ) p.EndHighlight( endScrollingInfo, scrollingDirective );
     }
     return _element.EndHighlight( endScrollingInfo, scrollingDirective );
 }
コード例 #7
0
ファイル: TestHelper.cs プロジェクト: Invenietis/ck-certified
 public ScrollingDirective BeginHighlight( BeginScrollingInfo beginScrollingInfo, ScrollingDirective scrollingDirective )
 {
     return scrollingDirective;
 }
コード例 #8
0
 public ScrollingDirective BeginHighlight( BeginScrollingInfo beginScrollingInfo, ScrollingDirective scrollingDirective )
 {
     foreach( var child in Children )
     {
         child.BeginHighlight( beginScrollingInfo, scrollingDirective );
     }
     return scrollingDirective;
 }
コード例 #9
0
        public ScrollingDirective SelectElement( ScrollingDirective scrollingDirective )
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == Context.NoFocusManager.ExternalDispatcher, "This method should only be called by the ExternalThread." );
            scrollingDirective.NextActionType = ActionType.GoToRelativeRoot;

            //allows the repeat of the same key
            scrollingDirective.ActionTime = ActionTime.Delayed;

            if( KeyDownCommand.CanExecute( null ) )
            {
                KeyDownCommand.Execute( null );
                if( KeyUpCommand.CanExecute( null ) )
                {
                    KeyUpCommand.Execute( null );
                }
            }
            return scrollingDirective;
        }
コード例 #10
0
 public ScrollingDirective SelectElement(ScrollingDirective scrollingDirective)
 {
     Execute(null);
     return scrollingDirective;
 }
コード例 #11
0
        private void ProcessTick( ScrollingDirective scrollingDirective )
        {
            //if we have just entered the root, we need to highlight all the screens, except the one that has been entered.
            if( _hasJustBeenEntered )
            {
                _hasJustBeenEntered = false;
                foreach( var node in ChildNodes )
                {
                    if( node.Index != CurrentIndex )
                        node.IsHighlighted = false;
                }
            }

            //And we move to the next node
            if( !CurrentNode.MoveNext() ) //if the node was at the end of its laps
            {
                if( CurrentNode.IsRoot || (CurrentNode.Parent.IsRoot && CurrentNode.Parent.ChildNodes.Count == 1) ) //we are getting out of the root level, so we release the scroller so that it can scroll on the other devices.
                {
                    CurrentNode = null;
                    _entered = false;
                    scrollingDirective.NextActionType = ActionType.MoveNext;
                }
                else
                {
                    //if the Node had finished its last lap during the last MoveNext, we go up one level
                    CurrentNode = CurrentNode.Parent;
                    CurrentNode.Entered();
                    CurrentNode.MoveNext();
                }
            }
        }
コード例 #12
0
        public ScrollingDirective SelectElement( ScrollingDirective scrollingDirective )
        {
            scrollingDirective.NextActionType = ActionType.StayOnTheSame;

            if( CurrentNode == null )
            {
                if( ChildNodes.Count == 1 )
                {
                    CurrentNode = ChildNodes.Single();
                    CurrentNode.Entered();
                }
                else
                {
                    CurrentNode = this;
                }
                _hasJustBeenEntered = true;
                _entered = true;
            }
            else
            {
                if( CurrentNode.Level < ClickDepth - 1 )
                {
                    CurrentNode = CurrentNode.ChildNodes.ElementAt( CurrentNode.CurrentIndex );
                    CurrentNode.Entered();
                }
                else
                {
                    NodeViewModel selectedNode = CurrentNode.ChildNodes[CurrentNode.CurrentIndex];
                    CK.InputDriver.MouseProcessor.MoveMouseToAbsolutePosition( (int)(selectedNode.OffsetWidth + (selectedNode.Width / 2)), (int)(selectedNode.OffsetHeight + (selectedNode.Height / 2)) );

                    CurrentNode.ChildNodes.ElementAt( CurrentNode.CurrentIndex ).IsHighlighted = false;
                    CurrentNode = null;
                    _entered = false;
                    ExitAll();
                    scrollingDirective.NextActionType = ActionType.GoToAbsoluteRoot;
                }
            }

            scrollingDirective.ActionTime = ActionTime.Immediate;
            return scrollingDirective;
        }
コード例 #13
0
        public ScrollingDirective EndHighlight( EndScrollingInfo endScrollingInfo, ScrollingDirective scrollingDirective )
        {
            if( !_entered ) //we were scrolling the plugin itself (we hadn't entered yet), which had highlighted all the screens
            {
                foreach( var node in ChildNodes )
                {
                    node.IsHighlighted = false;
                }
            }
            else
            {
                CurrentNode.ChildNodes.ElementAt( CurrentNode.CurrentIndex ).IsHighlighted = false;
            }

            return scrollingDirective;
        }
コード例 #14
0
 public ScrollingDirective BeginHighlight( BeginScrollingInfo beginScrollingInfo, ScrollingDirective scrollingDirective )
 {
     //If we haven't entered the children yet, we highlight all of the screens.
     //Once a first Select element has been triggered, we start scrolling the screens.
     if( CurrentNode == null )
     {
         foreach( var node in ChildNodes )
         {
             node.IsHighlighted = true;
         }
     }
     else
     {
         ProcessTick( scrollingDirective );
     }
     return scrollingDirective;
 }
コード例 #15
0
 public ScrollingDirective EndHighlight( EndScrollingInfo endScrollingInfo, ScrollingDirective scrollingDirective )
 {
     if( endScrollingInfo.ElementToBeHighlighted != this )
         IsHighlighting = false;
     return scrollingDirective;
 }
コード例 #16
0
 public ScrollingDirective EndHighlight( EndScrollingInfo endScrollingInfo, ScrollingDirective scrollingDirective )
 {
     _viewModel.IsWindowHighlighted = false;
     return scrollingDirective;
 }
コード例 #17
0
 public ScrollingDirective SelectElement( ScrollingDirective scrollingDirective )
 {
     _editor.Activate();
     return scrollingDirective;
 }
コード例 #18
0
ファイル: Word.cs プロジェクト: Invenietis/ck-certified
        public ScrollingDirective BeginHighlight(BeginScrollingInfo beginScrollingInfo, ScrollingDirective scrollingDirective)
        {
            _selected = false;
            IsHighlighted = true;

            if(_textTemplate != null) _textTemplate.FocusOnElement(this);
            return scrollingDirective;
        }
コード例 #19
0
 public ScrollingDirective EndHighlight( EndScrollingInfo endScrollingInfo, ScrollingDirective scrollingDirective )
 {
     foreach( var child in Children )
     {
         child.EndHighlight( endScrollingInfo, scrollingDirective );
     }
     return scrollingDirective;
 }
コード例 #20
0
ファイル: Word.cs プロジェクト: Invenietis/ck-certified
        public ScrollingDirective EndHighlight(EndScrollingInfo endScrollingInfo, ScrollingDirective scrollingDirective)
        {
            IsHighlighted = false;

            if( !_selected ) _textTemplate.RemoveFocus( this ); //Keep the focus if the text is selected
            return scrollingDirective;
        }
コード例 #21
0
 public ScrollingDirective BeginHighlight( BeginScrollingInfo beginScrollingInfo, ScrollingDirective scrollingDirective )
 {
     if( _highlightPrePostChildren )
     {
         foreach( var p in _preChildren ) p.BeginHighlight( beginScrollingInfo, scrollingDirective );
         foreach( var p in _postChildren ) p.BeginHighlight( beginScrollingInfo, scrollingDirective );
     }
     return _element.BeginHighlight( beginScrollingInfo, scrollingDirective );
 }
コード例 #22
0
ファイル: Word.cs プロジェクト: Invenietis/ck-certified
 public ScrollingDirective SelectElement(ScrollingDirective scrollingDirective)
 {
     _selected = true;
     scrollingDirective.NextActionType = HighlightModel.ActionType.GoToAbsoluteRoot;
     _textTemplate.FocusOnElement( this );
     return scrollingDirective;
 }
コード例 #23
0
 public ScrollingDirective SelectElement( ScrollingDirective scrollingDirective )
 {
     return _element.SelectElement( scrollingDirective );
 }
コード例 #24
0
 public ScrollingDirective BeginHighlight( BeginScrollingInfo beginScrollingInfo, ScrollingDirective scrollingDirective )
 {
     IsHighlighted = true;
     return scrollingDirective;
 }
コード例 #25
0
 public ScrollingDirective EndHighlight( EndScrollingInfo endScrollingInfo, ScrollingDirective scrollingDirective )
 {
     return scrollingDirective;
 }
コード例 #26
0
 public ScrollingDirective EndHighlight( EndScrollingInfo endScrollingInfo, ScrollingDirective scrollingDirective )
 {
     IsHighlighted = false;
     return scrollingDirective;
 }
コード例 #27
0
 public ScrollingDirective SelectElement( ScrollingDirective scrollingDirective )
 {
     return scrollingDirective;
 }
コード例 #28
0
 public ScrollingDirective SelectElement( ScrollingDirective scrollingDirective )
 {
     scrollingDirective.NextActionType = ActionType.EnterChild;
     return scrollingDirective;
 }
コード例 #29
0
        public ScrollingDirective BeginHighlight( BeginScrollingInfo beginScrollingInfo, ScrollingDirective scrollingDirective )
        {
            _viewModel.IsWindowHighlighted = true;

            return scrollingDirective;
        }
コード例 #30
0
        public ScrollingDirective SelectElement( ScrollingDirective scrollingDirective )
        {
            _radar.ToNextStep();

            //In any case, when we trigger the input when on the radar, we set the NextType as ActionType.StayOnTheSameLocked.
            scrollingDirective.NextActionType = ActionType = ActionType.StayOnTheSame;
            scrollingDirective.ActionTime = ActionTime.Immediate;

            return scrollingDirective;
        }