public void Subscribe(DocumentProcessor processor) { processor.Processing += (sender, e) => { if (e.Document.Text.Contains("document")) { Console.WriteLine("ツール2が処理の開始を確認しました。処理をキャンセルします。"); e.Cancel = true; } else { Console.WriteLine("ツール2が処理の開始を確認しました。処理を続行します。"); } }; processor.Processed += (sender, e) => Console.WriteLine("ツール2が処理の終了を確認しました。"); }
static DocumentProcessor Configure() { DocumentProcessor rc = new DocumentProcessor(); rc.AddProcess(DocumentProcesses.TranslateIntoFrench, delegate(Document doc) { return !doc.Text.Contains("?"); }); rc.AddProcess(DocumentProcesses.Spellcheck); rc.AddProcess(DocumentProcesses.Repaginate); TrademarkFilter trademarkFilter = new TrademarkFilter(); trademarkFilter.Trademarks.Add("O'Reilly"); trademarkFilter.Trademarks.Add("millennium"); rc.AddProcess(trademarkFilter.HighlightTradeMarks); return rc; }
public void Unsubscribe(DocumentProcessor processor) { processor.Processing -= processor_Processing; processor.Processed -= processor_Processed; }
public void Subscribe(DocumentProcessor processor) { processor.Processing += processor_Processing; processor.Processed += processor_Processed; }