/// <summary> /// Adds a new tabbed thumbnail to the taskbar. /// </summary> /// <param name="preview">Thumbnail preview for a specific window handle or control. The preview /// object can be initialized with specific properties for the title, bitmap, and tooltip.</param> /// <exception cref="System.ArgumentException">If the tabbed thumbnail has already been added</exception> public void AddThumbnailPreview(TabbedThumbnail preview) { if (preview == null) { throw new ArgumentNullException("preview"); } // UI Element has a windowHandle of zero. if (preview.WindowHandle == IntPtr.Zero) { if (_tabbedThumbnailCacheWPF.ContainsKey(preview.WindowsControl)) { throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewAdded, "preview"); } _tabbedThumbnailCacheWPF.Add(preview.WindowsControl, preview); } else { // Regular control with a valid handle if (_tabbedThumbnailCache.ContainsKey(preview.WindowHandle)) { throw new ArgumentException(LocalizedMessages.ThumbnailManagerPreviewAdded, "preview"); } _tabbedThumbnailCache.Add(preview.WindowHandle, preview); } TaskbarWindowManager.AddTabbedThumbnail(preview); preview.InvalidatePreview(); // Note: Why this here? }