コード例 #1
0
ファイル: VirtualDesktop.cs プロジェクト: jluetzenberg/WDSwap
        /// <summary>
        /// Returns true if application for window <hWnd> is pinned to all desktops
        /// </summary>
        /// <param name="hWnd"></param>
        /// <returns></returns>
        public static bool IsApplicationPinned(IntPtr hWnd)
        {
            if (hWnd == IntPtr.Zero)
            {
                throw new ArgumentNullException();
            }

            return(DesktopManager.VirtualDesktopPinnedApps.IsAppIdPinned(DesktopManager.GetAppId(hWnd)));
        }
コード例 #2
0
ファイル: VirtualDesktop.cs プロジェクト: jluetzenberg/WDSwap
        /// <summary>
        /// pin application for window <hWnd> to all desktops
        /// </summary>
        /// <param name="hWnd"></param>
        /// [Obsolete("This method will likely fail, as its sister method fails. It is kept here for reference.")]
        public static void PinApplication(IntPtr hWnd)
        {
            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);
            }
        }
コード例 #3
0
ファイル: VirtualDesktop.cs プロジェクト: jluetzenberg/WDSwap
        /// <summary>
        /// unpin application for window <hWnd> from all desktops
        /// </summary>
        /// <param name="hWnd"></param>
        /// [Obsolete("This method will likely fail, as its sister method fails. It is kept here for reference.")]
        public static void UnpinApplication(IntPtr hWnd)
        {
            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);
            }
        }