コード例 #1
0
 public void Test()
 {
     ProgressTracker pt = new ProgressTracker();
     TestProcess tp = new TestProcess();
     pt.ProgressChanged += new EventHandler(pt_ProgressChanged);
     tp.Process(pt, 4);
 }
コード例 #2
0
 protected override void Perform()
 {
     pt = new ProgressTracker();
     BurrowFramework bf = new BurrowFramework();
     bf.InitWorkSpace();
     try {
         pt.ProgressChanged += new EventHandler(pt_ProgressChanged);
         DoPerform();
     }catch(Exception) {
         try {
             if (bf.CurrentConversation != null)
                 bf.CurrentConversation.GiveUp();
         }catch (Exception) {/*prevent this exception hiding the real one*/}
         throw;
     }
     finally {
         try {
             bf.CloseWorkSpace();
         }
         catch (Exception) {/*prevent this exception hiding the real one*/}
     }
 }
コード例 #3
0
 public void Process(ProgressTracker progressTracker, int maximumNumOfSubs)
 {
     if (maximumNumOfSubs > 0)
         for (int i = 0; i < maximumNumOfSubs; i++)
             Process(progressTracker.CreateSubTracker(maximumNumOfSubs), maximumNumOfSubs - 1);
 }
コード例 #4
0
ファイル: ProgressTracker.cs プロジェクト: kailuowang/MindLib
 /// <summary>
 /// 
 /// </summary>
 /// <param name="totalNumberOfSteps"></param>
 /// <param name="thisSubProcFinishingStep">the finishing number of Step once this current sub process finishes</param>
 /// <returns></returns>
 public ProgressTracker CreateSubTracker(int totalNumberOfSteps, int thisSubProcFinishingStep)
 {
     numOfSubProcedure = totalNumberOfSteps;
     if (numOfSubProcedure <= 0)
         throw new Exception("Cannot enter sub procedure if tracker created with 0 number of sub procedure");
     subTracker = new ProgressTracker();
     subTracker.ProgressChanged += new EventHandler(subTracker_ProgressChanged);
     currentSubProcIdx = thisSubProcFinishingStep;
     if (currentSubProcIdx > 0)
         FireProgressChangedEvt();
     return subTracker;
 }
コード例 #5
0
ファイル: ProgressTracker.cs プロジェクト: kailuowang/MindLib
 public static ProgressTracker CreateSubTracker(ProgressTracker currentTracker, int numberOfSubProc)
 {
     if (currentTracker != null)
         return currentTracker.CreateSubTracker(numberOfSubProc);
     else
         return null;
 }