add volume

This commit is contained in:
Oleksandr Bezdieniezhnykh
2024-05-26 15:11:16 +03:00
parent f179a5f0ca
commit e317ce2310
6 changed files with 167 additions and 20 deletions
+9 -5
View File
@@ -74,7 +74,7 @@ public partial class MainWindow
_helpWindow.Show();
}
public void BlinkHelp(string helpText, int times = 3)
public void BlinkHelp(string helpText, int times = 2)
{
_ = Task.Run(async () =>
{
@@ -112,7 +112,7 @@ public partial class MainWindow
_mediaPlayer.PositionChanged += (o, args) =>
{
Dispatcher.Invoke(() => videoSlider.Value = _mediaPlayer.Position * videoSlider.Maximum);
Dispatcher.Invoke(() => VideoSlider.Value = _mediaPlayer.Position * VideoSlider.Maximum);
Dispatcher.Invoke(() => StatusClock.Text = $"{TimeSpan.FromMilliseconds(_mediaPlayer.Time):mm\\:ss} / {_formState.CurrentVideoLength:mm\\:ss}");
var curTime = _formState.GetTimeName(TimeSpan.FromMilliseconds(_mediaPlayer.Time));
@@ -149,11 +149,13 @@ public partial class MainWindow
};
videoSlider.ValueChanged += (value, newValue) =>
_mediaPlayer.Position = (float)(newValue / videoSlider.Maximum);
VideoSlider.ValueChanged += (value, newValue) =>
_mediaPlayer.Position = (float)(newValue / VideoSlider.Maximum);
videoSlider.KeyDown += (sender, args) => _mediator.Publish(new KeyEvent(sender, args));
VideoSlider.KeyDown += (sender, args) => _mediator.Publish(new KeyEvent(sender, args));
Volume.ValueChanged += (_, newValue) => _mediator.Publish(new VolumeChangedEvent((int)newValue));
SizeChanged += (sender, args) =>
{
if (!_suspendLayout)
@@ -257,6 +259,8 @@ public partial class MainWindow
private void RemoveSelectedClick(object sender, RoutedEventArgs e) => _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.RemoveSelectedAnns));
private void RemoveAllClick(object sender, RoutedEventArgs e) => _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.RemoveAllAnns));
private void TurnOffVolume(object sender, RoutedEventArgs e) => _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.TurnOffVolume));
private void TurnOnVolume(object sender, RoutedEventArgs e) => _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.TurnOnVolume));
private void OpenHelpWindowClick(object sender, RoutedEventArgs e)
{