Esempio n. 1
0
        public ConfigScaffolderViewModel(ConfigScaffolderModel model)
            : base(model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            Model = model;

            // ConfigName = model.ConfigName;
            ConfigTypesInternal    = new ObservableCollection <ModelType>();
            ConfigTypes            = new ListCollectionView(ConfigTypesInternal);
            ConfigTypes.CustomSort = new DataContextModelTypeComparer();
            foreach (ModelType modelType in Model.ConfigTypes)
            {
                ConfigTypesInternal.Add(modelType);
            }

            if (model.ConfigType != null)
            {
                ConfigType = Model.ConfigType;
                ConfigName = ConfigType.DisplayName;
            }

            // SetValidationMessage(Model.ValidateDataContextType(DataContextType), "DataContextType");

            DataContextTypesInternal    = new ObservableCollection <ModelType>();
            DataContextTypes            = new ListCollectionView(DataContextTypesInternal);
            DataContextTypes.CustomSort = new DataContextModelTypeComparer();

            IsDataContextSupported = Model.IsDataContextSupported;
            if (Model.IsDataContextSupported)
            {
                foreach (ModelType modelType in Model.DataContextTypes)
                {
                    DataContextTypesInternal.Add(modelType);
                }

                if (model.DataContextType != null)
                {
                    // We have a saved datacontext selection
                    DataContextType     = Model.DataContextType;
                    DataContextTypeName = DataContextType.DisplayName;
                }

                SetValidationMessage(Model.ValidateDataContextType(DataContextType), "DataContextType");
            }
        }
Esempio n. 2
0
        public ConfigScaffolderViewModel(ConfigScaffolderModel model)
            : base(model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            Model = model;

            // ConfigName = model.ConfigName;
            ConfigTypesInternal = new ObservableCollection<ModelType>();
            ConfigTypes = new ListCollectionView(ConfigTypesInternal);
            ConfigTypes.CustomSort = new DataContextModelTypeComparer();
            foreach (ModelType modelType in Model.ConfigTypes)
            {
                ConfigTypesInternal.Add(modelType);
            }

            if (model.ConfigType != null)
            {
                ConfigType = Model.ConfigType;
                ConfigName = ConfigType.DisplayName;
            }

            // SetValidationMessage(Model.ValidateDataContextType(DataContextType), "DataContextType");

            DataContextTypesInternal = new ObservableCollection<ModelType>();
            DataContextTypes = new ListCollectionView(DataContextTypesInternal);
            DataContextTypes.CustomSort = new DataContextModelTypeComparer();

            IsDataContextSupported = Model.IsDataContextSupported;
            if (Model.IsDataContextSupported)
            {
                foreach (ModelType modelType in Model.DataContextTypes)
                {
                    DataContextTypesInternal.Add(modelType);
                }

                if (model.DataContextType != null)
                {
                    // We have a saved datacontext selection
                    DataContextType = Model.DataContextType;
                    DataContextTypeName = DataContextType.DisplayName;
                }

                SetValidationMessage(Model.ValidateDataContextType(DataContextType), "DataContextType");
            }
        }