private void EditActor(Actor actor)
 {
     if (actor != null)
     {
         var editActorWindow = new EditActor(actor);
         editActorWindow.ShowDialog();
         if (actor.Initiative == CurrentInitiative)
             actor.HasInitiative = true;
         ActorsView.Refresh();
     }
 }
        private void AddActor()
        {
            var actor = new Actor { Name = string.Format("Actor {0}", ++_ActorNum), Initiative = 0, HasInitiative = false, IsEnabled = true, IsDelayed = false, Notes = string.Empty };
            var editActorWindow = new EditActor(actor);
            editActorWindow.ShowDialog();
            if (!string.IsNullOrWhiteSpace(actor.Name))
            {
                Actors.Add(actor);
                if (actor.Initiative == CurrentInitiative)
                    actor.HasInitiative = true;

                var enabledDisposable = actor.ObservableForProperty(x => x.IsEnabled).Subscribe(x => RefreshActor(x.Sender));
                var delayedDisposable = actor.ObservableForProperty(x => x.IsDelayed).Where(x => !x.Value).Subscribe(x => SetActorInitiativeToCurrent(x.Sender));

                if (!ActorObservableDisposables.ContainsKey(actor))
                    ActorObservableDisposables.Add(actor, new List<IDisposable> { enabledDisposable, delayedDisposable });
                else if (ActorObservableDisposables[actor] == null)
                    ActorObservableDisposables[actor] = new List<IDisposable> { enabledDisposable, delayedDisposable };
                else
                {
                    ActorObservableDisposables[actor].Add(enabledDisposable);
                    ActorObservableDisposables[actor].Add(delayedDisposable);
                }

                ActorsView.Refresh();
            }
        }