private void OnCompletionResultRetrieved(object sender, CompletionEventArgs e)
        {
            Execute.OnUIThread(() =>
            {
                if (_completionWindow == null && e.CompletionMatches.Any())
                {
                    _completionWindow = new CompletionWindow(_textArea)
                    {
                        CloseWhenCaretAtBeginning = _openedByControlSpace,
                        CloseAutomatically        = true,
                        Width = 300
                    };

                    var data = _completionWindow.CompletionList.CompletionData;
                    foreach (var completion in e.CompletionMatches)
                    {
                        data.Add(completion);
                    }

                    _completionWindow.Show();

                    _completionWindow.Closed += (o, args) =>
                    {
                        _completionWindow = null;
                    };
                }
            });
        }
        private void CompletionRequest(object sender, CompletionEventArgs e)
        {
            if (textEditorControl.CompletionWindowVisible)
            {
                return;
            }

            // Prevent CompletionRequest to call ShowCompletionWindow if user type a string.
            if (TextHelper.FindStringStart(textEditorControl.Document, textEditorControl.ActiveTextAreaControl.Caret.Offset) != -1 && TextHelper.FindStringStart(textEditorControl.Document, textEditorControl.ActiveTextAreaControl.Caret.Offset) != -1)
            {
                return;
            }

            // e.Key contains the key that the user wants to insert and which triggered
            // the CompletionRequest.
            // e.Key == '\0' means that the user triggered the CompletionRequest by pressing <Ctrl> + <Space>.

            if (e.Key == '\0')
            {
                // The user has requested the completion window by pressing <Ctrl> + <Space>.
                textEditorControl.ShowCompletionWindow(new CodeCompletionDataProvider(), e.Key, false);
            }
            else if (char.IsLetter(e.Key))
            {
                // The user is typing normally.
                // -> Show the completion to provide suggestions. Automatically close the window if the
                // word the user is typing does not match the completion data. (Last argument.)
                textEditorControl.ShowCompletionWindow(new CodeCompletionDataProvider(), e.Key, true);
            }
        }
示例#3
0
        private static void CompletionRequest(object sender, CompletionEventArgs e)
        {
            var textEditorControl = (TextEditorControl)sender;

            if (textEditorControl.CompletionWindowVisible)
            {
                return;
            }

            // e.Key contains the key that the user wants to insert and which triggered
            // the CompletionRequest.
            // e.Key == '\0' means that the user triggered the CompletionRequest by pressing <Ctrl> + <Space>.

            if (e.Key == '\0')
            {
                // The user has requested the completion window by pressing <Ctrl> + <Space>.
                textEditorControl.ShowCompletionWindow(_completionProvider, e.Key, false);
            }
            else if (char.IsLetter(e.Key))
            {
                // The user is typing normally.
                // -> Show the completion to provide suggestions. Automatically close the window if the
                // word the user is typing does not match the completion data. (Last argument.)
                textEditorControl.ShowCompletionWindow(_completionProvider, e.Key, true);
            }
        }
示例#4
0
        // Adds a new player to the game
        private void PlayerCreatorAddition_CompletionEvent(object sender, CompletionEventArgs e)
        {
            Player temp = (Player)e.CompletedData;

            game.Players.Add(temp);
            playerListBox.Items.Add(temp.PlayerName);
            playerListBox.Invalidate();
        }
示例#5
0
        // Adds a new enemy to the game
        private void EnemyCharacterCreatorAddition_CompletionEvent(object sender, CompletionEventArgs e)
        {
            Character temp = (Character)e.CompletedData;

            game.Enemies.Add(temp);
            enemyListBox.Items.Add(temp.Name);
            enemyListBox.Invalidate();
        }
示例#6
0
        // Adds a new npc to the game
        private void NPCCharacterCreatorAddition_CompletionEvent(object sender, CompletionEventArgs e)
        {
            Character temp = (Character)e.CompletedData;

            game.Npcs.Add(temp);
            npcListBox.Items.Add(temp.Name);
            npcListBox.Invalidate();
        }
        /// <summary>
        /// Raises the <see cref="CompletionRequest" /> event.
        /// </summary>
        /// <param name="e"><see cref="CompletionEventArgs" /> object that provides the arguments for the event.</param>
        protected virtual void OnCompletionRequest(CompletionEventArgs e)
        {
            EventHandler <CompletionEventArgs> handler = CompletionRequest;

            if (handler != null)
            {
                handler(this, e);
            }
        }
示例#8
0
 private void Server_PostProcessCompletion(object sender, CompletionEventArgs e)
 {
     Assert.IsNotNull(e.Tree);
     Assert.IsNotNull(e.Analysis);
     for (int i = 0; i < e.CompletionList.items.Length; ++i)
     {
         e.CompletionList.items[i].insertText = "*" + e.CompletionList.items[i].insertText;
     }
 }
示例#9
0
        private void TextArea_KeyPress(object sender, KeyPressEventArgs keyEventArgs)
        {
            if (_inHandleKeyPress)
            {
                return;
            }

            // First, let all subscribers handle the key event.
            OnTextAreaKeyPress(keyEventArgs);
            if (keyEventArgs.Handled)
            {
                return;
            }


            _inHandleKeyPress = true;
            try
            {
                char ch = keyEventArgs.KeyChar;
                if (CompletionWindowVisible)
                {
                    // Forward key event to completion window
                    if (completionWindow.ProcessKeyEvent(ch))
                    {
                        keyEventArgs.Handled = true;
                    }
                }

                if (EnableMethodInsight && (ch == '(' || ch == ','))
                {
                    // Request insight window
                    InsightEventArgs e = new InsightEventArgs(ch);
                    OnInsightRequest(e);
                }
                else if (!keyEventArgs.Handled && EnableCompletion)
                {
                    // Request completion window
                    CompletionEventArgs e = new CompletionEventArgs(ch);
                    OnCompletionRequest(e);
                }
            }
            //catch (Exception exception)
            //{
            //  // TODO: Log exception
            //}
            finally
            {
                _inHandleKeyPress = false;
            }
        }
示例#10
0
文件: Eqmlp.cs 项目: dlebansais/Wrist
        private void OnGetOrganizationsCompleted(object sender, CompletionEventArgs e, Action <int, object> callback)
        {
            List <IDictionary <string, string> > Result;

            if ((Result = Database.ProcessMultipleResponse(e.Operation, new List <string>()
            {
                "name", "login_url", "meeting_url", "validation_url"
            })) != null)
            {
                Windows.UI.Xaml.Window.Current.Dispatcher.BeginInvoke(() => callback((int)ErrorCodes.Success, Result));
            }
            else
            {
                Windows.UI.Xaml.Window.Current.Dispatcher.BeginInvoke(() => callback((int)ErrorCodes.AnyError, null));
            }
        }
示例#11
0
文件: Eqmlp.cs 项目: dlebansais/Wrist
        private void OnGetBugsCompleted(object sender, CompletionEventArgs e, Action <int, object> callback)
        {
            List <IDictionary <string, string> > Result;

            if ((Result = Database.ProcessMultipleResponse(e.Operation, new List <string>()
            {
                "appeared", "severity", "fixed", "description", "analysis", "fix", "binary_path", "readme_path"
            })) != null)
            {
                Windows.UI.Xaml.Window.Current.Dispatcher.BeginInvoke(() => callback((int)ErrorCodes.Success, Result));
            }
            else
            {
                Windows.UI.Xaml.Window.Current.Dispatcher.BeginInvoke(() => callback((int)ErrorCodes.AnyError, null));
            }
        }
示例#12
0
        private void OnGetAllSampleCodesCompleted(object sender, CompletionEventArgs e, Action <int, object> callback)
        {
            IDictionary <string, string> Result;

            if ((Result = Database.ProcessSingleResponse(e.Operation, new List <string>()
            {
                "front_page", "feature", "text", "title_enu", "title_fra", "result"
            })) != null)
            {
                Windows.UI.Xaml.Window.Current.Dispatcher.BeginInvoke(() => callback(ParseResult(Result["result"]), Result));
            }
            else
            {
                Windows.UI.Xaml.Window.Current.Dispatcher.BeginInvoke(() => callback((int)ErrorCodes.AnyError, null));
            }
        }
示例#13
0
文件: News.cs 项目: dlebansais/Wrist
        private void OnGetAllNewsCompleted(object sender, CompletionEventArgs e, Action <int, object> callback)
        {
            List <IDictionary <string, string> > Result;

            if ((Result = Database.ProcessMultipleResponse(e.Operation, new List <string>()
            {
                "created", "enu_summary", "enu_content", "fra_summary", "fra_content"
            })) != null)
            {
                Windows.UI.Xaml.Window.Current.Dispatcher.BeginInvoke(() => callback((int)ErrorCodes.Success, Result));
            }
            else
            {
                Windows.UI.Xaml.Window.Current.Dispatcher.BeginInvoke(() => callback((int)ErrorCodes.AnyError, null));
            }
        }
示例#14
0
        private void OnGetAllFeaturesCompleted(object sender, CompletionEventArgs e, Action <int, object> callback)
        {
            List <IDictionary <string, string> > Result;

            if ((Result = Database.ProcessMultipleResponse(e.Operation, new List <string>()
            {
                "id", "status_id", "name_enu", "label_enu", "comments_enu", "name_fra", "label_fra", "comments_fra"
            })) != null)
            {
                Windows.UI.Xaml.Window.Current.Dispatcher.BeginInvoke(() => callback((int)ErrorCodes.Success, Result));
            }
            else
            {
                Windows.UI.Xaml.Window.Current.Dispatcher.BeginInvoke(() => callback((int)ErrorCodes.AnyError, null));
            }
        }
示例#15
0
        private void UpdateProgressBar(object sender, CompletionEventArgs e)
        {
            if (!queued)
            {
                mg.QueueInvocation(() =>
                {
                    if (!progressBar.gameObject.activeSelf)
                    {
                        progressBar.gameObject.SetActive(true);
                    }

                    if (progressBar.fillAmount < e.Completion)
                    {
                        progressBar.fillAmount = e.Completion;
                    }

                    queued = false;
                });

                queued = true;
            }
        }
示例#16
0
 private void OnSendFeedbackCompleted(object sender, CompletionEventArgs e, Action <int, object> callback)
 {
     Windows.UI.Xaml.Window.Current.Dispatcher.BeginInvoke(() => callback((int)ErrorCodes.Success, new Dictionary <string, string>()));
 }