Ejemplo n.º 1
0
        private void queueLB_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            var list = (ListBox)sender;

            if (list.SelectedItem == _queueSelected)
            {
                list.SelectedIndex = -1;
                _queueSelected = null;
                ApplicationBar = (Microsoft.Phone.Shell.ApplicationBar)Resources["appbar3"];
            }
            else
            {
                _queueSelected = list.SelectedItem;
                selectedSong = (ActivePlaylistEntry)queueLB.SelectedItem;
                ApplicationBar = (Microsoft.Phone.Shell.ApplicationBar)Resources["appbar1"];

            }
        }
Ejemplo n.º 2
0
        private void addSong_Click(object sender, EventArgs e)
        {
            //minClientReqIDMap[selectedSearchResult.id] = minClientReqID;
                string statusCode = "";
                string url = "https://udjplayer.com:4897/udj/players/" + connectedPlayer.id + "/active_playlist/songs/";
                var client = new RestClient(url);
                var request = new RestRequest(selectedSearchResult.id.ToString(), Method.PUT);
                request.AddHeader("X-Udj-Ticket-Hash", currentUser.hashID.ToString());

                client.ExecuteAsync(request, response =>
                {
                    statusCode = response.StatusCode.ToString();

                    if (statusCode == "NotFound")
                    {
                        MessageBox.Show("You don't seemed to be connected to the internet, please check your settings and try again");
                        return;
                    }
                    else if (statusCode == "Conflict")
                    {

                            selectedSong = new ActivePlaylistEntry();
                            selectedSong.song = selectedSearchResult;
                            upOrDownVote_Click("upvote");

                        return;

                    }
                    else if (statusCode != "Created")
                    {
                        MessageBox.Show("There seems to be an error: " + statusCode);
                        return;
                    }
                    PhoneApplicationService.Current.State["minClientReqID"] = minClientReqID++;
                    var answer = MessageBox.Show("Your song was successfully added and upvoted!", "Song added", MessageBoxButton.OK);
                    if (answer == MessageBoxResult.OK)
                    {
                        updateNowPlaying();
                    }
                });
        }
        private void contextMenuPlay_Click(object sender, RoutedEventArgs e)
        {
            selectedSong = (((sender as MenuItem).Parent as ContextMenu).DataContext as ActivePlaylistEntry);
            var answer = MessageBox.Show("Are you sure you want to play this now? This will stop " + currentSong.song.title + " from playing.", "Play Now?", MessageBoxButton.OKCancel);
            if (answer == MessageBoxResult.Cancel)
            {
                MenuItem contextMenuItem = sender as MenuItem;
                ((ContextMenu)(contextMenuItem.Parent)).IsOpen = false;
            }
            else
            {
                MenuItem contextMenuItem = sender as MenuItem;
                ((ContextMenu)(contextMenuItem.Parent)).IsOpen = false;
                NetworkCalls<List<string>>.playSongBefore(currentUser, connectedPlayer, selectedSong.song.id);

            }
        }
        private void contextMenuRemove_Click(object sender, RoutedEventArgs e)
        {
            selectedSong = (((sender as MenuItem).Parent as ContextMenu).DataContext as ActivePlaylistEntry);
            //ListBoxItem contextMenuListItem = queueLB.ItemContainerGenerator.ContainerFromItem((sender as ContextMenu).DataContext) as ListBoxItem;
            var answer = MessageBox.Show("Are you sure you want to remove " + selectedSong.title + " from the active playlist? You can always add it again later, but it's " + selectedSong.total_votes + " votes will be lost!", "Remove from Playlist?", MessageBoxButton.OKCancel);
            if (answer == MessageBoxResult.Cancel)
            {
                MenuItem contextMenuItem = sender as MenuItem;
                ((ContextMenu)(contextMenuItem.Parent)).IsOpen = false;
            }
            else
            {
                MenuItem contextMenuItem = sender as MenuItem;
                ((ContextMenu)(contextMenuItem.Parent)).IsOpen = false;
                loadingProgressBar.IsLoading = true;
                NetworkCalls<List<string>>.removeSongBefore(currentUser, connectedPlayer, selectedSong.song.id);

            }
        }
Ejemplo n.º 5
0
 private void queueLB_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count == 1)
     {
         selectedSong = (ActivePlaylistEntry)queueLB.SelectedItem;
     }
 }