public Session Play(string source, string sessionName, uint start, int end)
        {
            // if the session is already loaded return it
            if (SessionSource == source &&
                _currentSessionName == sessionName &&
                Start == start &&
                End == end)
            {
                // if playback has paused continue playback
                if (!IsPlaying())
                {
                    _player.Play();
                }
                return(_player.Session);
            }

            Start = start;
            End   = end;

            // get the query service
            var queryService = _queryServices
                               .DefaultIfEmpty(null)
                               .FirstOrDefault(qs => qs.GetStorageName() == source);

            // load the session. this takes long!
            var session = queryService?.GetSession(sessionName, start, end);

            // start playback if a session was loaded
            if (session != null)
            {
                SessionSource       = source;
                _currentSessionName = sessionName;

                // stop current playback if needed
                if (IsPlaying())
                {
                    _player.Stop();
                }

                _player.Session = session;
                _player.Play();
            }

            return(_player.Session);
        }
Ejemplo n.º 2
0
 private void OnPlayClicked()
 {
     sessionPlayer.Play();
     SetState(UiState.Session);
 }