private static void CheckCurrentWindow() { var behavior = _taskbar.CheckIfForegroundWindowIntersectTaskbar(DesktopHandleSet, NonForegroundShowHandleSet, out var info); switch (behavior) { case TaskbarBehavior.DoNothing: _hidingCount = 0; break; case TaskbarBehavior.Pending: if (_taskbar.CheckIfDesktopShow(DesktopHandleSet, NonDesktopShowHandleSet)) { #if DEBUG Debug.WriteLine("try SHOW because of Desktop Show."); #endif _taskbar.ShowTaskar(); } _hidingCount = 0; break; case TaskbarBehavior.Show: #if DEBUG Debug.WriteLine( $"SHOW because of {info.Handle.ToString("x8")} Class Name: {info.Handle.GetClassName()}"); #endif _taskbar.ShowTaskar(); _hidingCount = 0; break; case TaskbarBehavior.Hide: if (info == _currentForegroundWindow && _hidingCount == 5) { return; } #if DEBUG Debug.WriteLine( $" Hide because of {info.Handle.ToString("x8")} Class Name: {info.Handle.GetClassName()}"); #endif _taskbar.HideTaskbar(); _hidingCount++; break; } _currentForegroundWindow = info; }
public bool Equals(ForegroundWindowInfo other) => Handle == other.Handle && Monitor == other.Monitor && Rect == other.Rect;
private static void CheckCurrentWindowReduceShowBar() { var behavior = _taskbar.CheckIfForegroundWindowIntersectTaskbar(DesktopHandleSet, NonForegroundShowHandleSet, out var info); switch (behavior) { case TaskbarBehavior.DoNothing: _hidingCount = 0; break; case TaskbarBehavior.Pending: if (_taskbar.CheckIfDesktopShow(DesktopHandleSet, NonDesktopShowHandleSet)) { #if DEBUG Debug.WriteLine("try SHOW because of Desktop Show."); #endif BeforeShowBar(); } _hidingCount = 0; break; case TaskbarBehavior.Show: // #if DEBUG // Debug.WriteLine( // $"try SHOW because of {info.Handle.ToString("x8")} Class Name: {info.Handle.GetClassName()}"); // #endif BeforeShowBar(); _hidingCount = 0; break; case TaskbarBehavior.Hide: if (info == _currentForegroundWindow && _hidingCount == 5) { return; } // Some third-party taskbar plugins will be attached to the taskbar location, but not embedded in the taskbar or desktop. if (!LastHideForegroundHandle.Contains(info.Handle) && info.Rect.AreaCompare()) { LastHideForegroundHandle.Push(info.Handle); } #if DEBUG Debug.WriteLine( $"HIDE because of {info.Handle.ToString("x8")} Class Name: {info.Handle.GetClassName()}"); #endif _taskbar.HideTaskbar(); _hidingCount++; break; } _currentForegroundWindow = info; }