コード例 #1
0
        /// <summary>
        /// Obtain completions (this runs in its own thread)
        /// </summary>
        internal void BackgroundShowCompletionWindow() //ICompletionItemProvider
        {
            // provide AvalonEdit with the data:
            string itemForCompletion = "";

            TextArea.Dispatcher.Invoke(new Action(delegate()
            {
                DocumentLine line = TextArea.Document.Lines[TextArea.Caret.Line - 1];
                itemForCompletion = TextArea.Document.GetText(line);
            }));

            ICompletionData[] completions = completionProvider.GenerateCompletionData(itemForCompletion);

            if (completions != null && completions.Length > 0)
            {
                TextArea.Dispatcher.BeginInvoke(new Action(delegate()
                {
                    _completionWindow            = new PythonConsoleCompletionWindow(TextArea, this);
                    IList <ICompletionData> data = _completionWindow.CompletionList.CompletionData;
                    foreach (ICompletionData completion in completions)
                    {
                        data.Add(completion);
                    }
                    _completionWindow.Show();
                    _completionWindow.Closed += delegate
                    {
                        _completionWindow = null;
                    };
                }));
            }
        }
コード例 #2
0
        /// <summary>
        /// Obtain completions (this runs in its own thread)
        /// </summary>
        internal void BackgroundShowCompletionWindow() //ICompletionItemProvider
        {
            // provide AvalonEdit with the data:
            string itemForCompletion = "";

            textArea.Dispatcher.Invoke(new Action(delegate()
            {
                DocumentLine line = textArea.Document.Lines[textArea.Caret.Line - 1];
                itemForCompletion = textArea.Document.GetText(line.Offset, textArea.Caret.Column - 1);
            }));


            completionDispatcher.Invoke(new Action(delegate()
            {
                try
                {
                    var completionInfo = completionProvider.GenerateCompletionData(itemForCompletion);

                    if (completionInfo != null)
                    {
                        ICompletionData[] completions = completionInfo.Item1;
                        string objectName             = completionInfo.Item2;
                        string memberName             = completionInfo.Item3;

                        if (completions.Length > 0)
                        {
                            textArea.Dispatcher.BeginInvoke(new Action(delegate()
                            {
                                completionWindow             = new PythonConsoleCompletionWindow(textArea, this);
                                IList <ICompletionData> data = completionWindow.CompletionList.CompletionData;
                                foreach (ICompletionData completion in completions)
                                {
                                    data.Add(completion);
                                }
                                completionWindow.Show();
                                completionWindow.Closed += delegate
                                {
                                    completionWindow = null;
                                };

                                completionWindow.StartOffset -= memberName.Length;
                                completionWindow.CompletionList.SelectItem(textArea.Document.GetText(completionWindow.StartOffset, memberName.Length));
                            }));
                        }
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.ToString(), "Error");
                }
            }));
        }
コード例 #3
0
        /// <summary>
        /// Obtain completions (this runs in its own thread)
        /// </summary>
        internal void BackgroundShowCompletionWindow() //ICompletionItemProvider
        {
            // provide AvalonEdit with the data:
            string itemForCompletion = "";

            textArea.Dispatcher.Invoke(new Action(delegate()
            {
                DocumentLine line = textArea.Document.Lines[textArea.Caret.Line - 1];
                itemForCompletion = textArea.Document.GetText(line);
            }));


            completionDispatcher.Invoke(new Action(delegate()
            {
                try
                {
                    ICompletionData[] completions = completionProvider.GenerateCompletionData(itemForCompletion);

                    if (completions != null && completions.Length > 0)
                    {
                        textArea.Dispatcher.BeginInvoke(new Action(delegate()
                        {
                            completionWindow             = new PythonConsoleCompletionWindow(textArea, this);
                            IList <ICompletionData> data = completionWindow.CompletionList.CompletionData;
                            foreach (ICompletionData completion in completions)
                            {
                                data.Add(completion);
                            }
                            completionWindow.Show();
                            completionWindow.Closed += delegate
                            {
                                completionWindow = null;
                            };
                        }));
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.ToString(), "Error");
                }
            }));
        }
コード例 #4
0
        //ICompletionItemProvider
        /// <summary>
        /// Obtain completions (this runs in its own thread)
        /// </summary>
        internal void BackgroundShowCompletionWindow()
        {
            // provide AvalonEdit with the data:
            string itemForCompletion = "";
            textArea.Dispatcher.Invoke(new Action(delegate()
            {
                DocumentLine line = textArea.Document.Lines[textArea.Caret.Line - 1];
                itemForCompletion = textArea.Document.GetText(line);
            }));

            ICompletionData[] completions = completionProvider.GenerateCompletionData(itemForCompletion);

            if (completions != null && completions.Length > 0) textArea.Dispatcher.BeginInvoke(new Action(delegate()
            {
                completionWindow = new PythonConsoleCompletionWindow(textArea, this);
                IList<ICompletionData> data = completionWindow.CompletionList.CompletionData;
                foreach (ICompletionData completion in completions)
                {
                    data.Add(completion);
                }
                completionWindow.Show();
                completionWindow.Closed += delegate
                {
                    completionWindow = null;
                };
            }));
        }