public void BackWard() { IMyFrame prevFrame = _historyFrame.pop(); if (prevFrame == null) { return; } _currentFrame = prevFrame; applyFrameToWindow(_currentFrame); }
public FrameNavigator(IHostNavigator hostNavigator, object[] AvailableFrames) : base() { if (hostNavigator == null) { throw new ArgumentNullException("Not supply IHostnavitor"); } if (AvailableFrames == null || AvailableFrames.Count() <= 0) { throw new ArgumentNullException("Not supply available collection frame or don't have any frame in collection"); } _hostNavigator = hostNavigator; _availableFrame = AvailableFrames; _currentFrame = null; }
public void GoTo(int indexOfAvailableCollectionFrame, Action actionBeforeGoTo) { if (_currentFrame == null) { _currentFrame = new AvailableFrame(indexOfAvailableCollectionFrame, actionBeforeGoTo); applyFrameToWindow(_currentFrame); } else { if (_currentFrame.IndexOfFrame == indexOfAvailableCollectionFrame)//go to same current frame ignore { return; } else { _historyFrame.push(_currentFrame); //push current frame _currentFrame = new AvailableFrame(indexOfAvailableCollectionFrame, actionBeforeGoTo); //pointer current frame to new instance applyFrameToWindow(_currentFrame); } } }
private void applyFrameToWindow(IMyFrame frame) { _hostNavigator.ActiveFrameIndex = frame.IndexOfFrame; }