Example #1
0
            private bool AddReconversionItems(TextEditor textEditor)
            {
                TextStore textStore = textEditor.TextStore;

                if (textStore == null)
                {
                    GC.SuppressFinalize(this);
                    return(false);
                }
                this.ReleaseCandidateList(null);
                this._candidateList = new SecurityCriticalDataClass <UnsafeNativeMethods.ITfCandidateList>(textStore.GetReconversionCandidateList());
                if (this.CandidateList == null)
                {
                    GC.SuppressFinalize(this);
                    return(false);
                }
                int num = 0;

                this.CandidateList.GetCandidateNum(out num);
                if (num > 0)
                {
                    int num2 = 0;
                    while (num2 < 5 && num2 < num)
                    {
                        UnsafeNativeMethods.ITfCandidateString tfCandidateString;
                        this.CandidateList.GetCandidate(num2, out tfCandidateString);
                        string text;
                        tfCandidateString.GetString(out text);
                        MenuItem menuItem = new TextEditorContextMenu.ReconversionMenuItem(this, num2);
                        menuItem.Header           = text;
                        menuItem.InputGestureText = this.GetMenuItemDescription(text);
                        base.Items.Add(menuItem);
                        Marshal.ReleaseComObject(tfCandidateString);
                        num2++;
                    }
                }
                if (num > 5)
                {
                    MenuItem menuItem = new TextEditorContextMenu.EditorMenuItem();
                    menuItem.Header  = SR.Get("TextBox_ContextMenu_More");
                    menuItem.Command = ApplicationCommands.CorrectionList;
                    base.Items.Add(menuItem);
                    menuItem.CommandTarget = textEditor.UiScope;
                }
                return(num > 0);
            }
Example #2
0
            // Token: 0x060085A8 RID: 34216 RVA: 0x0024A0EC File Offset: 0x002482EC
            private bool AddSpellerItems(TextEditor textEditor)
            {
                SpellingError spellingErrorAtSelection = textEditor.GetSpellingErrorAtSelection();

                if (spellingErrorAtSelection == null)
                {
                    return(false);
                }
                bool     flag = false;
                MenuItem menuItem;

                foreach (string text in spellingErrorAtSelection.Suggestions)
                {
                    menuItem        = new TextEditorContextMenu.EditorMenuItem();
                    menuItem.Header = new TextBlock
                    {
                        FontWeight = FontWeights.Bold,
                        Text       = text
                    };
                    menuItem.Command          = EditingCommands.CorrectSpellingError;
                    menuItem.CommandParameter = text;
                    base.Items.Add(menuItem);
                    menuItem.CommandTarget = textEditor.UiScope;
                    flag = true;
                }
                if (!flag)
                {
                    menuItem           = new TextEditorContextMenu.EditorMenuItem();
                    menuItem.Header    = SR.Get("TextBox_ContextMenu_NoSpellingSuggestions");
                    menuItem.IsEnabled = false;
                    base.Items.Add(menuItem);
                }
                this.AddSeparator();
                menuItem         = new TextEditorContextMenu.EditorMenuItem();
                menuItem.Header  = SR.Get("TextBox_ContextMenu_IgnoreAll");
                menuItem.Command = EditingCommands.IgnoreSpellingError;
                base.Items.Add(menuItem);
                menuItem.CommandTarget = textEditor.UiScope;
                return(true);
            }
Example #3
0
            private bool AddClipboardItems(TextEditor textEditor, bool userInitiated)
            {
                MenuItem menuItem = new TextEditorContextMenu.EditorMenuItem();

                menuItem.Header        = SR.Get("TextBox_ContextMenu_Cut");
                menuItem.CommandTarget = textEditor.UiScope;
                menuItem.Command       = ApplicationCommands.Cut;
                base.Items.Add(menuItem);
                menuItem               = new TextEditorContextMenu.EditorMenuItem();
                menuItem.Header        = SR.Get("TextBox_ContextMenu_Copy");
                menuItem.CommandTarget = textEditor.UiScope;
                menuItem.Command       = ApplicationCommands.Copy;
                base.Items.Add(menuItem);
                if (!userInitiated)
                {
                    SecurityHelper.DemandAllClipboardPermission();
                }
                menuItem               = new TextEditorContextMenu.EditorMenuItem();
                menuItem.Header        = SR.Get("TextBox_ContextMenu_Paste");
                menuItem.CommandTarget = textEditor.UiScope;
                menuItem.Command       = ApplicationCommands.Paste;
                base.Items.Add(menuItem);
                return(true);
            }