예제 #1
0
        private void SetStubHelpersAPIs()
        {
            int leftIndex = richTextBoxILCode.Find(StubHelperAPIHeader,
                                                   0, RichTextBoxFinds.MatchCase | RichTextBoxFinds.WholeWord);
            int    rightIndex;
            int    textLength = richTextBoxILCode.Text.Length;
            string description;

            while (leftIndex != -1)
            {
                rightIndex = leftIndex + StubHelperAPIHeader.Length;
                while (rightIndex < textLength && IsValidAPISignatureLetter(richTextBoxILCode.Text[rightIndex]))
                {
                    rightIndex++;
                }
                string word = richTextBoxILCode.Text.Substring(leftIndex, rightIndex - leftIndex);
                if (StubHelpersAPIDictionary.GetInstance().TryGetValue(word, out description))
                {
                    richTextBoxILCode.Select(leftIndex, rightIndex - leftIndex);
                    richTextBoxILCode.SelectionFont = StubHelperAPIFont;
                }
                leftIndex = richTextBoxILCode.Find(StubHelperAPIHeader,
                                                   rightIndex, RichTextBoxFinds.MatchCase | RichTextBoxFinds.WholeWord);
            }
        }
        private void UpdateAPIList(string name)
        {
            listBoxAPIName.Items.Clear();
            StubHelpersAPIDictionary dictionary = StubHelpersAPIDictionary.GetInstance();
            List <string>            nameList   = dictionary.GetKeysContaining(name);

            listBoxAPIName.Items.AddRange(nameList.ToArray());
        }
 private void listBoxAPIName_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listBoxAPIName.SelectedItem != null)
     {
         string APIName = listBoxAPIName.SelectedItem.ToString();
         StubHelpersAPIDictionary dictionary = StubHelpersAPIDictionary.GetInstance();
         string description;
         if (dictionary.TryGetValue(APIName, out description))
         {
             textBoxDescription.Text = description;
         }
     }
 }
예제 #4
0
        private void richTextBoxILCode_MouseMove(object sender, MouseEventArgs e)
        {
            int index = richTextBoxILCode.GetCharIndexFromPosition(e.Location);

            if (index < richTextBoxILCode.TextLength)
            {
                int leftIndex = index;
                while (leftIndex >= 0 && IsValidAPISignatureLetter(richTextBoxILCode.Text[leftIndex]))
                {
                    leftIndex--;
                }
                int rightIndex = index;
                while (IsValidAPISignatureLetter(richTextBoxILCode.Text[rightIndex]))
                {
                    rightIndex++;
                }
                if (leftIndex != rightIndex)
                {
                    leftIndex++;
                    string word = richTextBoxILCode.Text.Substring(leftIndex, rightIndex - leftIndex);
                    string description;
                    if (StubHelpersAPIDictionary.GetInstance().TryGetValue(word, out description))
                    {
                        // if the label is already shown on the same API, we do need to update it.
                        if (!labelStubHelperAPI.Visible || labelStubHelperAPI.Text != description)
                        {
                            labelStubHelperAPI.Text     = description;
                            labelStubHelperAPI.Location = new Point(e.Location.X, e.Location.Y + 10);
                            labelStubHelperAPI.Visible  = true;
                        }
                        return;
                    }
                }
                labelStubHelperAPI.Visible = false;
            }
        }