1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EnvDTE;
namespace Antidote.AddIns
{
class CorrectSelectedText : ICorrectionStrategy
{
Document _activeDocument = null;
public IDictionary<int, string> ReadComments(ProjectItem projectItem)
{
_activeDocument = projectItem.Document;
Dictionary<int,string> comments = new Dictionary<int,string> ();
comments.Add(0, _activeDocument.Selection.Text);
return comments;
}
public void ApplyCorrection(int key, string comment)
{
TextSelection selectionCourrante = _activeDocument.Selection as TextSelection;
if (selectionCourrante != null && selectionCourrante.Text.Length > 0)
selectionCourrante.Text = comment;
//À ce niveau je voudrais ré-appliquer la sélection à mon document
//Début de mon ancienne sélection jusqu'à comment.Length
}
}
} |
Partager