Disable radios if not connected to MPD
This commit is contained in:
parent
3f74b1a4e7
commit
124b263499
@ -58,6 +58,8 @@ namespace unison
|
|||||||
ConnectionFailIcon.Visibility = Visibility.Visible;
|
ConnectionFailIcon.Visibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
_settingsWin.UpdateConnectionStatus();
|
_settingsWin.UpdateConnectionStatus();
|
||||||
|
if (_radiosWin.IsConnected())
|
||||||
|
Radio.IsEnabled = true;
|
||||||
Connection.Text = $"{Properties.Settings.Default.mpd_host}:{Properties.Settings.Default.mpd_port}";
|
Connection.Text = $"{Properties.Settings.Default.mpd_host}:{Properties.Settings.Default.mpd_port}";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,11 +190,6 @@ namespace unison
|
|||||||
SnapcastText.Text = unison.Resources.Resources.StartSnapcast;
|
SnapcastText.Text = unison.Resources.Resources.StartSnapcast;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnRadioBrowserConnected()
|
|
||||||
{
|
|
||||||
Radio.IsEnabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateButton(ref Border border, bool b)
|
public void UpdateButton(ref Border border, bool b)
|
||||||
{
|
{
|
||||||
border.Style = b ? (Style)Resources["SelectedButton"] : (Style)Resources["UnselectedButton"];
|
border.Style = b ? (Style)Resources["SelectedButton"] : (Style)Resources["UnselectedButton"];
|
||||||
|
@ -54,6 +54,9 @@ namespace unison
|
|||||||
{
|
{
|
||||||
private RadioBrowserClient _radioBrowser;
|
private RadioBrowserClient _radioBrowser;
|
||||||
private MPDHandler _mpd;
|
private MPDHandler _mpd;
|
||||||
|
private bool _connected = true;
|
||||||
|
|
||||||
|
public bool IsConnected() => _connected;
|
||||||
|
|
||||||
public Radios()
|
public Radios()
|
||||||
{
|
{
|
||||||
@ -69,11 +72,8 @@ namespace unison
|
|||||||
Debug.WriteLine("Exception while connecting to RadioBrowser: " + e.Message);
|
Debug.WriteLine("Exception while connecting to RadioBrowser: " + e.Message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
|
||||||
{
|
_connected = true;
|
||||||
MainWindow MainWin = (MainWindow)Application.Current.MainWindow;
|
|
||||||
MainWin.OnRadioBrowserConnected();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Initialize()
|
public async void Initialize()
|
||||||
|
Loading…
Reference in New Issue
Block a user