/// <summary>
 /// Initializes a new <see cref="KeyValueUnitViewModel"/>.
 /// </summary>
 /// <param name="parentViewModel">The parent view model</param>
 /// <param name="tag">The tag providing the data.</param>
 public KeyValueUnitViewModel(MasterDetailViewModel parentViewModel, Tag tag)
     : this()
 {
     _parentViewModel = parentViewModel;
     _children        = new BindableCollection <KeyValueUnitViewModel>(tag.Children.Select(t => new KeyValueUnitViewModel(parentViewModel, t)));
     _tag             = tag;
     _pendingChange   = null;
 }
        private void UpdateControllerDisplayName(MasterDetailViewModel controller)
        {
            controller.DisplayName = IsDeveloper ? controller.Name : controller.FullName;

            foreach (var x in controller.Childs)
            {
                UpdateControllerDisplayName(x);
            }
        }
        private void UpdateControllerPermissions(MasterDetailViewModel controller)
        {
            controller.IsEngineer = IsEngineer;

            foreach (var controllerChild in controller.Childs)
            {
                UpdateControllerPermissions(controllerChild);
            }
        }
        private void HandleControllerUpdate(Controller controller)
        {
            MasterDetailViewModel root = MasterTree.FirstOrDefault();

            if (root == null)
            {
                return;
            }
            root.Update(controller);
        }
        private MasterDetailViewModel CreateMasterDetailViewModel(Controller controller, ICommandControllers commander, string moduleName)
        {
            if (controller == null)
            {
                return(new MasterDetailViewModel(new Controller {
                    Id = -1
                }, moduleName, commander, _detailStates));
            }
            IEnumerable <Controller> children = controller.Children ?? new Controller[0];
            var master = new MasterDetailViewModel(controller, moduleName, commander, _detailStates)
            {
                SuppressChangeEvent = true,
                Childs = children.Where(x => x != null)
                         .Select(x => CreateMasterDetailViewModel(x, commander, moduleName))
                         .MakeBindable(),
            };

            master.SuppressChangeEvent = false;
            return(master);
        }
 /// <summary>
 /// Changes the simulation mode on the specified <paramref name="controller"/>.
 /// </summary>
 /// <param name="controller">The controller to change the mode on.</param>
 public void ChangeSimulationPropagateModeOnController(MasterDetailViewModel controller)
 {
     controller.ChangeSimulationMode(true);
 }
 /// <summary>
 /// Changes the simulation mode on the specified <paramref name="controller"/>.
 /// </summary>
 /// <param name="controller">The controller to change the mode on.</param>
 public void ChangeSimulationModeOnController(MasterDetailViewModel controller)
 {
     controller.ChangeSimulationMode(false);
 }
 /// <summary>
 /// Changes the mode on the specified <paramref name="controller"/>.
 /// </summary>
 /// <param name="controller">The controller to change the mode on.</param>
 public void ChangeModeOnController(MasterDetailViewModel controller)
 {
     controller.ChangeMode();
 }
 /// <summary>
 /// Saves the changes made on the specified <paramref name="controller"/>.
 /// </summary>
 /// <param name="controller">The controller which changes should get saved.</param>
 public void SaveChangesOnController(MasterDetailViewModel controller)
 {
     controller.Save();
 }
 /// <summary>
 /// Resets the changes made on the specified <paramref name="controller"/>.
 /// </summary>
 /// <param name="controller">The controller which changes should get reseted.</param>
 public void ResetChangesOnController(MasterDetailViewModel controller)
 {
     controller.Reset();
 }