示例#1
0
        public MainViewModel(
            IUserInterfaceService userInterfaceService,
            IOptionsService optionsService,
            IDialogService dialogService)
        {
            _userInterfaceService = userInterfaceService;
            _optionsService       = optionsService;
            _dialogService        = dialogService;
            _imageService         = new BibleTextImage();

            InitCommands();

            SystemFonts = GetSystemFonts();

            _currentTheme = new OnlyVTheme();
            _isSampleBackgroundImageUsed = true;

            BibleEpubFiles = GetBibleEpubFiles();

            Messenger.Default.Register <DragOverMessage>(this, OnDragOver);
            Messenger.Default.Register <DragDropMessage>(this, OnDragDrop);

            UpdateTextSamples();

            SaveSignature();
        }
示例#2
0
        public void TestImageCreation()
        {
            if (!File.Exists(EpubPath))
            {
                return;
            }

            BibleTextImage image  = new BibleTextImage();
            var            images = image.Generate(EpubPath, 1, "3:15");
        }
示例#3
0
        public void Refresh()
        {
            if (_currentBookNumber > 0 && !string.IsNullOrEmpty(_currentChapterAndVerses))
            {
                using (_userInterfaceService.GetBusy())
                {
                    var bibleTextImage = new BibleTextImage();

                    ApplyFormatting(bibleTextImage, _optionsService.ThemePath);

                    _images = _optionsService.EpubPath != null
                        ? bibleTextImage.Generate(
                        _optionsService.EpubPath,
                        _currentBookNumber,
                        _currentChapterAndVerses).ToArray()
                        : null;
                }
            }
        }
示例#4
0
        private void ApplyFormatting(BibleTextImage bibleTextImage, string themePath)
        {
            var cacheEntry = ThemeFile.Read(themePath);

            OnlyVTheme  theme;
            ImageSource backgroundImage;

            if (cacheEntry == null)
            {
                // must use default...
                theme           = new OnlyVTheme();
                backgroundImage = BitmapHelper.ConvertBitmap(Properties.Resources.Blue);
            }
            else
            {
                theme           = cacheEntry.Theme;
                backgroundImage = cacheEntry.BackgroundImage;
            }

            ApplyFormatting(bibleTextImage, theme, backgroundImage);
        }
示例#5
0
        private void ApplyFormatting(
            BibleTextImage bibleTextImage,
            OnlyVTheme theme,
            ImageSource backgroundImage)
        {
            // dimensions...
            bibleTextImage.Width        = theme.Dimensions.ImageWidth;
            bibleTextImage.Height       = theme.Dimensions.ImageHeight;
            bibleTextImage.LeftMargin   = theme.Dimensions.LeftMargin;
            bibleTextImage.TopMargin    = theme.Dimensions.TopMargin;
            bibleTextImage.RightMargin  = theme.Dimensions.RightMargin;
            bibleTextImage.BottomMargin = theme.Dimensions.BottomMargin;

            // background...
            bibleTextImage.BackgroundColor       = ConvertFromString(theme.Background.Colour, Colors.Blue);
            bibleTextImage.BackgroundImageSource = _optionsService.UseBackgroundImage
                ? backgroundImage
                : null;
            bibleTextImage.BackgroundImageOpacity = theme.Background.ImageOpacity;

            // formatting...
            bibleTextImage.AllowAutoFit            = _optionsService.AutoFit;
            bibleTextImage.ShowBreakInVerses       = _optionsService.ShowVerseBreaks;
            bibleTextImage.UseContinuationEllipses = _optionsService.UseContinuationEllipses;
            bibleTextImage.UseTildeParaSeparator   = _optionsService.UseTildeMarker;
            bibleTextImage.TrimPunctuation         = _optionsService.TrimPunctuation;
            bibleTextImage.TrimQuotes = _optionsService.TrimQuotes;

            // body text...
            bibleTextImage.MainFont.FontFamily      = new FontFamily(theme.BodyText.Font.Family);
            bibleTextImage.MainFont.FontSize        = AdaptToScaling(theme.BodyText.Font.Size);
            bibleTextImage.MainFont.FontColor       = ConvertFromString(theme.BodyText.Font.Colour, Colors.White);
            bibleTextImage.MainFont.FontStyle       = theme.BodyText.Font.Style.AsWindowsFontStyle();
            bibleTextImage.MainFont.FontWeight      = theme.BodyText.Font.Weight.AsWindowsFontWeight();
            bibleTextImage.MainFont.Opacity         = theme.BodyText.Font.Opacity;
            bibleTextImage.HorzAlignment            = theme.BodyText.HorizontalAlignment.AsWindowsTextAlignment();
            bibleTextImage.LineSpacing              = theme.BodyText.LineSpacing;
            bibleTextImage.BodyDropShadow           = theme.BodyText.DropShadow.Show;
            bibleTextImage.BodyDropShadowBlurRadius = theme.BodyText.DropShadow.BlurRadius;
            bibleTextImage.BodyDropShadowColor      = ConvertFromString(theme.BodyText.DropShadow.Colour, Colors.Black);
            bibleTextImage.BodyDropShadowDepth      = theme.BodyText.DropShadow.Depth;
            bibleTextImage.BodyDropShadowOpacity    = theme.BodyText.DropShadow.Opacity;
            bibleTextImage.BodyVerticalAlignment    = theme.BodyText.BodyVerticalAlignment;

            // title text...
            bibleTextImage.TitleFont.FontFamily          = new FontFamily(theme.TitleText.Font.Family);
            bibleTextImage.TitleFont.FontSize            = AdaptToScaling(theme.TitleText.Font.Size);
            bibleTextImage.TitleFont.FontColor           = ConvertFromString(theme.TitleText.Font.Colour, Colors.White);
            bibleTextImage.TitleFont.FontStyle           = theme.TitleText.Font.Style.AsWindowsFontStyle();
            bibleTextImage.TitleFont.FontWeight          = theme.TitleText.Font.Weight.AsWindowsFontWeight();
            bibleTextImage.TitleFont.Opacity             = theme.TitleText.Font.Opacity;
            bibleTextImage.TitleHorzAlignment            = theme.TitleText.HorizontalAlignment.AsWindowsTextAlignment();
            bibleTextImage.TitlePosition                 = theme.TitleText.Position;
            bibleTextImage.TitleDropShadow               = theme.TitleText.DropShadow.Show;
            bibleTextImage.TitleDropShadowBlurRadius     = theme.TitleText.DropShadow.BlurRadius;
            bibleTextImage.TitleDropShadowColor          = ConvertFromString(theme.TitleText.DropShadow.Colour, Colors.Black);
            bibleTextImage.TitleDropShadowDepth          = theme.TitleText.DropShadow.Depth;
            bibleTextImage.TitleDropShadowOpacity        = theme.TitleText.DropShadow.Opacity;
            bibleTextImage.TitleSpaceBetweenVerseNumbers = _optionsService.SpaceBetweenTitleVerseNumbers;
            bibleTextImage.UseAbbreviatedBookNames       = _optionsService.UseAbbreviatedBookNames;

            // verse nos...
            // font family same as body font
            var verseNosFontFamily = theme.BodyText.Font.Family;

            bibleTextImage.ShowVerseNumbers     = _optionsService.ShowVerseNos;
            bibleTextImage.VerseFont.FontFamily = new FontFamily(verseNosFontFamily);
            bibleTextImage.VerseFont.FontColor  = ConvertFromString(theme.VerseNumbers.Colour, Colors.White);
            bibleTextImage.VerseFont.FontStyle  = theme.VerseNumbers.Style.AsWindowsFontStyle();
            bibleTextImage.VerseFont.FontWeight = theme.VerseNumbers.Weight.AsWindowsFontWeight();
            bibleTextImage.VerseFont.Opacity    = theme.VerseNumbers.Opacity;
        }
示例#6
0
 public void TestImageCreation()
 {
     BibleTextImage image  = new BibleTextImage();
     var            images = image.Generate(EpubPath, 1, "3:15");
 }