void ThreadStart() { Logger.Instance().Log("void ThreadStart()"); // State becomes null only after ExitState do his finalizing job while (State != null) { State = State.Work(); } }
public FileSearcher() { Context = new SearcherStateContext(); Context.SearcherThread = new Thread(ThreadStart); ProgressTimer = new System.Timers.Timer(200); ProgressTimer.Elapsed += OnProgress; Context.SearcherThread.IsBackground = true; Context.SearcherThread.Start(); SearchFinishedEvent += FileSearcher_SearchFinishedEvent; State = new IdleState(Context); }