Exemplo n.º 1
0
        private void HydroSystemsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            HydroSystemViewModel system = HydroSystemsListBox.SelectedItem as HydroSystemViewModel;

            if (system != null)
            {
                HydroSystemName = system.Name;
            }
            else
            {
                HydroSystemsListBox.SelectedIndex = 0;
                return;
            }
            HydroTopologyCollectionViewModel systemTopology = hydroTopologyDataProvider.GetSystemTopology(HydroSystemName);

            SystemTopologyGrid.ItemsSource = systemTopology;
            //RowLoaded += BaseDataGrid_Formating;
        }
Exemplo n.º 2
0
        public HydroTopologyCollectionViewModel GetSystemTopology(string system)
        {
            UIObjects = new HydroTopologyCollectionViewModel();

            List <HydroTopology> dataObjects = HydroTopologyDataAccess.GetSystemTopology(system);

            foreach (HydroTopology dataObject in dataObjects)
            {
                UIObjects.Add(new HydroTopologyViewModel(dataObject));
            }

            if (UIObjects.Count == 0)
            {
                UIObjects.Add(new HydroTopologyViewModel());
            }

            UIObjects.CollectionChanged += new NotifyCollectionChangedEventHandler(ObjectsCollectionChanged);
            UIObjects.ItemEndEdit       += new ItemEndEditEventHandler(ObjectsItemEndEdit);
            return(UIObjects);
        }