/// <summary>
 /// Refreshes the shared step collections.
 /// </summary>
 public void RefreshSharedStepCollections(System.Windows.Threading.Dispatcher uiDispatcher, CancellationToken cancellationToken)
 {
     do
     {
         if (cancellationToken != null && cancellationToken.IsCancellationRequested)
         {
             return;
         }
         if (this.EditViewContext.IsInitialized && !this.EditViewContext.IsSharedStep)
         {
             List <ISharedStep> sharedStepList = TestStepManager.GetAllSharedSteps();
             List <SharedStep>  sharedSteps    = new List <BusinessLogic.Entities.SharedStep>();
             sharedStepList.ForEach(s =>
             {
                 sharedSteps.Add(new SharedStep(s));
             });
             sharedSteps.Sort();
             Action action = new Action(() =>
             {
                 if (this.ObservableSharedSteps != null && this.InitialSharedStepCollection != null)
                 {
                     this.ObservableSharedSteps.Clear();
                     sharedSteps.ForEach(s =>
                     {
                         this.ObservableSharedSteps.Add(s);
                     });
                     this.InitialSharedStepCollection.Clear();
                     sharedSteps.ForEach(s =>
                     {
                         this.InitialSharedStepCollection.Add(s);
                     });
                     this.InitializeInitialSharedStepCollection();
                     this.SharedStepsRefreshEvent(this, EventArgs.Empty);
                 }
             });
             try
             {
                 uiDispatcher.Invoke(action);
             }
             catch (AggregateException e)
             {
                 log.Error(e);
                 foreach (var innerException in e.InnerExceptions)
                 {
                     log.Error(innerException);
                 }
             }
         }
         Thread.Sleep(30000);
     }while (true);
 }
        /// <summary>
        /// Initializes the observable shared steps.
        /// </summary>
        private void InitializeObservableSharedSteps()
        {
            List <ISharedStep> sharedStepList = TestStepManager.GetAllSharedSteps();
            List <SharedStep>  sharedSteps    = new List <BusinessLogic.Entities.SharedStep>();

            sharedStepList.ForEach(s =>
            {
                sharedSteps.Add(new SharedStep(s));
            });
            sharedSteps.Sort();
            sharedSteps.ForEach(s =>
            {
                this.ObservableSharedSteps.Add(s);
            });
        }