public ViewAllResults(frmMusicPlayer musicPlayer, List<Playlist> userPlaylists, HomePage parent)
 {
     InitializeComponent();
     this.musicPlayer = musicPlayer;
     this.usersPlaylists = userPlaylists;
     this.parent = parent;
 }
        /// <summary>
        /// Init for form
        /// </summary>
        public frmMusicPlayer(HomePage thisParent)
        {
            InitializeComponent();

            // Setup music controller
            musicController = new MusicController();

            // Acquire the parent form (the home page)
            parent = thisParent;

            isPlaying = false;
            playPause = true; // Sets to pause mode
            timeIndic = false; // Sets timer to negative
            lblPlayerStatus.Text = "No song selected";

            // Updates volume control
            setVolume(0.5f);

            // Initialise slider
            sliderValue = 0;
            trackLength = 0;
            mouseIsDown = false;
            ttpSliderIndicator.Hide(this);
        }
Example #3
0
 public void setParent(HomePage hp)
 {
     this.parent = hp;
 }
Example #4
0
        private void cmdSkipLogin_Click(object sender, EventArgs e)
        {
            HomePage homePage = new HomePage();

            User newUser = new User("username", "password", "Admin", "Hack", null, "Example bio");

            homePage.setCurrentUser(newUser);
            homePage.Show();

            this.Hide();
        }
Example #5
0
        /*
         * Button to attempt the login
         * @AUTHOR: Andrew Davis
         */
        private void cmdLogin_Click(object sender, EventArgs e)
        {
            // Create a LoginModel object to handle the login
            LoginModel loginModel = new LoginModel();

            // Get the user credentials from the form
            String username = txtUsername.Text;
            String password = txtPassword.Text;

            // Attempt the login
            User loggedIn = loginModel.doLogin(username, password);

            // If it was successful, go to the Home Page
            if (loggedIn != null)
            {

                MessageBox.Show("SUCCESS! LOGGED IN AS: " + loggedIn.getFirstName() + " " + loggedIn.getLastName());

                // Create a Home Form
                HomePage homeForm = new HomePage();

                // Set the Current User of the HomePage to be the newly logged in user
                homeForm.setCurrentUser(loggedIn);

                // Show the Home Form
                homeForm.Show();

                // Hide the current form
                this.Hide();

            }
            else
            {
                MessageBox.Show("UNSUCCESSFUL LOGIN");

                // Clear the Password field
                txtPassword.Text = "";
            }
        }
 public SearchResults(frmMusicPlayer musicPlayer, HomePage parent)
 {
     InitializeComponent();
     this.musicPlayer = musicPlayer;
     this.parent = parent;
 }
        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;
            }
        }