Пример #1
0
        /// <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;
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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;
            }
        }
Пример #5
0
        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;
            }
        }
Пример #6
0
        /// <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;
            }
        }