예제 #1
0
        public async void LoadFromSettings()
        {
            HurricaneSettings settings = HurricaneSettings.Instance;

            Playlists = settings.Playlists.Playlists;
            var currentState = settings.CurrentState;

            CSCoreEngine.EqualizerSettings = currentState.EqualizerSettings;
            CSCoreEngine.EqualizerSettings.Loaded();
            CSCoreEngine.Volume = currentState.Volume;
            DownloadManager     = settings.Config.Downloader;

            favoritePlaylist = new FavoriteList();
            favoritePlaylist.Initalize(this.Playlists);

            if (currentState.LastPlaylistIndex > -10)
            {
                CurrentPlaylist = IndexToPlaylist(currentState.LastPlaylistIndex);
            }

            SelectedPlaylist = IndexToPlaylist(currentState.SelectedPlaylist);

            if (currentState.SelectedTrack > -1 && currentState.SelectedTrack < SelectedPlaylist.Tracks.Count)
            {
                SelectedTrack = SelectedPlaylist.Tracks[currentState.SelectedTrack];
            }
            IsLoopEnabled    = currentState.IsLoopEnabled;
            IsShuffleEnabled = currentState.IsShuffleEnabled;
            foreach (NormalPlaylist lst in Playlists)
            {
                lst.LoadList();
            }
            favoritePlaylist.LoadList();
            if (currentState.Queue != null)
            {
                Queue = currentState.Queue; Queue.Initialize(Playlists);
            }

            if (currentState.LastTrackIndex > -1 && currentState.LastTrackIndex < SelectedPlaylist.Tracks.Count)
            {
                PlayableBase t = CurrentPlaylist.Tracks[currentState.LastTrackIndex];
                if (t.TrackExists && currentState.TrackPosition >= 0)
                {
                    await CSCoreEngine.OpenTrack(t);

                    CSCoreEngine.Position = currentState.TrackPosition;
                    CSCoreEngine.OnPropertyChanged("Position");
                }
            }

            AsyncTrackLoader.Instance.RunAsync(Playlists.ToList());
        }
예제 #2
0
        public void Loaded(MainWindow window)
        {
            _baseWindow = window;
            MySettings  = HurricaneSettings.Instance;

            MusicManager = new MusicManager();
            MusicManager.CSCoreEngine.TrackChanged      += CSCoreEngine_TrackChanged;
            MusicManager.CSCoreEngine.ExceptionOccurred += CSCoreEngine_ExceptionOccurred;
            MusicManager.LoadFromSettings();
            MainTabControlIndex = MySettings.CurrentState.MainTabControlIndex;
            TrackSearcher       = new TrackSearcher(MusicManager, window);

            _keyboardListener          = new KeyboardListener();
            _keyboardListener.KeyDown += KListener_KeyDown;
            Updater = new UpdateService(MySettings.Config.Language == "de" ? UpdateService.Language.German : UpdateService.Language.English);
            Updater.CheckForUpdates(_baseWindow);
        }