Snapcast port and auto start working

This commit is contained in:
2021-08-15 01:18:23 +02:00
parent 7babd50c3f
commit ebd4e8e530
6 changed files with 49 additions and 12 deletions

View File

@ -205,7 +205,7 @@ namespace unison
{
SnapcastHandler snapcast = (SnapcastHandler)Application.Current.Properties["snapcast"];
if (!snapcast.Started)
snapcast.Start(_mpd.MpdHost);
snapcast.Start();
else
snapcast.Stop();
}

View File

@ -55,9 +55,11 @@
<CheckBox x:Name="SnapcastStartup" Margin="5, 5, 0, 0">
<TextBlock Text="Launch at startup" TextWrapping="Wrap"/>
</CheckBox>
<TextBlock Text="Port" TextWrapping="Wrap" Margin="5,5,0,0"/>
<TextBox x:Name="SnapcastPort" MaxLength="5" PreviewTextInput="NumberValidationTextBox" TextWrapping="Wrap" Width="250" Margin="10,2,5,0" HorizontalAlignment="Left"/>
<TextBlock Text="Executable path" TextWrapping="Wrap" Margin="5,5,0,0"/>
<TextBox x:Name="SnapcastPath" TextWrapping="Wrap" Width="350" Margin="10,2,5,0"/>
<TextBlock TextWrapping="Wrap" Margin="5,5,0,0" TextAlignment="Left" Width="350">
<TextBox x:Name="SnapcastPath" TextWrapping="Wrap" Width="250" Margin="10,2,5,0" HorizontalAlignment="Left"/>
<TextBlock TextWrapping="Wrap" Margin="5,5,0,0" TextAlignment="Left" Width="250">
You can change to your own locally installed version of the Snapcast client with an <Run FontStyle="Italic" FontWeight="DemiBold">absolute</Run> path.
</TextBlock>
<Button Content="Reset" Margin="0,10,0,0" Width="120" Click="SnapcastReset_Clicked"/>
@ -148,7 +150,7 @@
<emoji:TextBlock Text="📝 License"/>
</GroupBox.Header>
<Grid VerticalAlignment="Top">
<TextBlock Text="{Binding GetLicense, Mode = OneWay}" TextWrapping="Wrap" Width="400" TextAlignment="Justify" />
<TextBlock Text="{Binding GetLicense, Mode = OneWay}" TextWrapping="Wrap" Width="500" TextAlignment="Justify" />
</Grid>
</GroupBox>
</DockPanel>

View File

@ -11,7 +11,8 @@ namespace unison
{
public partial class Settings : Window
{
private string defaultSnapcast = "snapclient_0.25.0-1_win64";
private string defaultSnapcastPath = "snapclient_0.25.0-1_win64";
private string defaultSnapcastPort = "1704";
public static string GetVersion => Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
@ -45,6 +46,7 @@ namespace unison
MpdPassword.Text = Properties.Settings.Default.mpd_password;
SnapcastStartup.IsChecked = Properties.Settings.Default.snapcast_startup;
SnapcastPath.Text = Properties.Settings.Default.snapcast_path;
SnapcastPort.Text = Properties.Settings.Default.snapcast_port.ToString();
}
private void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
@ -63,7 +65,8 @@ namespace unison
private void SnapcastReset_Clicked(object sender, RoutedEventArgs e)
{
SnapcastPath.Text = defaultSnapcast;
SnapcastPath.Text = defaultSnapcastPath;
SnapcastPort.Text = defaultSnapcastPort;
}
private void Window_Closing(object sender, CancelEventArgs e)
@ -75,6 +78,7 @@ namespace unison
Properties.Settings.Default.mpd_password = MpdPassword.Text;
Properties.Settings.Default.snapcast_startup = (bool)SnapcastStartup.IsChecked;
Properties.Settings.Default.snapcast_path = SnapcastPath.Text;
Properties.Settings.Default.snapcast_port = int.Parse(SnapcastPort.Text);
Properties.Settings.Default.Save();
WindowState = WindowState.Minimized;