예제 #1
0
        private void UpdateCustomGrippers()
        {
            if (_CustomGripperCompanion != null)
            {
                _CustomGripperCompanion.OnClearCustomElements(_CustomGrippers, _ForegroundElements);
                _CustomGripperCompanion = null;
            }

            foreach (var gripper in _CustomGrippers)
            {
                BindingOperations.ClearAllBindings(gripper);
            }
            _CustomGrippers.Clear();
            foreach (var foregroundElement in _ForegroundElements)
            {
                RemoveForgroundElement(foregroundElement);
            }
            _ForegroundElements.Clear();

            if (SelectedCompanions.Count == 1)
            {
                _CustomGripperCompanion = SelectedCompanions[0];

                _CustomGripperCompanion.OnCreateCustomElements(_CustomGrippers, _ForegroundElements);
                foreach (var foregroundElement in _ForegroundElements)
                {
                    AddForgroundElement(foregroundElement);
                }
            }
        }