public void SubmitThumbnailButtons(bool add)
        {
            int hr = -1;

            if (MainThread.MainWindow.IsDisposed ||
                MainThread.MainWindow.Disposing)
            {
                return;
            }

            if (_taskbarList != null && _buttons.Count > 0)
            {
                if (add || !_addedOnce)
                {
                    hr = _taskbarList.ThumbBarAddButtons(MainThread.MainWindow.Handle,
                                                         (uint)Math.Min(_buttons.Count, 7), _buttons.ToArray());

                    _addedOnce = true;
                }
                else
                {
                    hr = _taskbarList.ThumbBarUpdateButtons(MainThread.MainWindow.Handle,
                                                            (uint)Math.Min(_buttons.Count, 7), _buttons.ToArray());
                }
            }

            _buttons.Clear();
        }
Exemple #2
0
 internal static void UpdateThumbnailButtons(IntPtr hwnd, params ThumbButton[] buttons)
 {
     if (IsInitialized)
     {
         HResult res = taskbar.ThumbBarUpdateButtons(hwnd, (uint)buttons.Length, buttons);
         if (res != HResult.Ok)
         {
             throw new COMException("Cannot update thumbnail button(s): " + res);
         }
     }
 }
Exemple #3
0
 /// <summary>
 /// Shows, enables, disables, or hides buttons in a thumbnail toolbar as required by the window's current state. A thumbnail toolbar is a toolbar
 /// embedded in a thumbnail image of a window in a taskbar button flyout.
 /// </summary>
 /// <param name="parent">The window whose thumbnail representation contains the toolbar.</param>
 /// <param name="buttons">
 /// An array of THUMBBUTTON structures. Each THUMBBUTTON defines an individual button. If the button already exists (the iId value is already defined),
 /// then that existing button is updated with the information provided in the structure.
 /// </param>
 public static void ThumbBarUpdateButtons(IWin32Window parent, THUMBBUTTON[] buttons)
 {
     Validate7OrLater();
     if (parent == null)
     {
         throw new ArgumentNullException(nameof(parent));
     }
     if (buttons == null)
     {
         throw new ArgumentNullException(nameof(buttons));
     }
     taskbar4?.ThumbBarUpdateButtons(parent.Handle, (uint)buttons.Length, buttons);
 }