Ejemplo n.º 1
0
 public ViewAllResults(frmMusicPlayer musicPlayer, List<Playlist> userPlaylists, HomePage parent)
 {
     InitializeComponent();
     this.musicPlayer = musicPlayer;
     this.usersPlaylists = userPlaylists;
     this.parent = parent;
 }
Ejemplo n.º 2
0
 public ArtistView(User currentUser, frmMusicPlayer mscPl)
 {
     //Set user and music player upon initialise
     this.currentUser = currentUser;
     this.musicPlayer = mscPl;
     InitializeComponent();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Intialiser for home page
        /// </summary>
        public HomePage()
        {
            InitializeComponent();

            // Sets up form components
            musicPlayer = new frmMusicPlayer(this);
            playlists = new ViewUserPlaylists();
            searchResults = new SearchResults(musicPlayer, this);
            profileScreen = new UserProfile();
            viewPlaylist = new ViewPlaylist();
            weatherPage = new WeatherPage(this.currentUser, this);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Opens a music player component
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnMusicPlayer_Click(object sender, EventArgs e)
 {
     frmMusicPlayer playerForm = new frmMusicPlayer(null);
     playerForm.Show();
 }
Ejemplo n.º 5
0
 public SearchResults(frmMusicPlayer musicPlayer, HomePage parent)
 {
     InitializeComponent();
     this.musicPlayer = musicPlayer;
     this.parent = parent;
 }
Ejemplo n.º 6
0
        public ViewPlaylist(Playlist playlist, frmMusicPlayer music, User currentUser, HomePage parent)
        {
            InitializeComponent();

            picSave.Visible = true;

            //Set player, playlist, user
            this.musicPlayer = music;
            this.currentUser = currentUser;
            this.thePlaylist = playlist;
            lblPlaylistName.Text = thePlaylist.getPlaylistName();
            lblOwner.Text = thePlaylist.getOwner();
            this.parent = parent;

            //Initially hide edit box
            txtPlaylistNameEdit.Hide();

            List<Song> songs = thePlaylist.getSongs();
            int numSongs = thePlaylist.getSongs().Count;

            lblNumSongs.Text = numSongs.ToString();

            if (numSongs == 1) { lblNumSongs.Text += " song"; } else { lblNumSongs.Text += " songs"; }

            //Get total playlist length
            int totalLength = 0;
            for (int i = 0; i < songs.Count; i++)
            {
                totalLength += songs[i].getLength();
            }

            int hours = totalLength / 3600;
            int minutes = (totalLength - hours * 3600) / 60;
            int seconds = totalLength - (hours * 3600) - (minutes * 60);

            //Set up string saying how long the playlist is
            String output = "";
            if(hours > 0)
            {
                output += hours.ToString() + " hours, \n";
            }
            if (minutes > 0)
            {
                output += minutes.ToString() + " minutes, \n";
            }
            if (seconds > 0)
            {
                output += seconds.ToString() + " seconds, \n";
            }

            if (output.Equals(""))
            {
                output = "O seconds";
            }
            else {
                output = output.Substring(0, output.Length - 3);
            }

            //Set length to label
            lblTime.Text = output;

            String currUser = this.currentUser.getUsername();
            String owner = thePlaylist.getOwner();

            String first6 = "";

            if (!(thePlaylist.getPlaylistName().Length < 6))
            {
                first6 = thePlaylist.getPlaylistName().Substring(0, 6);
            }

            if (currUser.Equals(owner) && first6 != "" )
            {
                if (first6.Equals("$temp$"))
                {
                    lblPlaylistName.Text = thePlaylist.getPlaylistName().Substring(6);
                    thePlaylist.setName(thePlaylist.getPlaylistName().Substring(6));
                }
                else {
                    picSave.Visible = false;
                }
                picRecommend.Visible = true;
                picPlay.Left = lblPlaylistName.Left + lblPlaylistName.Width + 10;
            }
            else
            {
                picSave.Left = lblPlaylistName.Left + lblPlaylistName.Width + 10;
                picPlay.Left = lblPlaylistName.Left + lblPlaylistName.Width + 15 + picSave.Width;
                picRecommend.Visible = false;
            }
        }