void Windows_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { bool hasWindows = Windows.Any(); IconLight.Visibility = hasWindows ? Visibility.Visible : Visibility.Hidden; MenuMinimize.IsEnabled = MenuRestore.IsEnabled = MenuClose.IsEnabled = hasWindows; if (hasWindows) { Window window = Windows.First(); Text = StringUtils.LimitCharacters(window.Title, 50, 60); var bitmap = IconManager.GetIcon(window.FileName, SettingsManager.Settings.IconSize); Icon = bitmap; BlurredIcon = BitmapEffectHelper.GaussianBlur(bitmap, 2.5f); ChildIcon = IconManager.GetAppIcon(window.Hwnd); if (WindowManager.Manager.Windows.Count(w => w.FileName == window.FileName) > 1) { IconImageSmall.Visibility = Visibility.Visible; } } if (Info.Pinned && string.IsNullOrEmpty(Info.ImagePath)) { var bitmap = IconManager.GetIcon(Info.Path, SettingsManager.Settings.IconSize); Icon = bitmap; BlurredIcon = BitmapEffectHelper.GaussianBlur(bitmap, 2.5f); } }
void Manager_ActiveWindowRectChanged(object sender, Handlers.WindowRectEventArgs e) { if (!SettingsManager.Settings.AutoHide) { return; } Application.Current.Dispatcher.Invoke(() => { Rect rect = e.Rect; // Implicit conversion to Windows.Rect bool intersects = rect.IntersectsWith(Rect); // Check if the active window is intersecting with the dock. bool hover = DockIcons.IsMouseOver; var window = new Model.Window(WindowManager.Manager.ActiveWindow); bool isDesktop = window.FileName.EndsWith("explorer.exe") && window.Title == ""; if (intersects && !hover && !isDesktop) { HideDock(); } else { ShowDock(); } }); }