Ejemplo n.º 1
0
        public NonConventionalPlantBlocksDataGrid(EntitiesCollections entitiesCollections) : base(entitiesCollections)
        {
            InitializeComponent();

            NonConventionalPlantBlocksCollectionViewModel items = ItemsSource as NonConventionalPlantBlocksCollectionViewModel;

            if (items.Count == 1)
            {
                NonConventionalPlantBlockViewModel item = items[0] as NonConventionalPlantBlockViewModel;
                if (item.Name == null)
                {
                    CurrentColumn              = NameColumn;
                    NameColumn.IsReadOnly      = false;
                    BlockColumn.IsReadOnly     = false;
                    ReductionFactor.IsReadOnly = false;
                    Case.IsReadOnly            = false;
                    Id.IsReadOnly              = false;
                }
            }
        }
Ejemplo n.º 2
0
        public NonConventionalPlantBlocksCollectionViewModel GetObjects()
        {
            UIObjects = new NonConventionalPlantBlocksCollectionViewModel();

            List <NonConventionalPlantBlock> dataObjects = NonConventionalPlantBlocksDataAccess.GetObjects();

            foreach (NonConventionalPlantBlock dataObject in dataObjects)
            {
                UIObjects.Add(new NonConventionalPlantBlockViewModel(dataObject));
            }

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

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

            return(UIObjects);
        }