/// <summary>
        /// Initializes music player, music loader thread, the GUI, and the artist/album scroller thread
        /// If the iTunes playlists haven't been imported, it calls the appropriate methods to do so
        /// </summary>
        public MainWindow()
        {
            MainWindow.khandler.setWindow(this);

            //import the iTunes playlists if they don't already exist
            if (!System.IO.Directory.Exists(outputDir) || System.IO.Directory.GetFiles(outputDir).Length == 0)
            {
                getLibLocation();
                //getiTunesSongs();
                parseiTunesSongs(outputDir);
            }

            //init the player and music loader thread
            player = new MusicPlayer_Bass(this);
            loader = new CustomMusicLoader(outputDir);

            //create hole in admin priveleges for messages to the taskbar
            //params: handle, WM_COMMAND, allow, null
            ChangeWindowMessageFilterEx(this.Handle, 0x0111, 1, IntPtr.Zero);

            //init the GUI
            InitializeComponent();
            InitPlaylistBox();

            currentSong = null;
            Control.CheckForIllegalCrossThreadCalls = false;

            //init the artist/album scroller thread and its related objects
            labelHasChanged        = new BoolObject(true);
            scrollThreadShouldExit = new BoolObject(false);
            scrollThread           = new Thread(new ThreadStart(ScrollText));
            scrollThread.Start();
        }
예제 #2
0
 ///<summary>
 ///Constructor initializes queues
 ///</summary>
 ///<param name="outputDir">the playlists are stored here</param>
 ///<param name="loader">gets songs and puts them in the queuestore</param>
 public QueueStore(String outputDir, CustomMusicLoader loader)
 {
     this.loader    = loader;
     playlistQueues = new Dictionary <String, Queue>();
     currentQueue   = null;
     String[] playlists = Directory.GetFiles(outputDir);
     foreach (String file in playlists)
     {
         int      len = File.ReadLines(file).Count();
         Playlist p   = new Playlist(file, len);
         Queue    q   = new Queue(p, len);
         initNextQueue(q);
         playlistQueues.Add(p.getName(), q);
     }
     currentQueue = playlistQueues["Music"];
 }