Added ability to order the execution of dictionary adapter behaviors.
[castle.git] / Experiments / Attic / MVC / Castle.MVC / Navigation / DefaultNavigator.cs
blob716799de82dbc1e1748362bdb3fd8d78b0002b1d
1 #region Apache Notice
2 /*****************************************************************************
3 *
4 * Castle.MVC
5 *
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
9 *
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 ********************************************************************************/
19 #endregion
21 #region Autors
23 /************************************************
24 * Gilles Bayon
25 *************************************************/
26 #endregion
28 using Castle.Core;
29 using Castle.MVC.StatePersister;
30 using Castle.MVC.States;
31 using Castle.MVC.Views;
33 namespace Castle.MVC.Navigation
35 /// <summary>
36 /// WebNavigator.
37 /// </summary>
38 [Transient]
39 public class DefaultNavigator : INavigator
42 #region Fields
44 private IState _state = null;
45 private IViewManager _viewManager = null;
46 private IStatePersister _statePersister = null;
47 #endregion
49 #region Constructor
51 /// <summary>
52 /// Constructor
53 /// </summary>
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();
62 #endregion
64 #region INavigator members
66 /// <summary>
67 /// The current state.
68 /// </summary>
69 public IState CurrentState
71 get { return _state; }
74 /// <summary>
75 /// Natvigate to the next view.
76 /// </summary>
77 public void Navigate()
79 _statePersister.Save(_state);
80 _viewManager.ActivateView(this);
83 #endregion