コード例 #1
0
        // Token: 0x06003874 RID: 14452 RVA: 0x000FCCBC File Offset: 0x000FAEBC
        private static void OnListCommand(object target, ExecutedRoutedEventArgs args)
        {
            TextEditor textEditor = TextEditor._GetTextEditor(target);

            if (textEditor == null || !textEditor._IsEnabled || textEditor.IsReadOnly || !textEditor.AcceptsRichContent || !(textEditor.Selection is TextSelection))
            {
                return;
            }
            TextEditorTyping._FlushPendingInputItems(textEditor);
            if (!TextRangeEditLists.IsListOperationApplicable((TextSelection)textEditor.Selection))
            {
                return;
            }
            using (textEditor.Selection.DeclareChangeBlock())
            {
                TextSelection textSelection     = (TextSelection)textEditor.Selection;
                ListItem      listItem          = TextPointerBase.GetListItem(textSelection.Start);
                ListItem      immediateListItem = TextPointerBase.GetImmediateListItem(textSelection.Start);
                List          list = (listItem == null) ? null : ((List)listItem.Parent);
                TextEditorSelection._ClearSuggestedX(textEditor);
                if (args.Command == EditingCommands.ToggleBullets)
                {
                    TextEditorLists.ToggleBullets(textSelection, listItem, immediateListItem, list);
                }
                else if (args.Command == EditingCommands.ToggleNumbering)
                {
                    TextEditorLists.ToggleNumbering(textSelection, listItem, immediateListItem, list);
                }
                else if (args.Command == EditingCommands.RemoveListMarkers)
                {
                    TextRangeEditLists.ConvertListItemsToParagraphs(textSelection);
                }
                else if (args.Command == EditingCommands.IncreaseIndentation)
                {
                    TextEditorLists.IncreaseIndentation(textSelection, listItem, immediateListItem);
                }
                else if (args.Command == EditingCommands.DecreaseIndentation)
                {
                    TextEditorLists.DecreaseIndentation(textSelection, listItem, immediateListItem);
                }
                else
                {
                    Invariant.Assert(false);
                }
            }
        }