public UnityEventFunctionQuickDocPresenter(UnityEventFunction eventFunction, IClrDeclaredElement element,
                                            QuickDocTypeMemberProvider quickDocTypeMemberProvider,
                                            ITheming theming, HelpSystem helpSystem)
     : this(eventFunction, null, element, quickDocTypeMemberProvider, theming, helpSystem)
 {
     myQuickDocTypeMemberProvider = quickDocTypeMemberProvider;
 }
 public UnityEventFunctionQuickDocProvider(ISolution solution, UnityApi unityApi,
                                           DocumentManager documentManager, QuickDocTypeMemberProvider quickDocTypeMemberProvider,
                                           HelpSystem helpSystem, ITheming theming)
 {
     mySolution = solution;
     myUnityApi = unityApi;
     myDocumentManager = documentManager;
     myQuickDocTypeMemberProvider = quickDocTypeMemberProvider;
     myHelpSystem = helpSystem;
     myTheming = theming;
 }
        public bool ShowHelp(string keyword, HelpSystem.HelpKind kind)
        {
            if (kind != HelpSystem.HelpKind.Msdn) return false;
            if (!IsUnityKeyword(keyword)) return false;

            keyword = StripPrefix(keyword);

            var uri = GetUri(keyword);
            myUriOpener.OpenUri(uri);

            return true;
        }
 public UnityEventFunctionQuickDocPresenter(UnityEventFunction eventFunction, string parameterName,
                                            IClrDeclaredElement element,
                                            QuickDocTypeMemberProvider quickDocTypeMemberProvider,
                                            ITheming theming, HelpSystem helpSystem)
 {
     myEventFunction = eventFunction;
     myParameterName = parameterName;
     myQuickDocTypeMemberProvider = quickDocTypeMemberProvider;
     myTheming = theming;
     myHelpSystem = helpSystem;
     myEnvoy = new DeclaredElementEnvoy<IClrDeclaredElement>(element);
 }
Example #5
0
 public Tree(Planet planet)
     : base(planet)
 {
     this.planet = planet;
     this.growth = 0.0f;
     this.isMature = false;
     this.PositionOnPlanet = Vector2.Zero;
     this.DrawOrder = 0;
     this.CoconutCount = 0;
     VersusScreen.Instance.Components.Add(this);
     PositionOnPlanet.X = (float) Math.PI / 2;
     PositionOnPlanet.Y = spriteHeight / 2.0f;
     HelpCoconut = new HelpSystem(this, "help_coconut");
     HelpCoconut.FadePercent = 0.0f;
 }
 /// <summary>
 /// Constructor for CommandHelpProvider
 /// </summary>
 internal ScriptCommandHelpProvider(HelpSystem helpSystem)
     : base(helpSystem)
 {
 }
Example #7
0
        /// <summary>
        /// Implements the ProcessRecord() method for get-help command.
        /// </summary>
        protected override void ProcessRecord()
        {
            HelpSystem helpSystem = this.Context.HelpSystem;

            try
            {
#if !UNIX
                if (this.ShowWindow)
                {
                    this.graphicalHostReflectionWrapper = GraphicalHostReflectionWrapper.GetGraphicalHostReflectionWrapper(this, "Microsoft.PowerShell.Commands.Internal.HelpWindowHelper");
                }
#endif
                helpSystem.OnProgress += new HelpSystem.HelpProgressHandler(HelpSystem_OnProgress);

                bool         failed       = false;
                HelpCategory helpCategory = ToHelpCategory(Category, ref failed);

                if (failed)
                {
                    return;
                }

                // Validate input parameters
                ValidateAndThrowIfError(helpCategory);

                HelpRequest helpRequest = new HelpRequest(this.Name, helpCategory);

                helpRequest.Provider        = _provider;
                helpRequest.Component       = Component;
                helpRequest.Role            = Role;
                helpRequest.Functionality   = Functionality;
                helpRequest.ProviderContext = new ProviderContext(
                    this.Path,
                    this.Context.Engine.Context,
                    this.SessionState.Path);
                helpRequest.CommandOrigin = this.MyInvocation.CommandOrigin;

                // the idea is to use yield statement in the help lookup to speed up
                // perceived user experience....So HelpSystem.GetHelp returns an
                // IEnumerable..
                IEnumerable <HelpInfo> helpInfos = helpSystem.GetHelp(helpRequest);
                // HelpCommand acts differently when there is just one help object and when
                // there are more than one object...so handling this behavior through
                // some variables.
                HelpInfo firstHelpInfoObject = null;
                int      countOfHelpInfos    = 0;
                foreach (HelpInfo helpInfo in helpInfos)
                {
                    // honor Ctrl-C from user.
                    if (IsStopping)
                    {
                        return;
                    }

                    if (countOfHelpInfos == 0)
                    {
                        firstHelpInfoObject = helpInfo;
                    }
                    else
                    {
                        // write first help object only once.
                        if (firstHelpInfoObject != null)
                        {
                            WriteObjectsOrShowOnlineHelp(firstHelpInfoObject, false);
                            firstHelpInfoObject = null;
                        }

                        WriteObjectsOrShowOnlineHelp(helpInfo, false);
                    }

                    countOfHelpInfos++;
                }

                _timer.Stop();

#if LEGACYTELEMETRY
                if (!string.IsNullOrEmpty(Name))
                {
                    Microsoft.PowerShell.Telemetry.Internal.TelemetryAPI.ReportGetHelpTelemetry(Name, countOfHelpInfos, _timer.ElapsedMilliseconds, _updatedHelp);
                }
#endif
                // Write full help as there is only one help info object
                if (countOfHelpInfos == 1)
                {
                    WriteObjectsOrShowOnlineHelp(firstHelpInfoObject, true);
                }
                else if (_showOnlineHelp && (countOfHelpInfos > 1))
                {
                    throw PSTraceSource.NewInvalidOperationException(HelpErrors.MultipleOnlineTopicsNotSupported, "Online");
                }

                // show errors only if there is no wildcard search or VerboseHelpErrors is true.
                if (((countOfHelpInfos == 0) && (!WildcardPattern.ContainsWildcardCharacters(helpRequest.Target))) ||
                    helpSystem.VerboseHelpErrors)
                {
                    // Check if there is any error happened. If yes,
                    // pipe out errors.
                    if (helpSystem.LastErrors.Count > 0)
                    {
                        foreach (ErrorRecord errorRecord in helpSystem.LastErrors)
                        {
                            WriteError(errorRecord);
                        }
                    }
                }
            }
            finally
            {
                helpSystem.OnProgress -= new HelpSystem.HelpProgressHandler(HelpSystem_OnProgress);
                HelpSystem_OnComplete();

                // finally clear the ScriptBlockAst -> Token[] cache
                helpSystem.ClearScriptBlockTokenCache();
            }
        }
 /// <summary>
 /// Constructor for HelpProviderWithFullCache.
 /// </summary>
 internal HelpProviderWithFullCache(HelpSystem helpSystem) : base(helpSystem)
 {
 }
Example #9
0
 /// <summary>
 /// Constructor for HelpProvider.
 /// </summary>
 internal HelpProvider(HelpSystem helpSystem)
 {
     _helpSystem = helpSystem;
 }