示例#1
0
 void CompleteListFormClosing(object sender, FormClosingEventArgs e)
 {
     if (completeList != null)
     {
         completeList.Dispose();
     }
     completeList   = null;
     currentSession = null;
 }
示例#2
0
        private void InitiateCodeComplete()
        {
            //todo: check if happens in right window

            DismissCodeComplete();

            currentSession = new CompletionSession {
                LineNumber = VisualStudio.GetCurrentLineNumber()
            };

            OnCodeCompleteActivating(currentSession);

            if (currentSession.Cancel)
            {
                CloseCodeComplete();
                return;
            }

            if (currentSession.FilteredCompletionSet.Count() == 1) //only one item in list, commit directly
            {
                CommitCodeComplete(currentSession.FilteredCompletionSet.First().ToString());
            }
            else //zero, or more than 1 items
            {
                completeList = new StatementCompleteList {
                    Left = currentSession.Coordinate.X, Top = currentSession.Coordinate.Y
                };
                completeList.SetResults(currentSession.FilteredCompletionSet.ToList());
                completeList.SetSignatureToolTip(currentSession.SignatureToolTip);
                completeList.Deactivate   += new EventHandler(CompleteListDeactivate);
                completeList.FormClosing  += new FormClosingEventHandler(CompleteListFormClosing);
                completeList.ItemSelected += new EventHandler(CompleteListItemSelected);
                completeList.Show();
                return;
            }
        }