Beispiel #1
0
        internal NamingRuleTreeItemViewModel(
            string name,
            SymbolSpecificationViewModel symbolSpec,
            NamingStyleViewModel namingStyle,
            EnforcementLevel enforcementLevel,
            NamingStylesOptionPageControlViewModel vm)
        {
            this.EnforcementLevel       = enforcementLevel;
            this._title                 = name;
            this.symbolSpec             = symbolSpec;
            this.namingStyle            = namingStyle;
            this._namingStylesViewModel = vm;

            this.children = new ChildRuleCollection(this);
            this.children.CollectionChanged += OnChildrenCollectionChanged;
        }
        public NamingRuleDialogViewModel(
            string title,
            SymbolSpecificationViewModel symbolSpecification,
            IList <SymbolSpecificationViewModel> symbolSpecificationList,
            NamingStyleViewModel namingStyle,
            IList <NamingStyleViewModel> namingStyleList,
            NamingRuleTreeItemViewModel parent,
            IList <NamingRuleTreeItemViewModel> allowableParentList,
            EnforcementLevel enforcementLevel,
            INotificationService notificationService)
        {
            this._notificationService = notificationService;

            this._title = title;

            this._symbolSpecificationList          = new CollectionView(symbolSpecificationList);
            this._selectedSymbolSpecificationIndex = symbolSpecificationList.IndexOf(symbolSpecification);

            this._namingStyleList  = new CollectionView(namingStyleList);
            this._namingStyleIndex = namingStyleList.IndexOf(namingStyle);

            allowableParentList.Insert(0, new NamingRuleTreeItemViewModel("-- None --"));
            this._parentRuleList  = new CollectionView(allowableParentList);
            this._parentRuleIndex = parent != null?allowableParentList.IndexOf(parent) : 0;

            if (_parentRuleIndex < 0)
            {
                _parentRuleIndex = 0;
            }

            _enforcementLevelsList = new List <EnforcementLevel>
            {
                new EnforcementLevel(DiagnosticSeverity.Hidden),
                new EnforcementLevel(DiagnosticSeverity.Info),
                new EnforcementLevel(DiagnosticSeverity.Warning),
                new EnforcementLevel(DiagnosticSeverity.Error),
            };

            _enforcementLevelIndex = _enforcementLevelsList.IndexOf(_enforcementLevelsList.Single(e => e.Value == enforcementLevel.Value));
        }
        public NamingRuleDialogViewModel(
            string title,
            SymbolSpecificationViewModel symbolSpecification,
            IList<SymbolSpecificationViewModel> symbolSpecificationList,
            NamingStyleViewModel namingStyle,
            IList<NamingStyleViewModel> namingStyleList,
            NamingRuleTreeItemViewModel parent,
            IList<NamingRuleTreeItemViewModel> allowableParentList,
            EnforcementLevel enforcementLevel,
            INotificationService notificationService)
        {
            this._notificationService = notificationService;

            this._title = title;
            
            this._symbolSpecificationList = new CollectionView(symbolSpecificationList);
            this._selectedSymbolSpecificationIndex = symbolSpecificationList.IndexOf(symbolSpecification);

            this._namingStyleList = new CollectionView(namingStyleList);
            this._namingStyleIndex = namingStyleList.IndexOf(namingStyle);

            allowableParentList.Insert(0, new NamingRuleTreeItemViewModel("-- None --"));
            this._parentRuleList = new CollectionView(allowableParentList);
            this._parentRuleIndex = parent != null ? allowableParentList.IndexOf(parent) : 0;
            if (_parentRuleIndex < 0)
            {
                _parentRuleIndex = 0;
            }

            _enforcementLevelsList = new List<EnforcementLevel>
                {
                    new EnforcementLevel(DiagnosticSeverity.Hidden),
                    new EnforcementLevel(DiagnosticSeverity.Info),
                    new EnforcementLevel(DiagnosticSeverity.Warning),
                    new EnforcementLevel(DiagnosticSeverity.Error),
                };

            _enforcementLevelIndex = _enforcementLevelsList.IndexOf(_enforcementLevelsList.Single(e => e.Value == enforcementLevel.Value));
        }