Esempio n. 1
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public ResourcesViewModel(IEventAggregator eventAggregator)
        {
            Items = new ObservableCollection <DirectoryItemViewModel>();
            List <DirectoryItem> servers = DirectoryStructure.GetServers();

            foreach (DirectoryItem server in servers)
            {
                var newItem = new DirectoryItemViewModel(server, eventAggregator);
                Items.Add(newItem);
                SelectedItem = newItem;
            }

            this.eventAggregator = eventAggregator;

            // Abboniert das Event wenn sich das SelectedItem ändert
            eventAggregator.GetEvent <PubSubEvent <DirectoryItemViewModel> >().Subscribe(SelectedItemChange);
        }