Merge pull request #1813 from ivandrofly/tsr

[VideoPlayerContainer] - Thread-safe invoke.
This commit is contained in:
Nikolaj Olsson 2016-06-29 05:36:37 +02:00 committed by GitHub
commit 8918e96039

View File

@ -916,8 +916,7 @@ namespace Nikse.SubtitleEdit.Controls
HideAllPlayImages();
_pictureBoxPlayDown.Visible = true;
_pictureBoxPlayDown.BringToFront();
if (OnButtonClicked != null)
OnButtonClicked.Invoke(sender, e);
OnButtonClicked?.Invoke(sender, e);
}
private void PictureBoxPlayOverMouseUp(object sender, MouseEventArgs e)
@ -961,8 +960,7 @@ namespace Nikse.SubtitleEdit.Controls
HideAllPauseImages();
_pictureBoxPauseDown.Visible = true;
}
if (OnButtonClicked != null)
OnButtonClicked.Invoke(sender, e);
OnButtonClicked?.Invoke(sender, e);
}
private void PictureBoxPauseOverMouseUp(object sender, MouseEventArgs e)
@ -1005,8 +1003,7 @@ namespace Nikse.SubtitleEdit.Controls
HideAllStopImages();
_pictureBoxStopDown.Visible = true;
}
if (OnButtonClicked != null)
OnButtonClicked.Invoke(sender, e);
OnButtonClicked?.Invoke(sender, e);
}
private void PictureBoxStopOverMouseUp(object sender, MouseEventArgs e)
@ -1059,8 +1056,7 @@ namespace Nikse.SubtitleEdit.Controls
private void PictureBoxFullscreenOverMouseDown(object sender, MouseEventArgs e)
{
HideAllFullscreenImages();
if (OnButtonClicked != null)
OnButtonClicked.Invoke(sender, e);
OnButtonClicked?.Invoke(sender, e);
}
private void PictureBoxFullscreenOverMouseUp(object sender, MouseEventArgs e)
@ -1105,8 +1101,7 @@ namespace Nikse.SubtitleEdit.Controls
HideAllMuteImages();
_pictureBoxMuteDown.Visible = true;
}
if (OnButtonClicked != null)
OnButtonClicked.Invoke(sender, e);
OnButtonClicked?.Invoke(sender, e);
}
private void PictureBoxMuteOverMouseUp(object sender, MouseEventArgs e)
@ -1121,8 +1116,7 @@ namespace Nikse.SubtitleEdit.Controls
Mute = false;
HideAllMuteImages();
_pictureBoxMute.Visible = true;
if (OnButtonClicked != null)
OnButtonClicked.Invoke(sender, e);
OnButtonClicked?.Invoke(sender, e);
}
#endregion Mute buttons
@ -1229,15 +1223,13 @@ namespace Nikse.SubtitleEdit.Controls
private void PictureBoxProgressbarBackgroundMouseDown(object sender, MouseEventArgs e)
{
SetProgressBarPosition(e.X - 4);
if (OnButtonClicked != null)
OnButtonClicked.Invoke(sender, e);
OnButtonClicked?.Invoke(sender, e);
}
private void PictureBoxProgressBarMouseDown(object sender, MouseEventArgs e)
{
SetProgressBarPosition(e.X + 2);
if (OnButtonClicked != null)
OnButtonClicked.Invoke(sender, e);
OnButtonClicked?.Invoke(sender, e);
}
public void RefreshProgressBar()
@ -1283,15 +1275,13 @@ namespace Nikse.SubtitleEdit.Controls
private void PictureBoxVolumeBarBackgroundMouseDown(object sender, MouseEventArgs e)
{
SetVolumeBarPosition(e.X - 6);
if (OnButtonClicked != null)
OnButtonClicked.Invoke(sender, e);
OnButtonClicked?.Invoke(sender, e);
}
private void PictureBoxVolumeBarMouseDown(object sender, MouseEventArgs e)
{
SetVolumeBarPosition(e.X + 2);
if (OnButtonClicked != null)
OnButtonClicked.Invoke(sender, e);
OnButtonClicked?.Invoke(sender, e);
}
private void RefreshVolumeBar()
@ -1321,8 +1311,7 @@ namespace Nikse.SubtitleEdit.Controls
_pictureBoxPause.BringToFront();
RefreshProgressBar();
}
if (OnButtonClicked != null)
OnButtonClicked.Invoke(null, null);
OnButtonClicked?.Invoke(null, null);
}
public void Stop()
@ -1334,8 +1323,7 @@ namespace Nikse.SubtitleEdit.Controls
_pictureBoxPlay.Visible = true;
RefreshProgressBar();
}
if (OnButtonClicked != null)
OnButtonClicked.Invoke(null, null);
OnButtonClicked?.Invoke(null, null);
}
public void Pause()
@ -1364,11 +1352,7 @@ namespace Nikse.SubtitleEdit.Controls
{
get
{
if (VideoPlayer != null)
{
return VideoPlayer.IsPaused;
}
return false;
return VideoPlayer?.IsPaused == true;
}
}