MPD handles disconnection and reconnection

This commit is contained in:
2021-09-02 00:14:28 +02:00
parent 2c8696155a
commit c568a957f7
10 changed files with 91 additions and 36 deletions

View File

@ -41,10 +41,19 @@ namespace unison
public void OnConnectionChanged(object sender, EventArgs e)
{
Connection.Text = (_mpd.IsConnected() ? "✔️" : "❌") + $"{Properties.Settings.Default.mpd_host}:{Properties.Settings.Default.mpd_port}";
_settingsWin.UpdateConnectionStatus();
if (_mpd.IsConnected())
{
Snapcast.IsEnabled = true;
Connection.Text = "✔️";
}
else
{
_timer.Stop();
DefaultState();
Connection.Text = "❌";
}
_settingsWin.UpdateConnectionStatus();
Connection.Text += $"{Properties.Settings.Default.mpd_host}:{Properties.Settings.Default.mpd_port}";
}
public void OnSongChanged(object sender, EventArgs e)
@ -132,6 +141,7 @@ namespace unison
SongFormat.Text = "";
CurrentTime.Text = "";
EndTime.Text = "";
PlayPause.Text = "\xedb5";
TimeSlider.Value = 50;
TimeSlider.IsEnabled = false;
NoCover.Visibility = Visibility.Visible;