public void PlayUserSelection(int userId) { var playlist = PlaylistRepository.GetById(userId); var player = MusicPlayerFactory.Create(GetHighestQualityFromPlaylist(playlist)); var jukebox = new Jukebox(playlist, player); jukebox.PlayTracks(); Assert.Pass("All tracks played"); }
private Panel BuildLibraryPanel(WindowBase wndw) { var lPanel = new Panel() { CanScroll = false, Size = wndw.ContentRegion.Size }; var backButton = new BackButton(wndw) { Text = "Musician", NavTitle = "Library", Parent = lPanel, Location = new Point(20, 20), }; var melodyPanel = new Panel() { Location = new Point(Panel.LEFT_MARGIN + 20, Panel.BOTTOM_MARGIN + backButton.Bottom), Size = new Point(lPanel.Size.X - 50 - Panel.LEFT_MARGIN, lPanel.Size.Y - 50 - Panel.BOTTOM_MARGIN), Parent = lPanel, CanScroll = true }; // Load local sheet music (*.xml) files. Task loader = Task.Run(() => Sheets = xmlParser.LoadDirectory(GameService.FileSrv.BasePath + @"\musician")); loader.Wait(); // TODO: Load a list from online database. foreach (RawMusicSheet sheet in Sheets) { var melody = new SheetButton { Parent = melodyPanel, Icon = GameService.Content.GetTexture(@"instruments\" + sheet.Instrument.ToLower()), Artist = sheet.Artist, Title = sheet.Title, // TODO: Use ApiService to get fixed, non-editable account name for User. User = sheet.User, MusicSheet = sheet }; displayedSheets.Add(melody); melody.LeftMouseButtonPressed += delegate { if (melody.MouseOverPlay) { GameService.Director.BlishHudWindow.Hide(); MusicPlayer = MusicPlayerFactory.Create( melody.MusicSheet, KeyboardType.Practice ); MusicPlayer.Worker.Start(); } if (melody.MouseOverEmulate) { GameService.Director.BlishHudWindow.Hide(); MusicPlayer = MusicPlayerFactory.Create( melody.MusicSheet, KeyboardType.Emulated ); MusicPlayer.Worker.Start(); StopButton = new HealthPoolButton() { Parent = GameService.Graphics.SpriteScreen, Text = "Stop Playback" }; StopButton.LeftMouseButtonReleased += delegate { this.StopPlayback(); }; } if (melody.MouseOverPreview) { if (melody.IsPreviewing) { this.StopPlayback(); melody.IsPreviewing = false; } else { foreach (SheetButton other in displayedSheets) { other.IsPreviewing = other == melody ? true : false; } if (MusicPlayer != null) { this.StopPlayback(); } MusicPlayer = MusicPlayerFactory.Create( melody.MusicSheet, KeyboardType.Preview ); MusicPlayer.Worker.Start(); } } }; } var ddSortMethod = new Dropdown() { Parent = lPanel, Visible = melodyPanel.Visible, Location = new Point(lPanel.Right - 150 - 10, 5), Width = 150 }; ddSortMethod.Items.Add(DD_TITLE); ddSortMethod.Items.Add(DD_ARTIST); ddSortMethod.Items.Add(DD_USER); ddSortMethod.Items.Add("------------------"); ddSortMethod.Items.Add(DD_HARP); ddSortMethod.Items.Add(DD_FLUTE); ddSortMethod.Items.Add(DD_LUTE); ddSortMethod.Items.Add(DD_HORN); ddSortMethod.Items.Add(DD_BASS); ddSortMethod.Items.Add(DD_BELL); ddSortMethod.Items.Add(DD_BELL2); ddSortMethod.ValueChanged += UpdateSort; ddSortMethod.SelectedItem = DD_TITLE; UpdateSort(ddSortMethod, EventArgs.Empty); backButton.LeftMouseButtonReleased += (object sender, MouseEventArgs e) => { wndw.NavigateHome(); }; return(lPanel); }
private Panel BuildLibraryPanel(WindowBase wndw) { var lPanel = new Panel() { CanScroll = false, Size = wndw.ContentRegion.Size }; var backButton = new BackButton(wndw) { Text = "Musician", NavTitle = "Library", Parent = lPanel, Location = new Point(20, 20), }; var melodyPanel = new Panel() { Location = new Point(0, MusicianModule.BOTTOM_MARGIN + backButton.Bottom), Size = new Point(lPanel.Width, lPanel.Size.Y - 50 - MusicianModule.BOTTOM_MARGIN), Parent = lPanel, ShowTint = true, ShowBorder = true, CanScroll = true }; // TODO: Load a list from online database. foreach (RawMusicSheet sheet in Sheets) { var melody = new SheetButton { Parent = melodyPanel, Icon = GameService.Content.GetTexture(@"instruments\" + sheet.Instrument.ToLower()), IconSize = DetailsIconSize.Small, Artist = sheet.Artist, Title = sheet.Title, // TODO: Use ApiService to get fixed, non-editable account name for User. User = sheet.User, MusicSheet = sheet }; displayedSheets.Add(melody); melody.LeftMouseButtonPressed += delegate { if (melody.MouseOverPlay) { this.StopPlayback(); GameService.Overlay.BlishHudWindow.Hide(); MusicPlayer = MusicPlayerFactory.Create( melody.MusicSheet, KeyboardType.Practice ); MusicPlayer.Worker.Start(); Conveyor.Visible = true; StopButton.Visible = true; } if (melody.MouseOverEmulate) { this.StopPlayback(); GameService.Overlay.BlishHudWindow.Hide(); MusicPlayer = MusicPlayerFactory.Create( melody.MusicSheet, KeyboardType.Emulated ); MusicPlayer.Worker.Start(); StopButton.Visible = true; } if (melody.MouseOverPreview) { if (melody.IsPreviewing) { this.StopPlayback(); } else { this.StopPlayback(); melody.IsPreviewing = true; MusicPlayer = MusicPlayerFactory.Create( melody.MusicSheet, KeyboardType.Preview ); MusicPlayer.Worker.Start(); } } }; } var ddSortMethod = new Dropdown() { Parent = lPanel, Visible = melodyPanel.Visible, Location = new Point(lPanel.Right - 150 - 10, 5), Width = 150 }; ddSortMethod.Items.Add(DD_TITLE); ddSortMethod.Items.Add(DD_ARTIST); ddSortMethod.Items.Add(DD_USER); ddSortMethod.Items.Add("------------------"); ddSortMethod.Items.Add(DD_HARP); ddSortMethod.Items.Add(DD_FLUTE); ddSortMethod.Items.Add(DD_LUTE); ddSortMethod.Items.Add(DD_HORN); ddSortMethod.Items.Add(DD_BASS); ddSortMethod.Items.Add(DD_BELL); ddSortMethod.Items.Add(DD_BELL2); ddSortMethod.ValueChanged += UpdateSort; ddSortMethod.SelectedItem = DD_TITLE; UpdateSort(ddSortMethod, EventArgs.Empty); backButton.LeftMouseButtonReleased += (object sender, MouseEventArgs e) => { wndw.NavigateHome(); }; return(lPanel); }