/// <summary>
 /// BecomingPrimary is called after replay, as part of exiting recovery. Note that if recovery happens
 /// from the initial state, OnFirstStart may not have been called yet.
 /// </summary>
 protected override void BecomingPrimary()
 {
     if (_initialized)
     {
         _currentCommandHistoryIndexUpdated = new AsyncQueue <bool>();
         // Can let the UI use this now that the Immortal has been properly recovered and initialized
         myCommandShellImmortal = this;
     }
     _doneRecovery = true;
 }
 /// <summary>
 /// OnFirstStart is the logical constructor for CommandShellImmortal, which means that if we
 /// recover from an initial state, we first re-execute this code as part of recovery.
 /// </summary>
 protected override async Task <bool> OnFirstStart()
 {
     _commandHistory = new List <string>();
     if (_doneRecovery)
     {
         _currentCommandHistoryIndexUpdated = new AsyncQueue <bool>();
         // Can let the UI use this now that the Immortal has been properly recovered and initialized
         myCommandShellImmortal = this;
     }
     _initialized = true;
     return(true);
 }