/// <summary> /// Remove the tabbed thumbnail from the taskbar. /// </summary> /// <param name="windowsControl">TabbedThumbnail associated with the WPF Control (UIElement) that /// is to be removed from the taskbar</param> public void RemoveThumbnailPreview(UIElement windowsControl) { if (windowsControl == null) { throw new ArgumentNullException("windowsControl"); } if (!_tabbedThumbnailCacheWPF.ContainsKey(windowsControl)) { throw new ArgumentException(LocalizedMessages.ThumbnailManagerControlNotAdded, "windowsControl"); } TaskbarWindowManager.UnregisterTab(_tabbedThumbnailCacheWPF[windowsControl].TaskbarWindow); _tabbedThumbnailCacheWPF.Remove(windowsControl); TaskbarWindow taskbarWindow = TaskbarWindowManager.GetTaskbarWindow(windowsControl, TaskbarProxyWindowType.TabbedThumbnail); if (taskbarWindow != null) { if (TaskbarWindowManager._taskbarWindowList.Contains(taskbarWindow)) { TaskbarWindowManager._taskbarWindowList.Remove(taskbarWindow); } taskbarWindow.Dispose(); taskbarWindow = null; } }
private static bool DispatchSystemCommandMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow) { if (m.Msg == (int)WindowMessage.SystemCommand) { if (((int)m.WParam) == TabbedThumbnailNativeMethods.ScClose) { // Raise the event if (taskbarWindow.TabbedThumbnail.OnTabbedThumbnailClosed()) { // Remove the taskbar window from our internal list if (_taskbarWindowList.Contains(taskbarWindow)) { _taskbarWindowList.Remove(taskbarWindow); } taskbarWindow.Dispose(); taskbarWindow = null; } } else if (((int)m.WParam) == TabbedThumbnailNativeMethods.ScMaximize) { // Raise the event taskbarWindow.TabbedThumbnail.OnTabbedThumbnailMaximized(); } else if (((int)m.WParam) == TabbedThumbnailNativeMethods.ScMinimize) { // Raise the event taskbarWindow.TabbedThumbnail.OnTabbedThumbnailMinimized(); } return(true); } return(false); }
private static bool DispatchNCDestroyMessage(ref System.Windows.Forms.Message m, TaskbarWindow taskbarWindow) { if (m.Msg == (int)WindowMessage.NCDestroy) { // Raise the event taskbarWindow.TabbedThumbnail.OnTabbedThumbnailClosed(); // Remove the taskbar window from our internal list if (_taskbarWindowList.Contains(taskbarWindow)) { _taskbarWindowList.Remove(taskbarWindow); } taskbarWindow.Dispose(); return(true); } return(false); }
internal static void AddThumbnailButtons(System.Windows.UIElement control, params ThumbnailToolBarButton[] buttons) { // Try to get an existing taskbar window for this user uielement TaskbarWindow taskbarWindow = GetTaskbarWindow(control, TaskbarProxyWindowType.ThumbnailToolbar); TaskbarWindow temp = null; try { AddThumbnailButtons( taskbarWindow ?? (temp = new TaskbarWindow(control, buttons)), taskbarWindow == null, buttons); } catch { if (temp != null) { temp.Dispose(); } throw; } }
internal static void AddThumbnailButtons(IntPtr userWindowHandle, params ThumbnailToolBarButton[] buttons) { // Try to get an existing taskbar window for this user windowhandle TaskbarWindow taskbarWindow = GetTaskbarWindow(userWindowHandle, TaskbarProxyWindowType.ThumbnailToolbar); TaskbarWindow temp = null; try { AddThumbnailButtons( taskbarWindow ?? (temp = new TaskbarWindow(userWindowHandle, buttons)), taskbarWindow == null, buttons); } catch { if (temp != null) { temp.Dispose(); } throw; } }
/// <summary> /// Remove the tabbed thumbnail from the taskbar. /// </summary> /// <param name="windowHandle">TabbedThumbnail associated with the window handle that /// is to be removed from the taskbar</param> public void RemoveThumbnailPreview(IntPtr windowHandle) { if (!_tabbedThumbnailCache.ContainsKey(windowHandle)) { throw new ArgumentException(LocalizedMessages.ThumbnailManagerControlNotAdded, "windowHandle"); } TaskbarWindowManager.UnregisterTab(_tabbedThumbnailCache[windowHandle].TaskbarWindow); _tabbedThumbnailCache.Remove(windowHandle); TaskbarWindow taskbarWindow = TaskbarWindowManager.GetTaskbarWindow(windowHandle, TaskbarProxyWindowType.TabbedThumbnail); if (taskbarWindow != null) { if (TaskbarWindowManager._taskbarWindowList.Contains(taskbarWindow)) { TaskbarWindowManager._taskbarWindowList.Remove(taskbarWindow); } taskbarWindow.Dispose(); taskbarWindow = null; } }