public TitleManageViewModel()
        {
            Dictionary <string, TitleAdornmentLayer> layerDictionary = GetTitleAdornmentLayers();

            if (layerDictionary.Count > 0)
            {
                titles = new ObservableCollection <TitleViewModel>();
                foreach (var layerPair in layerDictionary)
                {
                    TitleViewModel entity = new TitleViewModel()
                    {
                        ID = layerPair.Key
                    };
                    entity.Load(layerPair.Value);
                    entity.PropertyChanged += (sender, e) => { ChangePreview(); };
                    titles.Add(entity);
                }
            }
            else
            {
                TitleViewModel entity = new TitleViewModel();
                entity.PropertyChanged += (sender, e) => { ChangePreview(); };
                titles = new ObservableCollection <TitleViewModel> {
                    entity
                };
            }
            SelectedTitle = Titles.FirstOrDefault();
        }
        public void AddNewTitle()
        {
            TitleViewModel entity = new TitleViewModel();

            entity.Title            = String.Format(CultureInfo.InvariantCulture, "{0}{1}", "New Title", GetMaxIndex() + 1);
            entity.PropertyChanged += (sender, e) => { ChangePreview(); };
            Titles.Add(entity);
            SelectedTitle = Titles[Titles.Count - 1];
        }
        private void SetPropertiesForTitleAdronmentLayer(TitleAdornmentLayer titleAdornmentLayer, TitleViewModel entity)
        {
            titleAdornmentLayer.Title = entity.Title;
            DrawingFontStyles drawingFontStyles = DrawingFontStyles.Regular;

            if (entity.IsBold)
            {
                drawingFontStyles = drawingFontStyles | DrawingFontStyles.Bold;
            }
            if (entity.IsItalic)
            {
                drawingFontStyles = drawingFontStyles | DrawingFontStyles.Italic;
            }
            if (entity.IsStrikeout)
            {
                drawingFontStyles = drawingFontStyles | DrawingFontStyles.Strikeout;
            }
            if (entity.IsUnderline)
            {
                drawingFontStyles = drawingFontStyles | DrawingFontStyles.Underline;
            }

            titleAdornmentLayer.TitleFont      = new GeoFont(entity.FontName.Source, entity.FontSize, drawingFontStyles);
            titleAdornmentLayer.XOffsetInPixel = entity.Left;
            titleAdornmentLayer.YOffsetInPixel = entity.Top;
            titleAdornmentLayer.FontColor      = entity.FontColor;
            titleAdornmentLayer.Rotation       = entity.Angle;
            titleAdornmentLayer.Location       = entity.TitleLocation;
            titleAdornmentLayer.HaloPen        = entity.DoesAddHalo ? new GeoPen(entity.HaloColor, entity.HaloThickness) : null;

            if (entity.IsEnableMask)
            {
                titleAdornmentLayer.MaskFillColor        = entity.MaskFillColor;
                titleAdornmentLayer.MaskOutlineColor     = entity.MaskOutlineColor;
                titleAdornmentLayer.MaskOutlineThickness = entity.MaskOutlineThickness;
                titleAdornmentLayer.MaskMargin           = entity.MaskMarginValue;
            }
            else
            {
                titleAdornmentLayer.MaskFillColor    = null;
                titleAdornmentLayer.MaskOutlineColor = null;
            }
        }