Exemplo n.º 1
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;

            Shell32.GetCurrentProcessExplicitAppUserModelID(out appId);
            return(appId);
        }
        /// <summary>
        /// 各エディションに対するAppUserModelIdを取得する
        /// </summary>
        /// <param name="edition">DTE.Editionの値</param>
        /// <param name="version"></param>
        /// <returns>対応するAppUserModelId</returns>
        string EditionToAppUserModelId(string edition, string version)
        {
            switch (edition)
            {
            case "WD Express":
                return("VWDExpress." + version);

            case "Desktop Express":
                return("WDExpress." + version);

            case "VSWin Express":
                return("VSWinExpress." + version);

            case "PD Express":
                return("VPDExpress." + version);
            }
            // detect AppUserModelId
            var s = Shell32.GetCurrentProcessExplicitAppUserModelID();

            return(!string.IsNullOrEmpty(s) ? s : ApplicationID + version);
        }