Пример #1
0
        public void LogStop(SessionStopped e)
        {
            if (_writer == null)
            {
                return;
            }
            if (Annotater == null)
            {
                _closeWriter = new Task((x) => ((LogFileWriter)x).Save(), _writer);
                _closeWriter.Start();
            }
            else
            {
                if (Annotater.QualifiesForStorage(this))
                {
                    _closeWriter = new Task((x) =>
                    {
                        ((LogFileWriter)x).Save();
                        Annotater.Store(this, ((LogFileWriter)x));
                    }, _writer);
                    _closeWriter.Start();
                }
                else
                {
                    _writer.Clear();
                }
            }

            _writer = null;
        }
Пример #2
0
        public void StopSession()
        {
            if (runningSession == null)
            {
                return;
            }

            autoLogExitCts?.Cancel();
            using (runningSession) {
                runningSession.Stop();
                SessionStopped?.Invoke(runningSession);
                runningSession = null;
            }
        }
Пример #3
0
        public async Task StopSessionAsync()
        {
            if (runningSession == null)
            {
                return;
            }

            autoLogExitCts?.Cancel();
            using (runningSession) {
                await Task.Run(() => runningSession.Stop());

                SessionStopped?.Invoke(runningSession);
                runningSession = null;
            }
        }
Пример #4
0
 /// <summary>
 /// Called whenever the <see cref="Session"/> has been stopped.
 /// </summary>
 /// <remarks>
 /// <remarks>
 /// In order for this override and properties like <see cref="IsSessionStarted"/>
 /// to be tracked correctly, use the <see cref="StartSessionAsync"/> and
 /// <see cref="StopSession"/> methods rather than calling methods
 /// directly on the <see cref="Session"/> instance.
 /// </remarks>
 protected virtual void OnSessionStopped()
 {
     SessionStopped?.Invoke(this, EventArgs.Empty);
 }
 public void NotifySessionStopped(SessionStoppedEventArgs args)
 {
     SessionStopped?.Invoke(this, args);
 }
Пример #6
0
        public void LogStop(SessionStopped e)
        {
            if (_writer == null) return;
            if (Annotater == null)
            {
                _closeWriter = new Task((x) => ((LogFileWriter)x).Save(), _writer);
                _closeWriter.Start();
            }
            else
            {
                if (Annotater.QualifiesForStorage(this))
                {
                    _closeWriter = new Task((x) =>
                                               {
                                                   ((LogFileWriter) x).Save();
                                                   Annotater.Store(this, ((LogFileWriter) x));
                                               }, _writer);
                    _closeWriter.Start();
                }
                else
                {
                    _writer.Clear();
                }
            }

            _writer = null;
        }