Compare commits
2 Commits
72d2c5993d
...
86a652c170
Author | SHA1 | Date | |
---|---|---|---|
86a652c170 | |||
0aa80ed8b5 |
@ -44,7 +44,7 @@ namespace unison
|
|||||||
{
|
{
|
||||||
_snapcast.StartInfo.FileName = Properties.Settings.Default.snapcast_path + @"\snapclient.exe";
|
_snapcast.StartInfo.FileName = Properties.Settings.Default.snapcast_path + @"\snapclient.exe";
|
||||||
_snapcast.StartInfo.Arguments = $"--host {Properties.Settings.Default.mpd_host}";
|
_snapcast.StartInfo.Arguments = $"--host {Properties.Settings.Default.mpd_host}";
|
||||||
_snapcast.StartInfo.CreateNoWindow = true;
|
_snapcast.StartInfo.CreateNoWindow = !Properties.Settings.Default.snapcast_window;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_snapcast.Start();
|
_snapcast.Start();
|
||||||
|
12
Properties/Settings.Designer.cs
generated
12
Properties/Settings.Designer.cs
generated
@ -106,5 +106,17 @@ namespace unison.Properties {
|
|||||||
this["volume_offset"] = value;
|
this["volume_offset"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||||
|
public bool snapcast_window {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["snapcast_window"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["snapcast_window"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
<Setting Name="snapcast_startup" Type="System.Boolean" Scope="User">
|
<Setting Name="snapcast_startup" Type="System.Boolean" Scope="User">
|
||||||
<Value Profile="(Default)">False</Value>
|
<Value Profile="(Default)">False</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="snapcast_window" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">False</Value>
|
||||||
|
</Setting>
|
||||||
<Setting Name="snapcast_path" Type="System.String" Scope="User">
|
<Setting Name="snapcast_path" Type="System.String" Scope="User">
|
||||||
<Value Profile="(Default)">snapclient_0.25.0-1_win64</Value>
|
<Value Profile="(Default)">snapclient_0.25.0-1_win64</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
<Grid HorizontalAlignment="Center" VerticalAlignment="Top">
|
<Grid HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock x:Name="CurrentTime" Text="0:00" TextWrapping="Wrap" HorizontalAlignment="Left"/>
|
<TextBlock x:Name="CurrentTime" Text="0:00" TextWrapping="Wrap" HorizontalAlignment="Left"/>
|
||||||
<Slider Style="{DynamicResource SliderTime}" x:Name="TimeSlider" MinWidth="320" Margin="5,0,5,0" HorizontalAlignment="Center" Maximum="100" PreviewMouseUp="TimeSlider_DragCompleted" FocusVisualStyle="{x:Null}"/>
|
<Slider Style="{DynamicResource SliderTime}" x:Name="TimeSlider" MinWidth="320" Margin="5,0,5,0" HorizontalAlignment="Center" Maximum="100" PreviewMouseUp="TimeSlider_DragCompleted" Thumb.DragStarted="TimeSlider_DragStarted" FocusVisualStyle="{x:Null}"/>
|
||||||
<TextBlock x:Name="EndTime" Text="0:00" TextWrapping="Wrap" Height="18" HorizontalAlignment="Right"/>
|
<TextBlock x:Name="EndTime" Text="0:00" TextWrapping="Wrap" Height="18" HorizontalAlignment="Right"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -5,6 +5,7 @@ using System.Windows.Controls;
|
|||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
|
|
||||||
namespace unison
|
namespace unison
|
||||||
{
|
{
|
||||||
@ -14,6 +15,8 @@ namespace unison
|
|||||||
|
|
||||||
private readonly MPDHandler mpd;
|
private readonly MPDHandler mpd;
|
||||||
|
|
||||||
|
DispatcherTimer timer = new DispatcherTimer();
|
||||||
|
|
||||||
Thickness SelectedThickness;
|
Thickness SelectedThickness;
|
||||||
Thickness BaseThickness;
|
Thickness BaseThickness;
|
||||||
|
|
||||||
@ -26,7 +29,7 @@ namespace unison
|
|||||||
|
|
||||||
mpd = (MPDHandler)Application.Current.Properties["mpd"];
|
mpd = (MPDHandler)Application.Current.Properties["mpd"];
|
||||||
|
|
||||||
DispatcherTimer timer = new DispatcherTimer();
|
timer = new DispatcherTimer();
|
||||||
timer.Interval = TimeSpan.FromSeconds(0.5);
|
timer.Interval = TimeSpan.FromSeconds(0.5);
|
||||||
timer.Tick += Timer_Tick;
|
timer.Tick += Timer_Tick;
|
||||||
timer.Start();
|
timer.Start();
|
||||||
@ -174,6 +177,11 @@ namespace unison
|
|||||||
Hide();
|
Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TimeSlider_DragStarted(object sender, DragStartedEventArgs e)
|
||||||
|
{
|
||||||
|
timer.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
private void TimeSlider_DragCompleted(object sender, MouseButtonEventArgs e)
|
private void TimeSlider_DragCompleted(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
Slider slider = (Slider)sender;
|
Slider slider = (Slider)sender;
|
||||||
@ -183,6 +191,7 @@ namespace unison
|
|||||||
double SeekTime = SongPercentage / 100 * SongTime;
|
double SeekTime = SongPercentage / 100 * SongTime;
|
||||||
|
|
||||||
mpd.SetTime(SeekTime);
|
mpd.SetTime(SeekTime);
|
||||||
|
timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void VolumeSlider_DragCompleted(object sender, MouseButtonEventArgs e)
|
private void VolumeSlider_DragCompleted(object sender, MouseButtonEventArgs e)
|
||||||
|
@ -57,6 +57,9 @@
|
|||||||
<CheckBox x:Name="SnapcastStartup" Margin="5, 5, 0, 0">
|
<CheckBox x:Name="SnapcastStartup" Margin="5, 5, 0, 0">
|
||||||
<TextBlock Text="Launch at startup" TextWrapping="Wrap"/>
|
<TextBlock Text="Launch at startup" TextWrapping="Wrap"/>
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
<CheckBox x:Name="SnapcastWindow" Margin="5,2.5,0,0">
|
||||||
|
<TextBlock Text="Show Snapcast window" TextWrapping="Wrap"/>
|
||||||
|
</CheckBox>
|
||||||
<TextBlock Text="Port" TextWrapping="Wrap" Margin="5,5,0,0"/>
|
<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"/>
|
<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"/>
|
<TextBlock Text="Executable path" TextWrapping="Wrap" Margin="5,5,0,0"/>
|
||||||
|
@ -48,6 +48,7 @@ namespace unison
|
|||||||
MpdPort.Text = Properties.Settings.Default.mpd_port.ToString();
|
MpdPort.Text = Properties.Settings.Default.mpd_port.ToString();
|
||||||
MpdPassword.Text = Properties.Settings.Default.mpd_password;
|
MpdPassword.Text = Properties.Settings.Default.mpd_password;
|
||||||
SnapcastStartup.IsChecked = Properties.Settings.Default.snapcast_startup;
|
SnapcastStartup.IsChecked = Properties.Settings.Default.snapcast_startup;
|
||||||
|
SnapcastWindow.IsChecked = Properties.Settings.Default.snapcast_window;
|
||||||
SnapcastPath.Text = Properties.Settings.Default.snapcast_path;
|
SnapcastPath.Text = Properties.Settings.Default.snapcast_path;
|
||||||
SnapcastPort.Text = Properties.Settings.Default.snapcast_port.ToString();
|
SnapcastPort.Text = Properties.Settings.Default.snapcast_port.ToString();
|
||||||
VolumeOffset.Text = Properties.Settings.Default.volume_offset.ToString();
|
VolumeOffset.Text = Properties.Settings.Default.volume_offset.ToString();
|
||||||
@ -96,6 +97,7 @@ namespace unison
|
|||||||
Properties.Settings.Default.mpd_port = int.Parse(MpdPort.Text, CultureInfo.InvariantCulture);
|
Properties.Settings.Default.mpd_port = int.Parse(MpdPort.Text, CultureInfo.InvariantCulture);
|
||||||
Properties.Settings.Default.mpd_password = MpdPassword.Text;
|
Properties.Settings.Default.mpd_password = MpdPassword.Text;
|
||||||
Properties.Settings.Default.snapcast_startup = (bool)SnapcastStartup.IsChecked;
|
Properties.Settings.Default.snapcast_startup = (bool)SnapcastStartup.IsChecked;
|
||||||
|
Properties.Settings.Default.snapcast_window = (bool)SnapcastWindow.IsChecked;
|
||||||
Properties.Settings.Default.snapcast_path = SnapcastPath.Text;
|
Properties.Settings.Default.snapcast_path = SnapcastPath.Text;
|
||||||
Properties.Settings.Default.snapcast_port = int.Parse(SnapcastPort.Text, CultureInfo.InvariantCulture);
|
Properties.Settings.Default.snapcast_port = int.Parse(SnapcastPort.Text, CultureInfo.InvariantCulture);
|
||||||
Properties.Settings.Default.volume_offset = int.Parse(VolumeOffset.Text, CultureInfo.InvariantCulture);
|
Properties.Settings.Default.volume_offset = int.Parse(VolumeOffset.Text, CultureInfo.InvariantCulture);
|
||||||
|
Loading…
Reference in New Issue
Block a user