Esempio n. 1
0
        private void UpdateIntellisenceDropDown(string text)
        {
            AutoCompletionEventArgs autoCompletionEventArgs = new AutoCompletionEventArgs
            {
                Prefix = text
            };

            this.PopulateAutoCompleteList?.Invoke(this, autoCompletionEventArgs);

            PopulateListBox(autoCompletionEventArgs.AutoCompleteValues);
        }
 private void PopulateAutoCompleteList(object sender, AutoCompletionEventArgs e)
 {
     e.AutoCompleteValues = this.ruleParser.GetExpressionCompletions(e.Prefix);
 }
Esempio n. 3
0
        private void ShowToolTip(int charIndex, string prefix)
        {
            Point clientPoint = this.GetPositionFromCharIndex(charIndex - 1);

            clientPoint.Y += (int)Math.Ceiling(this.Font.GetHeight()) + 2;
            clientPoint.X -= 6;

            AutoCompletionEventArgs autoCompletionEventArgs = new AutoCompletionEventArgs
            {
                Prefix = prefix
            };

            if (this.PopulateToolTipList != null)
            {
                this.PopulateToolTipList(this, autoCompletionEventArgs);

                if (autoCompletionEventArgs.AutoCompleteValues != null)
                {
                    StringBuilder toolTipText = new StringBuilder();
                    bool          firstMethod = true;
                    foreach (MemberInfo memberInfo in autoCompletionEventArgs.AutoCompleteValues)
                    {
                        if (firstMethod)
                        {
                            firstMethod = false;
                        }
                        else
                        {
                            toolTipText.Append("\n");
                        }

                        ParameterInfo[] parameters = null;

                        if (memberInfo is MethodInfo methodInfo)
                        {
                            toolTipText.Append(RuleDecompiler.DecompileType(methodInfo.ReturnType));
                            toolTipText.Append(" ");
                            toolTipText.Append(methodInfo.Name);
                            toolTipText.Append("(");

                            parameters = methodInfo.GetParameters();
                        }
                        else
                        {
                            // Must be constructor... if not, the best thing to do is let it throw "invalid cast".
                            ConstructorInfo ctorInfo = (ConstructorInfo)memberInfo;

                            toolTipText.Append(RuleDecompiler.DecompileType(ctorInfo.DeclaringType));
                            toolTipText.Append("(");

                            parameters = ctorInfo.GetParameters();
                        }


                        if (parameters != null && parameters.Length > 0)
                        {
                            int lastParamIndex = parameters.Length - 1;

                            // Append the first parameter
                            AppendParameterInfo(toolTipText, parameters[0], 0 == lastParamIndex);
                            for (int i = 1; i < parameters.Length; ++i)
                            {
                                toolTipText.Append(", ");
                                AppendParameterInfo(toolTipText, parameters[i], i == lastParamIndex);
                            }
                        }

                        toolTipText.Append(")");
                    }
                    this.toolTip.Show(toolTipText.ToString(), this, clientPoint);
                }
            }
        }