示例#1
0
        /// <summary>
        /// Applies relaunch command and jump list modifications to a Windows 7 taskbar entry.
        /// </summary>
        /// <param name="windowHandle">A handle to the window the taskbar entry belongs to.</param>
        private void ConfigureTaskbar(IntPtr windowHandle)
        {
            if (_relaunchInformation == null || !WindowsUtils.IsWindows7)
            {
                return;
            }

            // Add correct relaunch information
            string commandPath = (_relaunchInformation.NeedsTerminal ? _relaunchControl.CommandPathCli : _relaunchControl.CommandPathGui + " --no-wait"); // Select best suited launcher
            string icon        = (string.IsNullOrEmpty(_relaunchInformation.IconPath) ? null : _relaunchInformation.IconPath + ",0");                     // Always use the first icon in the file

            WindowsTaskbar.SetWindowAppID(windowHandle,
                                          _relaunchInformation.AppID, '"' + commandPath + "\" run " + _relaunchInformation.Target, icon, _relaunchInformation.Name);

            // Add jump list entry to select an alternative application version
            WindowsTaskbar.AddTaskLinks(_relaunchInformation.AppID, new[] { new WindowsTaskbar.ShellLink("Versions", _relaunchControl.CommandPathGui, "run --customize " + _relaunchInformation.Target) });
        }