public void Close() { try { if (Driver == null) { return; } Driver.IsDriverRunning = false; Thread.Sleep(1000); if (Driver.Dispatcher != null) { Driver.Dispatcher.Invoke(() => { Driver.CloseDriver(); }); } else { Driver.CloseDriver(); } if (MSTATask != null) { // Using Cancelleation token soucrce to cancel CancelTask = new BackgroundWorker(); CancelTask.DoWork += new DoWorkEventHandler(CancelTMSTATask); CancelTask.RunWorkerAsync(); } Driver = null; } finally { OnPropertyChanged(Fields.Status); OnPropertyChanged(Fields.IsWindowExplorerSupportReady); } }