/// <summary>
        /// Constuctor.
        /// </summary>
        /// <param name="viewModelStore">The store this view model belongs to.</param>
        /// <param name="selectableElements">
        /// List of existing elements, that are allowed to be selected. Can be null to specify that
        /// the is no such restriction needed and that all elements can be selected.
        /// </param>
        public SelectElementViewModel(ViewModelStore viewModelStore, List<object> selectableElements)
            : base(viewModelStore)
        {
            selectElementTreeViewModel = new SelectElementTreeViewModel(viewModelStore);
            
            if( selectableElements != null )
                selectElementSearchViewModel = new SelectElementSearchViewModel(viewModelStore, selectableElements.Cast<ModelElement>());
            else
                selectElementSearchViewModel = new SelectElementSearchViewModel(viewModelStore);

            selectElementTreeViewModel.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(SubModel_PropertyChanged);
            selectElementSearchViewModel.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(SubModel_PropertyChanged);

            this.selectableElements = selectableElements;            
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constuctor.
        /// </summary>
        /// <param name="viewModelStore">The store this view model belongs to.</param>
        /// <param name="selectableElements">
        /// List of existing elements, that are allowed to be selected. Can be null to specify that
        /// the is no such restriction needed and that all elements can be selected.
        /// </param>
        public SelectElementViewModel(ViewModelStore viewModelStore, List <object> selectableElements)
            : base(viewModelStore)
        {
            selectElementTreeViewModel = new SelectElementTreeViewModel(viewModelStore);

            if (selectableElements != null)
            {
                selectElementSearchViewModel = new SelectElementSearchViewModel(viewModelStore, selectableElements.Cast <ModelElement>());
            }
            else
            {
                selectElementSearchViewModel = new SelectElementSearchViewModel(viewModelStore);
            }

            selectElementTreeViewModel.PropertyChanged   += new System.ComponentModel.PropertyChangedEventHandler(SubModel_PropertyChanged);
            selectElementSearchViewModel.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(SubModel_PropertyChanged);

            this.selectableElements = selectableElements;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Tries to set the selected elements to the given object. Not all sub viewmodels might be
 /// capable of setting a selection.
 /// </summary>
 /// <param name="element">Element to select.</param>
 public virtual void SetSelectedElement(object element)
 {
     SelectElementTreeViewModel.SetSelectedElement(element);
     SelectElementSearchViewModel.SetSelectedElement(element);
 }