Misc. fixes, added volume offset option

This commit is contained in:
2021-08-27 18:45:53 +02:00
parent 89ddb81840
commit 8896c13442
9 changed files with 99 additions and 41 deletions

View File

@ -75,11 +75,15 @@ namespace unison
mpd.Prev();
break;
case VK_VOLUME_DOWN:
mpd._currentVolume -= 5;
mpd._currentVolume -= Properties.Settings.Default.volume_offset;
if (mpd._currentVolume < 0)
mpd._currentVolume = 0;
mpd.SetVolume(mpd._currentVolume);
break;
case VK_VOLUME_UP:
mpd._currentVolume += 5;
mpd._currentVolume += Properties.Settings.Default.volume_offset;
if (mpd._currentVolume > 100)
mpd._currentVolume = 100;
mpd.SetVolume(mpd._currentVolume);
break;
case VK_MEDIA_PLAY_PAUSE:
@ -94,8 +98,17 @@ namespace unison
}
else
{
AppWindow.Hide();
AppWindow.WindowState = WindowState.Minimized;
if (AppWindow.IsActive)
{
AppWindow.Hide();
AppWindow.WindowState = WindowState.Minimized;
}
else // not minimized but not in front
{
AppWindow.Show();
AppWindow.Activate();
AppWindow.WindowState = WindowState.Normal;
}
}
break;
}

View File

@ -59,7 +59,6 @@ namespace unison
_elapsedTimer = new System.Timers.Timer(500);
_elapsedTimer.Elapsed += new System.Timers.ElapsedEventHandler(ElapsedTimer);
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(2);
timer.Tick += QueryStatus;
@ -228,7 +227,8 @@ namespace unison
_elapsedTimer.Stop();
}
await _mpd.MpdQueryAlbumArt(_currentSong.File, false);
if (_currentSong != null)
await _mpd.MpdQueryAlbumArt(_currentSong.File, false);
}
public SongInfoEx GetCurrentSong() => _currentSong;
@ -291,5 +291,10 @@ namespace unison
{
return _currentStatus?.MpdState == MPDCtrl.Models.Status.MpdPlayState.Play;
}
public string GetVersion()
{
return _mpd.MpdVerText;
}
}
}