Exemplo n.º 1
0
        private new void Mouse_Wheel(object sender, MouseWheelEventArgs e)
        {
            if (e.Delta > 0)
            {
                Spotify.GetSetVolume(Spotify.GetSetVolume() + 10);
            }

            else if (e.Delta < 0)
            {
                Spotify.GetSetVolume(Spotify.GetSetVolume() - 10);
            }
        }
Exemplo n.º 2
0
 private void WebView_AcceleratorKeyPressed(object sender, Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlAcceleratorKeyPressedEventArgs e)
 {
     if ((e.VirtualKey == Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.VirtualKey.F4 && Keyboard.Modifiers.HasFlag(ModifierKeys.Alt))
         ^ e.VirtualKey == Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.VirtualKey.Escape)
     {
         timer.Stop();
         webView.Navigate((Uri)null);
         this.Close();
         Spotify.GetSetVolume(_volume);
         _window.FullNow(false);
         _window.Visibility = Visibility.Visible;
     }
 }
Exemplo n.º 3
0
        private void Timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            PlaybackContext context = _spotify.GetPlayingTrack();

            webView.Dispatcher.Invoke(() =>
            {
                if (context.Error == null)
                {
                    if (context.Item.Error == null)
                    {
                        String songName   = context.Item.Name;
                        String artistName = context.Item.Artists[0].Name;
                        if (_currentSong != songName)
                        {
                            _currentSong = songName;
                            SearchResource.ListRequest listRequest = youtube.Search.List("snippet");
                            listRequest.MaxResults      = 1;
                            listRequest.Type            = "video";
                            listRequest.Q               = songName + " - " + artistName;
                            listRequest.VideoEmbeddable = SearchResource.ListRequest.VideoEmbeddableEnum.True__;
                            //listRequest.VideoSyndicated = SearchResource.ListRequest.VideoSyndicatedEnum.True__;
                            SearchListResponse resp = listRequest.Execute();

                            string videoID   = resp.Items[0].Id.VideoId;
                            string startTime = (context.ProgressMs / 1000).ToString();
                            if (Spotify.GetSetVolume() != 0)
                            {
                                _volume = Spotify.GetSetVolume();
                            }
                            Spotify.GetSetVolume(0);

                            YoutubePlayer(videoID, startTime);
                        }
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("Inside- " + context.Error.Message);
                    }
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("Outside- " + context.Error.Message);
                }
            });
        }
Exemplo n.º 4
0
 private void Window_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Left)
     {
         Spotify.PreviousSong();
     }
     else if (e.Key == Key.Right)
     {
         Spotify.NextSong();
     }
     else if (e.Key == Key.Escape)
     {
         timer.Stop();
         this.webView.Navigate((Uri)null);
         this.Close();
         Spotify.GetSetVolume(_volume);
         _window.FullNow(false);
         _window.Visibility = Visibility.Visible;
     }
     e.Handled = true;
 }