/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. /// This parameter is typically used to configure the page.</param> protected async override void OnNavigatedTo(NavigationEventArgs e) { MPD_IP = State.IP; MPD_PORT = State.Port; if (MPD_IP == null) { this.Frame.Navigate(typeof(Settings)); } bool except = false; try { await MusicPD.GetStatus(MPD_IP, MPD_PORT); } catch (Exception) { except = true; } if (except) { MessageDialog md = new MessageDialog("Error! Please make sure MPD is running and IP is specified."); await md.ShowAsync(); Frame.Navigate(typeof(Settings)); } double vol = Double.Parse(MusicPD.Volume.ToString()); VolumeSlider.Value = vol == -1 ? 100.0 : vol; }
private async void btnRepeat_Click(object sender, RoutedEventArgs e) { await MusicPD.GetStatus(MPD_IP, MPD_PORT); if (MusicPD.Repeat == true) { await SendCommand("repeat 0"); } else { await SendCommand("repeat 1"); } }
private async void btnShuffle_Click(object sender, RoutedEventArgs e) { await MusicPD.GetStatus(MPD_IP, MPD_PORT); if (MusicPD.Random == true) { await SendCommand("random 0"); } else { await SendCommand("random 1"); } }