public void Register(IntPtr hWnd) { lock (this._sync) { if (this._pinnedWindows.ContainsKey(hWnd)) return; var external = new ExternalWindow(hWnd); var chrome = new WindowChrome { BorderThickness = new Thickness(4.0), Top = new PinMarker(), }; chrome.Attach(external); external.Closed += (sender, e) => this.Unregister(hWnd); this._pinnedWindows[hWnd] = new PinnedWindow(external, chrome); } }
private static async void SetGlowingForActiveWindow() { await Task.Delay(2500); var hWnd = User32.GetForegroundWindow(); var appHandles = Application.Current.Windows .OfType<Window>() .Select(x => PresentationSource.FromVisual(x) as HwndSource) .Where(x => x != null) .Select(x => x.Handle) .ToArray(); if (appHandles.All(x => x != hWnd)) { var external = new ExternalWindow(hWnd); var chrome = new WindowChrome(); chrome.Attach(external); } }
public static void SetInstance(Window window, WindowChrome value) { window.SetValue(InstanceProperty, value); }
public PinnedWindow(ExternalWindow window, WindowChrome chrome) { this._window = window; this._chrome = chrome; }