Ejemplo n.º 1
0
        /// <summary>
        /// Load state
        /// </summary>
        public async Task LoadState()
        {
            try
            {
                if (!FileStorageHelper.IsFileExists("currentPlaylist.js"))
                {
                    return;
                }

                var json = await FileStorageHelper.ReadText("currentPlaylist.js");

                if (!string.IsNullOrEmpty(json))
                {
                    _currentPlaylist.Deserialize(json);

                    if (_currentPlaylist.CurrentItem != null)
                    {
                        UpdateTransportControl();
                        CurrentAudioChanged?.Invoke(this, EventArgs.Empty);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Unable to load AudioService state");
            }
        }