public PlaylistPage(PlaylistManager PlaylistManager)
        {
            _playlistManager = PlaylistManager;

            InitializeComponent();

            lblHeader.Content       = PAGE_HEADER;
            dgPlaylists.DataContext = _playlistManager.Playlists;
        }
예제 #2
0
        public MainWindow()
        {
            _audioDeviceLocater = new AudioDeviceLocater();

            //Load app configuration
            string configFilename            = System.IO.Path.Join(AppContext.BaseDirectory, CONFIG_FILENAME);
            ConfigurationLoader configLoader = new ConfigurationLoader();

            configLoader.LoadFromFile(configFilename);
            _config = configLoader.Configuration;

            //Get list of Music search locations
            List <string> searchLocations = new List <string>();

            searchLocations.Add(System.IO.Path.Join(AppContext.BaseDirectory, "Music"));
            searchLocations.AddRange(_config.SearchLocations);
            _fileLocater = new LocalTrackLocater(searchLocations.ToArray());

            //Instantiate requires classes
            _metadataExtractor           = new MetadataExtractor();
            _localLibraryManager         = new LocalLibraryManager(_fileLocater, _metadataExtractor);
            _musicPlayer                 = new MusicPlayer();
            _queueBuilder                = new QueueBuilder();
            _playlistReader              = new LocalPlaylistReader(_localLibraryManager, System.IO.Path.Join(AppContext.BaseDirectory, "Playlists"));
            _playlistWriter              = new LocalPlaylistWriter(System.IO.Path.Join(AppContext.BaseDirectory, "Playlists"));
            _playlistManager             = new PlaylistManager(_playlistReader, _playlistWriter);
            _trackProgressTimer          = new DispatcherTimer();
            _trackProgressTimer.Interval = TimeSpan.FromSeconds(0.5);
            _trackProgressTimer.Tick    += (_, __) =>
            {
                lblCurrentTime.Content = _musicPlayer.GetCurrentTrackTimePosition().ToString(@"mm\:ss");
            };

            //Initialise the search page
            _searchPage = new TrackPage();


            InitializeComponent();
        }