Example #1
0
        internal void UpdateThumbnailButton()
        {
            if (!AddedToTaskbar)
            {
                return;
            }

            // Get the array of thumbnail buttons in native format
            THUMBBUTTON[] nativeButtons = { Win32ThumbButton };

            HRESULT hr = TaskbarManager.Instance.TaskbarList.ThumbBarUpdateButtons(WindowHandle, 1, nativeButtons);

            if (!CoreErrorHelper.Succeeded((int)hr))
            {
                Marshal.ThrowExceptionForHR((int)hr);
            }
        }
Example #2
0
        void AddButtons(TaskbarWindow taskbarWindow)
        {
            // Add the buttons
            // Get the array of thumbnail buttons in native format
            var nativeButtons = Array.ConvertAll(taskbarWindow.ThumbnailButtons, i => i.Win32ThumbButton);

            // Add the buttons on the taskbar
            var hr = TaskbarManager.Instance.TaskbarList.ThumbBarAddButtons(taskbarWindow.WindowHandle, (uint)taskbarWindow.ThumbnailButtons.Length, nativeButtons);

            if (!CoreErrorHelper.Succeeded((int)hr))
            {
                Marshal.ThrowExceptionForHR((int)hr);
            }

            // Set the window handle on the buttons (for future updates)
            _buttonsAdded = true;
            Array.ForEach(taskbarWindow.ThumbnailButtons, UpdateHandle);
        }