Code move and delay made configurable
Moved code to CSongMenuFramework and made autoplay-delay configurable in config.xml as suggested in code review.
This commit is contained in:
1 parent
dad5f5ec11
commit
2fbb600272
6 files changed
+49
-70
No files matched your search
@@ -158,6 +158,9 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
}
|
||||
|
||||
protected int _AutoplayDelayinMs = CBase.Config.GetAutoplayPreviewDelay();
|
||||
protected System.Timers.Timer _AutoplayTimer = new System.Timers.Timer();
|
||||
|
||||
private SColorF _ColorInternal;
|
||||
protected SColorF _Color
|
||||
{
|
||||
@@ -204,6 +207,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
public virtual void Init()
|
||||
{
|
||||
_ResetPreview(false);
|
||||
_InitializeAutoplayTimer();
|
||||
_Initialized = true;
|
||||
}
|
||||
|
||||
@@ -358,6 +362,42 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_PreviewNrInternal = -1;
|
||||
}
|
||||
|
||||
protected void _PreviewSelectedSong()
|
||||
{
|
||||
_PreviewNr = _SelectionNr;
|
||||
}
|
||||
|
||||
protected void _InitializeAutoplayTimer()
|
||||
{
|
||||
_AutoplayTimer.Interval = _AutoplayDelayinMs;
|
||||
_AutoplayTimer.AutoReset = false;
|
||||
_AutoplayTimer.Elapsed += (object sender, System.Timers.ElapsedEventArgs e) =>
|
||||
{
|
||||
_PreviewSelectedSong();
|
||||
};
|
||||
}
|
||||
|
||||
protected void _AutoplayPreviewIfEnabled()
|
||||
{
|
||||
if (CBase.Config.GetAutoplayPreviews() == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
_PlayPreviewAfterDelay();
|
||||
}
|
||||
}
|
||||
|
||||
protected void _PlayPreviewAfterDelay()
|
||||
{
|
||||
if (!_AutoplayTimer.Enabled)
|
||||
{
|
||||
_AutoplayTimer.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_AutoplayTimer.Stop();
|
||||
_AutoplayTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
#region ThemeEdit
|
||||
public void MoveElement(int stepX, int stepY)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user