2 /*****************************************************************************
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 ********************************************************************************/
23 /************************************************
25 *************************************************/
29 using Castle
.MVC
.StatePersister
;
30 using Castle
.MVC
.States
;
31 using Castle
.MVC
.Views
;
33 namespace Castle
.MVC
.Navigation
39 public class DefaultNavigator
: INavigator
44 private IState _state
= null;
45 private IViewManager _viewManager
= null;
46 private IStatePersister _statePersister
= null;
54 /// <param name="viewManager">A view manager</param>
55 /// <param name="statePersister">A state persister</param>
56 public DefaultNavigator(IViewManager viewManager
,IStatePersister statePersister
)
58 _viewManager
= viewManager
;
59 _statePersister
= statePersister
;
60 _state
= _statePersister
.Load();
64 #region INavigator members
67 /// The current state.
69 public IState CurrentState
71 get { return _state; }
75 /// Natvigate to the next view.
77 public void Navigate()
79 _statePersister
.Save(_state
);
80 _viewManager
.ActivateView(this);