Ejemplo n.º 1
0
 public void Subscribe(DocumentProcessor5 processor)
 {
     processor.Processing += (sender, e) => GetMessages.Message += "<br>Tool2 has seen processing.";
     processor.Processed += (sender, e) => GetMessages.Message += "<br>Tool2 has seen that processing is complete.";
 }
Ejemplo n.º 2
0
 public void Subscribe(DocumentProcessor5 processor)
 {
     processor.Processing += processor_Processing;
     processor.Processed += processor_Processed;
 }
Ejemplo n.º 3
0
 public void Unsubscribe(DocumentProcessor5 processor)
 {
     processor.Processing -= processor_Processing;
     processor.Processed -= processor_Processed;
 }
 public static DocumentProcessor5 Configure6()
 {
     DocumentProcessor5 rc = new DocumentProcessor5();
     //匿名方法(Anonymous Methods),並回傳檢核是否通過
     rc.AddProcess(DocumentProcesses.TranslateIntoFrench,
         delegate(Document doc)
         {
             return !doc.Text.Contains("?");
         });
     //使用類似Function的方式
     Predicate<Document> predicate2 =
         delegate(Document doc)
         {
             return !doc.Text.Contains("?");
         };
     rc.AddProcess(DocumentProcesses.Spellcheck, predicate2);
     Predicate<Document> predicate3 = doc => !doc.Text.Contains("?");
     rc.AddProcess(DocumentProcesses.Repaginate, predicate3);
     //
     TrademarkFilter trademarkFilter = new TrademarkFilter();
     trademarkFilter.Trademarks.Add("Ian");
     trademarkFilter.Trademarks.Add("Griffiths");
     trademarkFilter.Trademarks.Add("millennium");
     //
     rc.AddProcess(trademarkFilter.HeighlightTrademarks);
     //
     return rc;
 }