Beispiel #1
0
 public CurrentUser(AuthenticationContext authContext, IEventAggregator eventMgr)
 {
     _authContext = authContext;
     EventManager = eventMgr;
     Instance = this;
     EventManager.GetEvent<LogonEvent>().Subscribe(HandleLogonEvent);
     EventManager.GetEvent<LogoffEvent>().Subscribe(HandleLogoffEvent);
 }
Beispiel #2
0
        private void DoLogout()
        {
            // make sure the contexts are cleared
            //            var lookupContext = Container.Instance.Resolve<LookupContext>();

            // if this is NOT an automatic logout, make sure there are no context changes;
            // this is a safeguard; the user should not be able to logout when there are changes anyway.
            //if (_LogoutTimer != null)
               // if (_coreContext.HasChanges || lookupContext.HasChanges || employmentContext.HasChanges) return;

            StopActivityMonitor();

            // all good; clear everything
            //_coreContext.Addresses.Clear();

            AllowedActions = null;
            Entity = null;
            Instance = null;

            //_authContext.LogoutQuery();

            // take down screens
            var closeMainRegion = new ScreenEventArgs {Event = ScreenEventType.CloseInactiveScreens, RegionName = RegionName.Body};
            EventManager.Screen_Event(closeMainRegion);

            var closeOverlayActiveScreen = new ScreenEventArgs { Event = ScreenEventType.Deactivate, RegionName = RegionName.Overlay };
            EventManager.Screen_Event(closeOverlayActiveScreen);

            var closeOverlayRegionInactive = new ScreenEventArgs { Event = ScreenEventType.CloseInactiveScreens, RegionName = RegionName.Overlay };
            EventManager.Screen_Event(closeOverlayRegionInactive);

               EventManager.Screen_Activate("EntryScreen");
        }
Beispiel #3
0
 public void DoLogin(AppUser authenticatedUser)
 {
     if (Entity == null)
     {
         Entity = authenticatedUser;
         LoadPermissions(authenticatedUser.Id);
         Instance = this;
     }
 }