Esempio n. 1
0
 /// <inheritdoc/>
 public override void Detach()
 {
     _currentSession?.Detach();
     _currentSession         = null;
     MySession.AfterLoading -= SessionLoaded;
     MySession.OnUnloaded   -= SessionUnloaded;
 }
Esempio n. 2
0
 private void SessionUnloaded()
 {
     if (_currentSession == null)
     {
         return;
     }
     _log.Info($"Unloading torch session for {_currentSession.KeenSession.Name}");
     _currentSession.Detach();
     _currentSession = null;
 }
Esempio n. 3
0
 private void SessionUnloaded()
 {
     try
     {
         if (_currentSession == null)
         {
             _log.Warn("Session unloading event occurred when we don't have a session.");
             return;
         }
         _log.Info($"Unloaded torch session for {_currentSession.KeenSession.Name}");
         SetState(TorchSessionState.Unloaded);
         _currentSession = null;
     }
     catch (Exception e)
     {
         _log.Error(e);
         throw;
     }
 }
Esempio n. 4
0
        private void SessionLoaded()
        {
            if (_currentSession != null)
            {
                _log.Warn($"Override old torch session {_currentSession.KeenSession.Name}");
                _currentSession.Detach();
            }

            _log.Info($"Starting new torch session for {MySession.Static.Name}");
            _currentSession = new TorchSession(Torch, MySession.Static);
            foreach (SessionManagerFactoryDel factory in _factories)
            {
                IManager manager = factory(CurrentSession);
                if (manager != null)
                {
                    CurrentSession.Managers.AddManager(manager);
                }
            }
            (CurrentSession as TorchSession)?.Attach();
        }
Esempio n. 5
0
        private void SessionLoading()
        {
            try
            {
                if (_currentSession != null)
                {
                    _log.Warn($"Override old torch session {_currentSession.KeenSession.Name}");
                    _currentSession.Detach();
                }

                _log.Info($"Starting new torch session for {MySession.Static.Name}");

                _currentSession = new TorchSession(Torch, MySession.Static);
                SetState(TorchSessionState.Loading);
            }
            catch (Exception e)
            {
                _log.Error(e);
                throw;
            }
        }