public async Task <string> PausePlay(IPAddress ipAdress, string hostname) { var member = ServerVM.ConnectedMembers.Where(c => c.IPAddress.Equals(ipAdress)).SingleOrDefault(); string res = await SpotifyProvider.PerformPlayAsync(); if (member != null) { ServerVM.WriteToLog($"{member.Hostname} hat Pause/Play gedrückt"); } return(res); }
async void hook_KeyDown(object sender, KeyEventArgs e) { if (ControlButtonPressed) { ControlButtonPressed = false; e.Handled = true; switch (e.KeyCode) { case Keys.Space: ControlButtonPressed = false; Console.WriteLine("PauseStopp Performed"); this.textBoxCurrentSongName.Text = await SpotifyProvider.PerformPlayAsync(); e.Handled = true; return; case Keys.End: e.Handled = true; return; case Keys.Up: SpotifyProvider.PerformIncreaseVolume(); e.Handled = true; return; case Keys.Down: SpotifyProvider.PerformDecreaseVolume(); e.Handled = true; return; case Keys.Right: this.textBoxCurrentSongName.Text = await SpotifyProvider.PerformNextSongAsync(); e.Handled = true; return; case Keys.Left: this.textBoxCurrentSongName.Text = await SpotifyProvider.PerformPreviousSongAsync(); e.Handled = true; return; case Keys.LControlKey: e.Handled = true; return; case Keys.LShiftKey: e.Handled = true; return; default: e.Handled = true; return; } } if (Keys.LShiftKey == e.KeyCode) { ControlButtonPressed = true; e.Handled = true; } }
/// <summary> /// PLAY PAUSE /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void button4_Click(object sender, EventArgs e) { this.textBoxCurrentSongName.Text = await SpotifyProvider.PerformPlayAsync(); }