Exemplo n.º 1
0
 public static bool IsApplicationPinned(IntPtr hWnd)
 { // Returns true if application for window <hWnd> is pinned to all desktops
     if (hWnd == IntPtr.Zero)
     {
         throw new ArgumentNullException();
     }
     return(DesktopManager.VirtualDesktopPinnedApps.IsAppIdPinned(DesktopManager.GetAppId(hWnd)));
 }
Exemplo n.º 2
0
        public static void PinApplication(IntPtr hWnd)
        { // pin application for window <hWnd> to all desktops
            if (hWnd == IntPtr.Zero)
            {
                throw new ArgumentNullException();
            }
            string appId = DesktopManager.GetAppId(hWnd);

            if (!DesktopManager.VirtualDesktopPinnedApps.IsAppIdPinned(appId))
            { // pin only if not already pinned
                DesktopManager.VirtualDesktopPinnedApps.PinAppID(appId);
            }
        }
Exemplo n.º 3
0
        public static void UnpinApplication(IntPtr hWnd)
        { // unpin application for window <hWnd> from all desktops
            if (hWnd == IntPtr.Zero)
            {
                throw new ArgumentNullException();
            }
            var    view  = hWnd.GetApplicationView();
            string appId = DesktopManager.GetAppId(hWnd);

            if (DesktopManager.VirtualDesktopPinnedApps.IsAppIdPinned(appId))
            { // unpin only if already pinned
                DesktopManager.VirtualDesktopPinnedApps.UnpinAppID(appId);
            }
        }