Exemplo n.º 1
0
        public ClassificationViewModel(Classification classification, IResetValuesProvider resetValuesProvider)
        {
            _classificationName    = classification.Name;
            _isDisabled            = classification.IsDisabled;
            _IsDisabledInEditor    = classification.IsDisabledInEditor;
            _IsDisabledInQuickInfo = classification.IsDisabledInQuickInfo;
            _isDisabledInXml       = classification.IsDisabledInXml;
            _isBold            = classification.IsBold;
            _isOverline        = classification.IsOverline;
            _isUnderline       = classification.IsUnderline;
            _isStrikethrough   = classification.IsStrikethrough;
            _isBaseLine        = classification.IsBaseline;
            _fontRenderingSize = classification.FontRenderingSize;

            FontFamiliesContainer  = new FontFamiliesViewModel(classification.FontFamily);
            FontStylesContainer    = new FontStylesViewModel(classification.FontStyle, classification.FontFamily);
            FontStretchesContainer = new FontStretchesViewModel(
                classification.FontStretch, classification.FontFamily, classification.FontStyle);

            FontFamiliesContainer.PropertyChanged += FontStylesContainer.OnSelectedFontFamilyChanged;
            FontFamiliesContainer.PropertyChanged += FontStretchesContainer.OnSelectedFontFamilyChanged;
            FontStylesContainer.PropertyChanged   += FontStretchesContainer.OnSelectedFontStyleChanged;

            Foreground = new ClassificationColorViewModel(
                _classificationName, classification.Foreground, classification.ForegroundWasReset, resetValuesProvider);
            Background = new ClassificationColorViewModel(
                _classificationName, classification.Background, classification.BackgroundWasReset, resetValuesProvider);

            _fontRenderingSizeWasReset = classification.FontRenderingSizeWasReset;

            DisplayName = classification.DisplayName;

            ResetFontRenderingSize = new DelegateCommand(() =>
            {
                SetProperty(ref _fontRenderingSize, resetValuesProvider.GetFontRenderingSize(_classificationName), nameof(Size));
                _fontRenderingSizeWasReset = true;
            });
        }