Exemplo n.º 1
0
        public AutoPersistentState(IStatePersister persister)
        {
            if (persister == null)
            {
                throw new ArgumentNullException("persister");
            }

            _persister = persister;
            var state = persister.Load();

            base.Id             = state.Id;
            base.CurrentTerm    = state.CurrentTerm;
            base.LastVotedForId = state.LastVotedForId;
        }
Exemplo n.º 2
0
        private void WebFormView_Init(object sender, EventArgs e)
        {
            IWindsorContainer container = ContainerWebAccessorUtil.ObtainContainer();

            // Get the State
            IStatePersister statePersister = (IStatePersister)container[typeof(IStatePersister)];

            _state = statePersister.Load();
            // Acquire current view
            _state.CurrentView = ConfigUtil.Settings.GetView(this.Request.Path);
            _state.Save();

            ControllerTree tree = (ControllerTree)container["mvc.controllerTree"];
            PropertyControllerCollection propertiesController = tree.GetControllers(this.GetType().BaseType);

            if (propertiesController != null)
            {
                for (int i = 0; i < propertiesController.Count; i++)
                {
                    IController controller = container[propertiesController[i].ControllerType] as IController;
                    propertiesController[i].PropertyInfo.SetValue(this, controller, null);
                }
            }
        }
Exemplo n.º 3
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="viewManager">A view manager</param>
		/// <param name="statePersister">A state persister</param>
		public DefaultNavigator(IViewManager viewManager,IStatePersister statePersister)
		{
			_viewManager = viewManager;
			_statePersister = statePersister;
			_state = _statePersister.Load();
		}
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="viewManager">A view manager</param>
 /// <param name="statePersister">A state persister</param>
 public DefaultNavigator(IViewManager viewManager, IStatePersister statePersister)
 {
     _viewManager    = viewManager;
     _statePersister = statePersister;
     _state          = _statePersister.Load();
 }