Beispiel #1
0
        public override void Initialize()
        {
            if (!mIsInitialized)
            {
                Status = WorkStatus.Inactive;
                mDisposed = false;
                mWorkSpinDoor = new ManualResetEvent(false);
                mDummyEventArgs = new EventArgs();
                mTaskThread = new Thread(Work);
                log.Debug("Initialize");
                mAsynchronousWorksCount = 0;
                mBehaviorDependencys = new Dictionary<Behavior, Behavior[]>();
                mWorksCountInExecution = 0;

                ProcessRate = 0;
                mProgressChangedEventArgs = new ProgressChangedEventArgs(mProcessRate);

                //Task guard woker
                mIsGuardWorkFinished = false;
                mGuardSpinDoor = new ManualResetEvent(false);
                mGuardThread = new Thread(() =>
                {
                    while (!mIsGuardWorkFinished)
                    {
                        mGuardSpinDoor.WaitOne();
                        if (mGuardAction != null)
                        {
                            mGuardAction();
                        }
                    }
                });
                mIsInitialized = true;
            }
        }
Beispiel #2
0
 public override void Initialize()
 {
     mDummyEventArgs = new EventArgs();
     mPlannedWorkPattern = BehaviorExecutePattern.Synchronization;
     Status = BehaviorStatus.Closed;
     mDependentBehaviors = new List<Behavior>();
     //initialize the event state to allow thread to continue
     mManualEvent = new ManualResetEvent(true);
     mBehaviorEntities = new Dictionary<Component, BehaviorEntityType>();
     mShouldPause = false;
     mShouldAbort = false;
     mIsWorkFinished=false;
     mDisposed = false;
     ProcessRate = 0;
     mProgressChangedEventArgs = new ProgressChangedEventArgs(mProcessRate);
 }