Example #1
0
        private void LoadState()
        {
            Log.Information("Loading State");
            var regAccessor             = new RegistryAccessor();
            var fontFamConverter        = new Media.FontFamilyConverter();
            var fontFamily              = regAccessor.Read("FONTFAMILY");
            var fontWeightToBeConverted = regAccessor.Read("FONTWEIGHT");
            var fontSize  = regAccessor.Read("FONTSIZE");
            var fontStyle = regAccessor.Read("FONTSYLE");

            if (fontFamily != null)
            {
                _formatModel.Family = fontFamConverter.ConvertFromString(fontFamily) as Media.FontFamily;
            }

            if (fontWeightToBeConverted != null)
            {
                _formatModel.Weight = FontWeight.FromOpenTypeWeight(Convert.ToInt32(regAccessor.Read("FONTWEIGHT")));
            }

            if (fontSize != null && fontSize != "0")
            {
                _formatModel.Size = Convert.ToDouble(fontSize);
            }

            if (fontStyle != null)
            {
                _formatModel.Style = ConvertFontSytleFromString(fontStyle);
            }
        }
Example #2
0
        private void SaveState()
        {
            Log.Information("Saving State");
            var regAccessor = new RegistryAccessor();

            regAccessor.Write("FONTFAMILY", _formatModel.Family);
            regAccessor.Write("FONTWEIGHT", _formatModel.Weight.ToOpenTypeWeight().ToString());
            regAccessor.Write("FONTSIZE", _formatModel.Size);
            regAccessor.Write("FONTSYLE", _formatModel.Style.ToString());
        }