// Getting BlindtestClass Object from MainPage, then loading list of users
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // If a parameter is given, and if it's a BlindtestClass element
            if (e.Parameter is BlindtestClass)
            {
                // Get main element
                var bt = e.Parameter;
                blindtest = (BlindtestClass)bt;

                // Filling listView with users according to dataTemplate
                ObservableCollection <BTUser> listItems = new ObservableCollection <BTUser>();
                foreach (BTUser user in blindtest.getAllUsers())
                {
                    listItems.Add(user);
                }
                users_listView.ItemsSource = listItems;

                selected_user = blindtest.getSelectedUser();

                if (!selected_user.Equals(default(BTUser)))
                {
                    // Check if user still exist
                    if (blindtest.checkIfUserExist(selected_user) == true)
                    {
                        userInformation_label.Text = "User information - Selected User : " + selected_user.nickname;
                        BitmapImage bmpImg = new BitmapImage();
                        bmpImg.UriSource             = new Uri(selected_user.profile_picture);
                        profilePicture_Image.Source  = bmpImg;
                        users_listView.SelectedIndex = blindtest.getSelectedUserIndex();
                    }
                }
            }
        }
        // Getting BlindtestClass Object from MainPage, then loading list of users
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // If a parameter is given, and if it's a BlindtestClass element
            if (e.Parameter is BlindtestClass)
            {
                // Get main element
                var bt = e.Parameter;
                blindtest = (BlindtestClass)bt;

                connected_user_index    = blindtest.getConnectedUserIndex();
                selected_playlist       = blindtest.getSelectedPlaylist();
                selected_playlist_index = blindtest.getSelectedPlaylistIndex();

                playlistInformation_label.Text = "List of tracks - " + selected_playlist.name;

                // Filling that listView element with some tracks
                ObservableCollection <DeezerTrack> listItems = new ObservableCollection <DeezerTrack>();
                connected_user_index = blindtest.getConnectedUserIndex();
                foreach (DeezerTrack track in selected_playlist.tracklist)
                {
                    listItems.Add(track);
                }
                tracklist_listView.ItemsSource = listItems;
            }
        }
 // Getting BlindtestClass Object from MainPage, then loading list of users
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     // If a parameter is given, and if it's a BlindtestClass element
     if (e.Parameter is BlindtestClass)
     {
         // Get main element
         var bt = e.Parameter;
         blindtest = (BlindtestClass)bt;
     }
 }
예제 #4
0
        // Getting BlindtestClass Object from MainPage, then loading list of users
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // If a parameter is given, and if it's a BlindtestClass element
            if (e.Parameter is BlindtestClass)
            {
                // Get main element
                var bt = e.Parameter;
                blindtest = (BlindtestClass)bt;

                // Getting user and game information
                connected_user = blindtest.getConnectedUser();
                selected_game  = blindtest.getSelectedGame();

                // loading game info in UI, and filling listView with tracks according to datatemplate
                gameInformation_label.Text = "List of tracks - " + selected_game.game_title;

                ObservableCollection <DeezerTrack> listItems = new ObservableCollection <DeezerTrack>();
                foreach (DeezerTrack track in selected_game.tracklist)
                {
                    listItems.Add(track);
                }
                tracklist_listView.ItemsSource = listItems;

                // Loading scoreboard for this game
                foreach (BTGameHistory history in selected_game.scores.history)
                {
                    BTScoreboard score = new BTScoreboard();
                    score.username        = "******";
                    score.profile_picture = "ms-appx:///Assets/Users/unselected-user.png";

                    foreach (BTUser user in blindtest.getAllUsers())
                    {
                        if (user.user_id == history.user_id)
                        {
                            score.username        = user.nickname;
                            score.profile_picture = user.profile_picture;
                        }
                    }

                    score.date  = history.date;
                    score.score = history.score.ToString();
                    scoreboard.Add(score);
                }

                // Filling scoreboard listView with scores loaded before according to dataTemplate
                ObservableCollection <BTScoreboard> listItems2 = new ObservableCollection <BTScoreboard>();
                foreach (BTScoreboard score in scoreboard)
                {
                    listItems2.Add(score);
                }
                scoreboard_listView.ItemsSource = listItems2;
            }
        }
예제 #5
0
        // Getting BlindtestClass Object from MainPage, then loading list of users
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // If a parameter is given, and if it's a BlindtestClass element
            if (e.Parameter is BlindtestClass)
            {
                // Get main element
                var bt = e.Parameter;
                blindtest = (BlindtestClass)bt;

                selected_game = blindtest.getSelectedGame();

                gameInformation_label.Text = "List of tracks - " + selected_game.game_title;

                // Loading every score history entry in dedicated listView, and loading UI elements
                ObservableCollection <DeezerTrack> listItems = new ObservableCollection <DeezerTrack>();

                description_label.Text     = "Here is the scoreboard for '" + selected_game.game_title + "' game! Just click on an entry to see all of it's details!";
                gameInformation_label.Text = "Scoreboard - " + selected_game.game_title;
                maximum_score       = (selected_game.scores.title * selected_game.tracklist.Count) + (selected_game.scores.artist * selected_game.tracklist.Count) + (selected_game.scores.album * selected_game.tracklist.Count) + (selected_game.scores.duration * selected_game.tracklist.Count);
                maxScore_label.Text = maximum_score.ToString() + " points";

                foreach (BTGameHistory history in selected_game.scores.history)
                {
                    BTScoreboard score = new BTScoreboard();
                    score.username        = "******";
                    score.profile_picture = "ms-appx:///Assets/Users/unselected-user.png";
                    score.user_id         = history.user_id;

                    foreach (BTUser user in blindtest.getAllUsers())
                    {
                        if (user.user_id == history.user_id)
                        {
                            score.username        = user.nickname;
                            score.profile_picture = user.profile_picture;
                        }
                    }

                    score.date  = history.date;
                    score.score = history.score.ToString();
                    scoreboard.Add(score);
                }

                ObservableCollection <BTScoreboard> listItems2 = new ObservableCollection <BTScoreboard>();

                foreach (BTScoreboard score in scoreboard)
                {
                    listItems2.Add(score);
                }

                scoreboard_listView.ItemsSource = listItems2;
            }
        }
        // Getting BlindtestClass Object from MainPage, then loading list of users
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // If a parameter is given, and if it's a BlindtestClass element
            if (e.Parameter is BlindtestClass)
            {
                // Get main element
                var bt = e.Parameter;
                blindtest = (BlindtestClass)bt;

                // Get that selected user
                selected_user = blindtest.getSelectedUser();

                // Show user's info on page
                username_label.Text = selected_user.nickname;
                BitmapImage bmpImg = new BitmapImage();
                bmpImg.UriSource  = new Uri(selected_user.profile_picture);
                user_Image.Source = bmpImg;
            }
        }
        // Getting BlindtestClass Object from MainPage, then loading list of users
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // If a parameter is given, and if it's a BlindtestClass element
            if (e.Parameter is BlindtestClass)
            {
                // Get main element
                var bt = e.Parameter;
                blindtest = (BlindtestClass)bt;

                // Get connected user information
                connected_user       = blindtest.getConnectedUser();
                connected_user_index = blindtest.getConnectedUserIndex();

                // Loading each playlist created by connected user
                foreach (BTPlaylist playlist in blindtest.getAllPlaylists(connected_user.user_id))
                {
                    basePlaylist_comboBox.Items.Add(playlist.name + " - N° of tracks: " + playlist.tracklist.Count.ToString() + " tracks");
                }
            }
        }
예제 #8
0
        // Getting BlindtestClass Object from MainPage, then loading list of users
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // If a parameter is given, and if it's a BlindtestClass element
            if (e.Parameter is BlindtestClass)
            {
                // Get main element
                var bt = e.Parameter;
                blindtest = (BlindtestClass)bt;

                // Loading information in UI elements
                connected_user = blindtest.getConnectedUser();

                ObservableCollection <BTGame> listItems = new ObservableCollection <BTGame>();
                BitmapImage bmpImg = new BitmapImage();
                bmpImg.UriSource    = new Uri(connected_user.profile_picture);
                userPP_Image.Source = bmpImg;

                all_games = blindtest.getAllGames();

                foreach (BTGame game in all_games)
                {
                    listItems.Add(game);
                }

                games_listView.ItemsSource = listItems;

                username_label.Text = connected_user.nickname;

                int games_created = 0, games_played = 0, playlists_created = 0;

                foreach (BTGame game in blindtest.getAllGames())
                {
                    if (game.user_id == connected_user.user_id)
                    {
                        games_created++;
                    }

                    foreach (BTGameHistory history in game.scores.history)
                    {
                        if (history.user_id == connected_user.user_id)
                        {
                            games_played++;
                        }
                    }
                }

                if (games_played > 1)
                {
                    nbrPlayedGames_label.Text = games_played.ToString() + " games";
                }

                else
                {
                    nbrPlayedGames_label.Text = games_played.ToString() + " game";
                }

                if (games_created > 1)
                {
                    nbrGames_label.Text = games_created.ToString() + " games";
                }

                else
                {
                    nbrGames_label.Text = games_created.ToString() + " game";
                }

                playlists_created = blindtest.getAllPlaylists(connected_user.user_id).Count;

                if (playlists_created > 1)
                {
                    nbrPlaylists_label.Text = playlists_created.ToString() + " playlists";
                }

                else
                {
                    nbrPlaylists_label.Text = playlists_created.ToString() + " playlist";
                }
            }
        }
        // Getting BlindtestClass Object from MainPage, then loading list of users
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // If a parameter is given, and if it's a BlindtestClass element
            if (e.Parameter is BlindtestClass)
            {
                // Get main element
                var bt = e.Parameter;
                blindtest = (BlindtestClass)bt;

                // Loading UI elements and filling scoreboard listView
                connected_user = blindtest.getConnectedUser();
                selected_game  = blindtest.getSelectedGame();

                correctAnswers_label.Text = "Correct Answers - " + selected_game.game_title;
                gameStatus_label.Text     = "Game in progress...";

                foreach (BTGameHistory history in selected_game.scores.history)
                {
                    BTScoreboard score = new BTScoreboard();
                    score.username        = "******";
                    score.profile_picture = "ms-appx:///Assets/Users/unselected-user.png";

                    foreach (BTUser user in blindtest.getAllUsers())
                    {
                        if (user.user_id == history.user_id)
                        {
                            score.username        = user.nickname;
                            score.profile_picture = user.profile_picture;
                        }
                    }

                    score.date  = history.date;
                    score.score = history.score.ToString();
                    scoreboard.Add(score);
                }

                ObservableCollection <BTScoreboard> listItems2 = new ObservableCollection <BTScoreboard>();

                foreach (BTScoreboard score in scoreboard)
                {
                    listItems2.Add(score);
                }

                scoreboard_listView.ItemsSource = listItems2;

                // Launching the game
                is_album_correct    = false;
                is_artist_correct   = false;
                is_duration_correct = false;
                is_title_correct    = false;
                score = 0;

                // Loading tracklist
                foreach (DeezerTrack track in selected_game.tracklist)
                {
                    tracklist_src.Add(track);
                }

                nbr_track             = tracklist_src.Count;
                total_tracks          = tracklist_src.Count;
                current_track_int     = 1;
                songStatus_label.Text = "Track " + current_track_int.ToString() + " of " + total_tracks.ToString();

                Random random = new Random();

                int random_int = random.Next(0, nbr_track - 1);
                current_track = tracklist_src[random_int];
                tracklist_src.Remove(current_track);

                gameStatus_label.Text = "Game in progress... - score : " + score.ToString() + " points";
                blindtest.readPreview(current_track);
                total_correct_answer = 0;
            }
        }
예제 #10
0
        // Getting BlindtestClass Object from MainPage, then loading list of users
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // If a parameter is given, and if it's a BlindtestClass element
            if (e.Parameter is BlindtestClass)
            {
                // Get main element
                var bt = e.Parameter;
                blindtest = (BlindtestClass)bt;

                // Get that selected user
                selected_user = blindtest.getSelectedUser();

                // Show user's info on page
                userID_label.Text    = selected_user.user_id.ToString();
                username_label.Text  = selected_user.nickname;
                newUser_textBox.Text = selected_user.nickname;
                BitmapImage bmpImg = new BitmapImage();
                bmpImg.UriSource            = new Uri(selected_user.profile_picture);
                profilePicture_Image.Source = bmpImg;
                profilePicture_textBox.Text = selected_user.profile_picture;
                newPP_textBox.Text          = selected_user.profile_picture;

                foreach (BTGame game in blindtest.getAllGames())
                {
                    if (game.user_id == selected_user.user_id)
                    {
                        games_created++;
                    }

                    foreach (BTGameHistory history in game.scores.history)
                    {
                        if (history.user_id == selected_user.user_id)
                        {
                            games_played++;
                        }
                    }
                }

                if (games_played > 1)
                {
                    gamesPlayed_label.Text = games_played.ToString() + " games";
                }

                else
                {
                    gamesPlayed_label.Text = games_played.ToString() + " game";
                }

                if (games_created > 1)
                {
                    gamesCreated_label.Text = games_created.ToString() + " games";
                }

                else
                {
                    gamesCreated_label.Text = games_created.ToString() + " game";
                }

                playlists_created = blindtest.getAllPlaylists(selected_user.user_id).Count;

                if (playlists_created > 1)
                {
                    playlistsCreated_label.Text = playlists_created.ToString() + " playlists";
                }

                else
                {
                    playlistsCreated_label.Text = playlists_created.ToString() + " playlist";
                }
            }
        }