コード例 #1
0
        internal ISOViewModelBase(ISerializableObject thisObj, ISOViewModelContainer container)
        {
            _obj = thisObj;
            _container = container;
            Name = getName();
            Icon = getIcon();

            if (!isRoot())
            {
                var pVM = _container.getViewModelForISO(Parent);
                pVM.injectChild(this);
            }

            fillProperties();
        }
コード例 #2
0
        public static ISOViewModelBase fromISO(ISerializableObject obj, ISOViewModelContainer container)
        {
            if (obj != null && container != null)
            {
                if(obj is CollectionEventSeries)
                    return new EventSeriesVM(obj as CollectionEventSeries,container);
                if (obj is CollectionEvent)
                    return new CollectionEventVM(obj as CollectionEvent, container);
                if (obj is CollectionSpecimen)
                    return new CollectionSpecimenVM(obj as CollectionSpecimen, container);
                if (obj is IdentificationUnitAnalysis)
                    return new IUAnalysisVM(obj as IdentificationUnitAnalysis, container);
                if (obj is IdentificationUnitGeoAnalysis)
                    return new IUGeoAnalysisVM(obj as IdentificationUnitGeoAnalysis, container);

                if (obj is IdentificationUnit)
                    return new IdentificationUnitVM(obj as IdentificationUnit, container);

                return new DefaultVM(obj, container);

            }
            return null;
        }