Loading files
797882a6aThis file is pinned to the selected release. Download the original to open it in your design tool.
using System;
using System.Windows.Threading;
using IDE.Controls.WPF.Docking.Layout;
namespace IDE.Controls.WPF.Docking.Controls;
internal class AutoHideWindowManager
{
#region Members
private DockingManager _manager;
private WeakReference _currentAutohiddenAnchor = null;
private DispatcherTimer _closeTimer = null;
#endregion
#region Constructors
internal AutoHideWindowManager(DockingManager manager)
{
_manager = manager;
this.SetupCloseTimer();
}
#endregion
#region Private Methods
public void ShowAutoHideWindow(LayoutAnchorControl anchor)
{
if (_currentAutohiddenAnchor.GetValueOrDefault<LayoutAnchorControl>() != anchor)
{
StopCloseTimer();
_currentAutohiddenAnchor = new WeakReference(anchor);
_manager.AutoHideWindow.Show(anchor);
StartCloseTimer();
}
}
public void HideAutoWindow(LayoutAnchorControl anchor = null)
{
if (anchor == null ||
anchor == _currentAutohiddenAnchor.GetValueOrDefault<LayoutAnchorControl>())
{
StopCloseTimer();
}
else
System.Diagnostics.Debug.Assert(false);
}
private void SetupCloseTimer()
{
_closeTimer = new DispatcherTimer(DispatcherPriority.Background);
_closeTimer.Interval = TimeSpan.FromMilliseconds(1500);
_closeTimer.Tick += (s, e) =>
{
if (_manager.AutoHideWindow.IsWin32MouseOver ||
( (LayoutAnchorable)_manager.AutoHideWindow.Model ).IsActive ||
_manager.AutoHideWindow.IsResizing)
return;
StopCloseTimer();
};
}
private void StartCloseTimer()
{
_closeTimer.Start();
}
private void StopCloseTimer()
{
_closeTimer.Stop();
_manager.AutoHideWindow.Hide();
_currentAutohiddenAnchor = null;
}
#endregion
}