Пример #1
0
 public void Dismiss()
 {
     if (IsDismissed)
     {
         return;
     }
     IsDismissed      = true;
     TextView.Closed -= TextView_Closed;
     textViewPopup?.Dispose();
     textViewPopup = null;
     sessionCommandTargetFilter?.Close();
     sessionCommandTargetFilter = null;
     Dismissed?.Invoke(this, EventArgs.Empty);
     if (completionSources != null)
     {
         foreach (var source in completionSources)
         {
             source.Dispose();
         }
         completionSources = null;
     }
 }
Пример #2
0
        public void Start()
        {
            if (IsStarted)
            {
                throw new InvalidOperationException();
            }
            if (IsDismissed)
            {
                throw new InvalidOperationException();
            }
            IsStarted = true;
            this.completionSources = CreateCompletionSources();

            var list = new List <CompletionCollection>();

            foreach (var source in completionSources)
            {
                source.AugmentCompletionSession(this, list);
            }
            foreach (var cc in list)
            {
                completionCollections.Add(cc);
            }

            if (completionCollections.Count == 0)
            {
                Dismiss();
            }
            else
            {
                SelectedCompletionCollection = completionCollections[0];
                completionPresenter          = completionPresenterService.Create(this);
                Debug.Assert(completionPresenter != null);
                sessionCommandTargetFilter = new SessionCommandTargetFilter(this);
                textViewPopup = new TextViewPopup(TextView, GetTrackingPoint(SelectedCompletionCollection), completionPresenter);
                textViewPopup.Show();
            }
        }