Exemple #1
0
        // T7E: Gets application ID for window
        public string GetApplicationIdForWindow(IntPtr windowHandle)
        {
            IPropertyStore propertyStore = TaskbarNativeMethods.GetWindowPropertyStore(windowHandle);

            PropVariant pv       = new PropVariant();
            PropertyKey AppIdKey = new PropertyKey(new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), 5);

            propertyStore.GetValue(ref AppIdKey, out pv);

            string retrievedAppId;

            if (pv.IsNullOrEmpty)
            {
                retrievedAppId = "";
            }
            else
            {
                retrievedAppId = (string)pv.Value;
            }

            Marshal.ReleaseComObject(propertyStore);
            pv.Clear();

            return(retrievedAppId);
        }
Exemple #2
0
        static string GetCurrentProcessAppId()
        {
            string appId;

            TaskbarNativeMethods.GetCurrentProcessExplicitAppUserModelID(out appId);
            return(appId);
        }
Exemple #3
0
        /// <summary>
        /// Gets the current process' explicit application user model id.
        /// </summary>
        /// <returns>The app id or null if no app id has been defined.</returns>
        private string GetCurrentProcessAppId()
        {
            string appId = string.Empty;

            TaskbarNativeMethods.GetCurrentProcessExplicitAppUserModelID(out appId);
            return(appId);
        }
 /// <summary>
 /// Sets the application user model id for a given window
 /// </summary>
 /// <param name="appId">The app id to set</param>
 /// <param name="window">Window that needs a specific application id</param>
 /// <remarks>AppId specifies a unique Application User Model ID (AppID) for the application or individual
 /// top-level window whose taskbar button will hold the custom JumpList built through the methods <see cref="Microsoft.WindowsAPICodePack.Taskbar.JumpList"/> class.
 /// By setting an appId for a specific window, the window will not be grouped with it's parent window/application. Instead it will have it's own taskbar button.</remarks>
 public void SetApplicationIdForSpecificWindow(System.Windows.Window window, string appId)
 {
     // Left as instance method, to follow singleton pattern.
     if (window != null)
     {
         TaskbarNativeMethods.SetWindowAppId((new WindowInteropHelper(window)).Handle, appId);
     }
 }
 /// <summary>
 /// Sets the application user model id for an individual window
 /// </summary>
 /// <param name="appId">The app id to set</param>
 /// <param name="windowHandle">Window handle for the window that needs a specific application id</param>
 /// <remarks>AppId specifies a unique Application User Model ID (AppID) for the application or individual
 /// top-level window whose taskbar button will hold the custom JumpList built through the methods <see cref="Microsoft.WindowsAPICodePack.Taskbar.JumpList"/> class.
 /// By setting an appId for a specific window, the window will not be grouped with it's parent window/application. Instead it will have it's own taskbar button.</remarks>
 public void SetApplicationIdForSpecificWindow(IntPtr windowHandle, string appId)
 {
     // Left as instance method, to follow singleton pattern.
     if (windowHandle != IntPtr.Zero)
     {
         TaskbarNativeMethods.SetWindowAppId(windowHandle, appId);
     }
 }
Exemple #6
0
 /// <summary>
 /// Reports document usage to the shell.
 /// </summary>
 /// <param name="destination">The full path of the file to report usage.</param>
 public static void AddToRecent(string destination)
 {
     TaskbarNativeMethods.SHAddToRecentDocs(destination);
 }
Exemple #7
0
 static void SetCurrentProcessAppId(string value)
 {
     TaskbarNativeMethods.SetCurrentProcessExplicitAppUserModelID(value);
 }
Exemple #8
0
 /// <summary>
 /// Sets the current process' explicit application user model id.
 /// </summary>
 /// <param name="appId">The application id.</param>
 private void SetCurrentProcessAppId(string appId)
 {
     TaskbarNativeMethods.SetCurrentProcessExplicitAppUserModelID(appId);
 }
 /// <summary>
 /// Sets the application user model id for a given window
 /// </summary>
 /// <param name="appId">The app id to set</param>
 /// <param name="window">Window that needs a specific application id</param>
 /// <remarks>AppId specifies a unique Application User Model ID (AppID) for the application or individual
 /// top-level window whose taskbar button will hold the custom JumpList built through the methods <see cref="Microsoft.WindowsAPICodePack.Taskbar.JumpList"/> class.
 /// By setting an appId for a specific window, the window will not be grouped with it's parent window/application. Instead it will have it's own taskbar button.</remarks>
 public void SetApplicationIdForSpecificWindow(System.Windows.Window window, string appId)
 {
     TaskbarNativeMethods.SetWindowAppId((new WindowInteropHelper(window)).Handle, appId);
 }
 /// <summary>
 /// Sets the application user model id for an individual window
 /// </summary>
 /// <param name="appId">The app id to set</param>
 /// <param name="windowHandle">Window handle for the window that needs a specific application id</param>
 /// <remarks>AppId specifies a unique Application User Model ID (AppID) for the application or individual
 /// top-level window whose taskbar button will hold the custom JumpList built through the methods <see cref="Microsoft.WindowsAPICodePack.Taskbar.JumpList"/> class.
 /// By setting an appId for a specific window, the window will not be grouped with it's parent window/application. Instead it will have it's own taskbar button.</remarks>
 public void SetApplicationIdForSpecificWindow(IntPtr windowHandle, string appId)
 {
     TaskbarNativeMethods.SetWindowAppId(windowHandle, appId);
 }