using ComPDFKit.PDFAnnotation;
using ComPDFKitViewer.AnnotEvent;
using Dropbox.Api.Users;
using DryIoc;
using ImTools;
using Microsoft.Office.Interop.Word;
using PDF_Office.CustomControl;
using PDF_Office.CustomControl.CompositeControl;
using PDF_Office.Helper;
using PDF_Office.Model;
using PDF_Office.Model.BOTA;
using Prism.Commands;
using Prism.Common;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Annotations;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Media;
using DialogResult = Prism.Services.Dialogs.DialogResult;
using ListBox = System.Windows.Controls.ListBox;

namespace PDF_Office.ViewModels.Dialog.BOTA
{
    internal class ScreenAnnotationDialogViewModel : BindableBase, IDialogAware
    {
        public string Title => "";

        public event Action<IDialogResult> RequestClose;

        #region 类型的显示隐藏

        /// <summary>
        /// 高亮字体
        /// </summary>
        private Visibility highlightVisibility = Visibility.Collapsed;

        public Visibility HighlightVisibility
        {
            get { return highlightVisibility; }
            set
            {
                SetProperty(ref highlightVisibility, value);
            }
        }

        /// <summary>
        /// 手绘
        /// </summary>
        private Visibility freeHandVisibility = Visibility.Collapsed;

        public Visibility FreeHandVisibility
        {
            get { return freeHandVisibility; }
            set
            {
                SetProperty(ref freeHandVisibility, value);
            }
        }

        /// <summary>
        /// 便签
        /// </summary>
        private Visibility annotStickyVisibility = Visibility.Collapsed;

        public Visibility AnnotStickyVisibility
        {
            get { return annotStickyVisibility; }
            set
            {
                SetProperty(ref annotStickyVisibility, value);
            }
        }

        /// <summary>
        /// 图章
        /// </summary>
        private Visibility annotStampVisibility = Visibility.Collapsed;

        public Visibility AnnotStampVisibility
        {
            get { return annotStampVisibility; }
            set
            {
                SetProperty(ref annotStampVisibility, value);
            }
        }

        /// <summary>
        /// 线
        /// </summary>
        private Visibility sharpLineVisibility = Visibility.Collapsed;

        public Visibility SharpLineVisibility
        {
            get { return sharpLineVisibility; }
            set
            {
                SetProperty(ref sharpLineVisibility, value);
            }
        }

        /// <summary>
        /// 箭头
        /// </summary>
        private Visibility sharpArrowVisibility = Visibility.Collapsed;

        public Visibility SharpArrowVisibility
        {
            get { return sharpArrowVisibility; }
            set
            {
                SetProperty(ref sharpArrowVisibility, value);
            }
        }

        /// <summary>
        /// 圆
        /// </summary>
        private Visibility annotCircleVisibility = Visibility.Collapsed;

        public Visibility AnnotCircleVisibility
        {
            get { return annotCircleVisibility; }
            set
            {
                SetProperty(ref annotCircleVisibility, value);
            }
        }

        /// <summary>
        /// 矩形
        /// </summary>
        private Visibility annotSquareVisibility = Visibility.Collapsed;

        public Visibility AnnotSquareVisibility
        {
            get { return annotSquareVisibility; }
            set
            {
                SetProperty(ref annotSquareVisibility, value);
            }
        }

        /// <summary>
        /// 文本注释
        /// </summary>
        private Visibility annotFreeTextVisibility = Visibility.Collapsed;

        public Visibility AnnotFreeTextVisibility
        {
            get { return annotFreeTextVisibility; }
            set
            {
                SetProperty(ref annotFreeTextVisibility, value);
            }
        }

        /// <summary>
        /// 删除线
        /// </summary>
        private Visibility annotStrikeoutVisibility = Visibility.Collapsed;

        public Visibility AnnotStrikeoutVisibility
        {
            get { return annotStrikeoutVisibility; }
            set
            {
                SetProperty(ref annotStrikeoutVisibility, value);
            }
        }

        /// <summary>
        /// 下划线
        /// </summary>
        private Visibility underLineVisibility = Visibility.Collapsed;

        public Visibility UnderLineVisibility
        {
            get { return underLineVisibility; }
            set
            {
                SetProperty(ref underLineVisibility, value);
            }
        }

        #endregion 类型的显示隐藏

        public DelegateCommand CancelCommand { get; set; }

        public DelegateCommand<Object> OkCommnad { get; set; }

        public DelegateCommand<Object> CleanCommand { get; set; }
        public DelegateCommand<object> LoadedCommand { get; set; }
        public ObservableCollection<AnnotationHandlerEventArgs> AnnotationListItems { get; set; }

        private ObservableCollection<ColorItem> annotationColors = new ObservableCollection<ColorItem>();

        public ObservableCollection<ColorItem> AnnotationColors
        {
            get { return annotationColors; }
            set
            {
                SetProperty(ref annotationColors, value);
            }
        }

        private ObservableCollection<AuthorItem> annotationAuthor = new ObservableCollection<AuthorItem>();

        public ObservableCollection<AuthorItem> AnnotationAuthor
        {
            get { return annotationAuthor; }
            set
            {
                SetProperty(ref annotationAuthor, value);
            }
        }

        private CustomIconToggleBtn btnHighlight = null;
        private CustomIconToggleBtn btnFreeHand = null;
        private CustomIconToggleBtn btnAnnotSticky = null;
        private CustomIconToggleBtn btnAnnotStamp = null;
        private CustomIconToggleBtn btnSharpLine = null;
        private CustomIconToggleBtn btnSharpArrow = null;
        private CustomIconToggleBtn btnAnnotCircle = null;
        private CustomIconToggleBtn btnAnnotSquare = null;
        private CustomIconToggleBtn btnAnnotFreeText = null;
        private CustomIconToggleBtn btnAnnotStrikeout = null;
        private CustomIconToggleBtn btnUnderLine = null;
        private ListBox _ListColor = null;
        private ListBox _ListAuthor = null;

        private List<string> colors = new List<string>();
        private List<string> authors = new List<string>();
        private List<AnnotArgsType> annotArgsTypes = new List<AnnotArgsType>();

        public List<string> Colors { get => colors; set => colors = value; }
        public List<string> Authors { get => authors; set => authors = value; }
        public List<AnnotArgsType> AnnotArgsTypes { get => annotArgsTypes; set => annotArgsTypes = value; }

        public ScreenAnnotationDialogViewModel()
        {
            LoadedCommand = new DelegateCommand<object>(Loaded);
            CancelCommand = new DelegateCommand(CancelEvent);
            OkCommnad = new DelegateCommand<Object>(OkEvent);
            CleanCommand = new DelegateCommand<Object>(CleanEvent);
        }

        private void Loaded(object obj)
        {
            if (obj is CompositeCommandParameter composite)
            {
                if (composite.Parameter is Object[] arrys)
                {
                    btnHighlight = arrys[0] as CustomIconToggleBtn;
                    btnFreeHand = arrys[1] as CustomIconToggleBtn;
                    btnAnnotSticky = arrys[2] as CustomIconToggleBtn;
                    btnAnnotStamp = arrys[3] as CustomIconToggleBtn;
                    btnSharpLine = arrys[4] as CustomIconToggleBtn;
                    btnSharpArrow = arrys[5] as CustomIconToggleBtn;
                    btnAnnotCircle = arrys[6] as CustomIconToggleBtn;
                    btnAnnotSquare = arrys[7] as CustomIconToggleBtn;
                    btnAnnotFreeText = arrys[8] as CustomIconToggleBtn;
                    btnAnnotStrikeout = arrys[9] as CustomIconToggleBtn;
                    btnUnderLine = arrys[10] as CustomIconToggleBtn;
                    SetBtnSelectedState(arrys);
                }
            }
        }

        /// <summary>
        /// 记录设置按钮状态
        /// </summary>
        /// <param name="arrys"></param>
        private void SetBtnSelectedState(object[] arrys)
        {
            if (AnnotArgsTypes.Count > 0)
            {
                foreach (var item in AnnotArgsTypes)
                {
                    switch (item)
                    {
                        case AnnotArgsType.AnnotNone:
                            break;

                        case AnnotArgsType.AnnotSquare:

                            SetBtnType(btnAnnotSquare, false);
                            break;

                        case AnnotArgsType.AnnotCircle:

                            SetBtnType(btnAnnotCircle, false);
                            break;

                        case AnnotArgsType.AnnotSticky:

                            SetBtnType(btnAnnotSticky, false);
                            break;

                        case AnnotArgsType.AnnotLine:
                            foreach (var annoitem in AnnotationListItems)
                            {
                                if ((annoitem.AnnotHandlerEventArgs as LineAnnotArgs).HeadLineType >= (C_LINE_TYPE)1 || (annoitem.AnnotHandlerEventArgs as LineAnnotArgs).TailLineType >= (C_LINE_TYPE)1)
                                {
                                    //箭头
                                    SetBtnType(btnSharpArrow, false);
                                    break;
                                }
                                else
                                {
                                    //线
                                    SetBtnType(btnSharpLine, false);
                                    break;
                                }
                            }

                            break;

                        case AnnotArgsType.AnnotFreehand:
                            SetBtnType(btnFreeHand, false);
                            break;

                        case AnnotArgsType.AnnotErase:
                            break;

                        case AnnotArgsType.AnnotFreeText:
                            SetBtnType(btnAnnotFreeText, false);
                            break;

                        case AnnotArgsType.AnnotStamp:
                            SetBtnType(btnAnnotStamp, false);
                            break;

                        case AnnotArgsType.AnnotHighlight:
                            SetBtnType(btnHighlight, false);
                            break;

                        case AnnotArgsType.AnnotUnderline:
                            SetBtnType(btnUnderLine, false);
                            break;

                        case AnnotArgsType.AnnotStrikeout:
                            SetBtnType(btnAnnotStrikeout, false);
                            break;

                        case AnnotArgsType.AnnotSquiggly:
                            SetBtnType(btnAnnotSquare, false);
                            break;

                        case AnnotArgsType.AnnotLink:
                            break;

                        case AnnotArgsType.AnnotSelectTool:
                            break;

                        case AnnotArgsType.SnapshotTool:
                            break;

                        case AnnotArgsType.SnapshotWithEditTool:
                            break;

                        case AnnotArgsType.WidgetViewForm:
                            break;

                        case AnnotArgsType.AnnotSound:
                            break;

                        case AnnotArgsType.AnnotMedia:
                            break;

                        case AnnotArgsType.AnnotRedaction:
                            break;

                        default:
                            break;
                    }
                }
            }

            if (arrys[11] is System.Windows.Controls.ListBox listColor)
            {
                this._ListColor = listColor;

                if (Colors.Count > 0)
                {
                    listColor.ItemsSource = AnnotationColors;
                    foreach (var item in AnnotationColors)
                    {
                        foreach (var color in Colors)
                        {
                            if (item.Color.ToString() == color)
                            {
                                ListBoxItem myListBoxItem = (ListBoxItem)(listColor.ItemContainerGenerator.ContainerFromItem(item));
                                myListBoxItem.IsSelected = true;
                            }
                        }
                    }
                }
            }
            if (arrys[12] is System.Windows.Controls.ListBox listAuthor)
            {
                this._ListAuthor = listAuthor;

                if (Authors.Count > 0)
                {
                    listAuthor.ItemsSource = AnnotationAuthor;
                    foreach (var item in AnnotationAuthor)
                    {
                        foreach (var author in Authors)
                        {
                            if (item.Name == author)
                            {
                                ListBoxItem myListBoxItem = (ListBoxItem)(listAuthor.ItemContainerGenerator.ContainerFromItem(item));
                                myListBoxItem.IsSelected = true;
                            }
                        }
                    }
                }
            }
        }

        /// <summary>
        /// 清除筛选项
        /// </summary>
        /// <param name="obj"></param>
        private void CleanEvent(Object obj)
        {
            if (obj is Object[] arrys)
            {
                //CustomIconToggleBtn btnHighlight = arrys[0] as CustomIconToggleBtn;
                //CustomIconToggleBtn btnFreeHand = arrys[1] as CustomIconToggleBtn;
                //CustomIconToggleBtn btnAnnotSticky = arrys[2] as CustomIconToggleBtn;
                //CustomIconToggleBtn btnAnnotStamp = arrys[3] as CustomIconToggleBtn;
                //CustomIconToggleBtn btnSharpLine = arrys[4] as CustomIconToggleBtn;
                //CustomIconToggleBtn btnSharpArrow = arrys[5] as CustomIconToggleBtn;
                //CustomIconToggleBtn btnAnnotCircle = arrys[6] as CustomIconToggleBtn;
                //CustomIconToggleBtn btnAnnotSquare = arrys[7] as CustomIconToggleBtn;
                //CustomIconToggleBtn btnAnnotFreeText = arrys[8] as CustomIconToggleBtn;
                //CustomIconToggleBtn btnAnnotStrikeout = arrys[9] as CustomIconToggleBtn;
                //CustomIconToggleBtn btnUnderLine = arrys[10] as CustomIconToggleBtn;

                SetBtnType(btnHighlight, true);
                SetBtnType(btnFreeHand, true);
                SetBtnType(btnAnnotSticky, true);
                SetBtnType(btnAnnotStamp, true);
                SetBtnType(btnSharpLine, true);
                SetBtnType(btnSharpArrow, true);
                SetBtnType(btnAnnotCircle, true);
                SetBtnType(btnAnnotSquare, true);
                SetBtnType(btnAnnotFreeText, true);
                SetBtnType(btnAnnotStrikeout, true);
                SetBtnType(btnUnderLine, true);

                if (this._ListColor != null)
                {
                    this._ListColor.SelectedItems.Clear();
                }
                if (this._ListAuthor != null)
                {
                    this._ListAuthor.SelectedItems.Clear();
                }
                DialogParameters valuePairs = new DialogParameters();
                valuePairs.Add(ParameterNames.AnnotationCleanState, true);
                RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));
            }
        }

        /// <summary>
        /// 设置类型按钮状态
        /// </summary>
        /// <param name="btn"></param>
        private void SetBtnType(CustomIconToggleBtn btn, bool flag)
        {
            if (btn != null)
            {
                if (btn.IsChecked == flag)
                {
                    btn.IsChecked = !flag;
                }
            }
        }

        /// <summary>
        /// 确认
        /// </summary>
        /// <param name="obj"></param>
        private void OkEvent(Object obj)
        {
            if (obj is Object[] arrys)
            {
                List<AnnotArgsType> styleDic = GetAnnotArgsType(arrys);
                //ListBox listColor = arrys[11] as ListBox;
                //ListBox listAuthor = arrys[12] as ListBox;
                List<string> colors = new List<string>();
                List<string> authors = new List<string>();
                if (this._ListColor != null)
                {
                    if (this._ListColor.SelectedItems.Count > 0)
                    {
                        foreach (var item in this._ListColor.SelectedItems)
                        {
                            ColorItem color = item as ColorItem;
                            colors.Add(color.Color.ToString());
                        }
                    }
                }
                if (this._ListAuthor != null)
                {
                    if (this._ListAuthor.SelectedItems.Count > 0)
                    {
                        foreach (var item in this._ListAuthor.SelectedItems)
                        {
                            AuthorItem author = item as AuthorItem;
                            authors.Add(author.Name);
                        }
                    }
                }

                DialogParameters valuePairs = new DialogParameters();
                valuePairs.Add(ParameterNames.AnnotArgsTypes, styleDic);
                valuePairs.Add(ParameterNames.AnnotationColors, colors);
                valuePairs.Add(ParameterNames.AnnotationAuthor, authors);
                valuePairs.Add(ParameterNames.AnnotationCleanState, false);
                RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));
            }
        }

        /// <summary>
        /// 获取类型按钮状态
        /// </summary>
        /// <param name="arrys"></param>
        /// <returns></returns>
        private List<AnnotArgsType> GetAnnotArgsType(object[] arrys)
        {
            List<AnnotArgsType> styleDic = new List<AnnotArgsType>();
            //CustomIconToggleBtn btnHighlight = arrys[0] as CustomIconToggleBtn;
            //CustomIconToggleBtn btnFreeHand = arrys[1] as CustomIconToggleBtn;
            //CustomIconToggleBtn btnAnnotSticky = arrys[2] as CustomIconToggleBtn;
            //CustomIconToggleBtn btnAnnotStamp = arrys[3] as CustomIconToggleBtn;
            //CustomIconToggleBtn btnSharpLine = arrys[4] as CustomIconToggleBtn;
            //CustomIconToggleBtn btnSharpArrow = arrys[5] as CustomIconToggleBtn;
            //CustomIconToggleBtn btnAnnotCircle = arrys[6] as CustomIconToggleBtn;
            //CustomIconToggleBtn btnAnnotSquare = arrys[7] as CustomIconToggleBtn;
            //CustomIconToggleBtn btnAnnotFreeText = arrys[8] as CustomIconToggleBtn;
            //CustomIconToggleBtn btnAnnotStrikeout = arrys[9] as CustomIconToggleBtn;
            //CustomIconToggleBtn btnUnderLine = arrys[10] as CustomIconToggleBtn;
            GetBtnAnnotArgsTypeState(btnHighlight, styleDic, AnnotArgsType.AnnotHighlight);
            GetBtnAnnotArgsTypeState(btnFreeHand, styleDic, AnnotArgsType.AnnotFreehand);
            GetBtnAnnotArgsTypeState(btnAnnotSticky, styleDic, AnnotArgsType.AnnotSticky);
            GetBtnAnnotArgsTypeState(btnAnnotStamp, styleDic, AnnotArgsType.AnnotStamp);
            GetBtnAnnotArgsTypeState(btnSharpLine, styleDic, AnnotArgsType.AnnotLine);
            GetBtnAnnotArgsTypeState(btnSharpArrow, styleDic, AnnotArgsType.AnnotLine);
            GetBtnAnnotArgsTypeState(btnAnnotCircle, styleDic, AnnotArgsType.AnnotCircle);
            GetBtnAnnotArgsTypeState(btnAnnotSquare, styleDic, AnnotArgsType.AnnotSquare);
            GetBtnAnnotArgsTypeState(btnAnnotFreeText, styleDic, AnnotArgsType.AnnotFreeText);
            GetBtnAnnotArgsTypeState(btnAnnotStrikeout, styleDic, AnnotArgsType.AnnotStrikeout);
            GetBtnAnnotArgsTypeState(btnUnderLine, styleDic, AnnotArgsType.AnnotUnderline);
            return styleDic;
        }

        /// <summary>
        /// 添加被选中的类型按钮到集合
        /// </summary>
        /// <param name="btnType"></param>
        /// <param name="styleDic"></param>
        /// <param name="annotArgsType"></param>
        private void GetBtnAnnotArgsTypeState(CustomIconToggleBtn btnType, List<AnnotArgsType> styleDic, AnnotArgsType annotArgsType)
        {
            if (btnType != null)
            {
                if (btnType.IsChecked == true)
                {
                    if (styleDic.IndexOf(annotArgsType) == -1)
                    {
                        styleDic.Add(annotArgsType);
                    }
                }
            }
        }

        private void CancelEvent()
        {
            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
        }

        public bool CanCloseDialog()
        {
            return true;
        }

        public void OnDialogClosed()
        {
        }

        /// <summary>
        /// 添加筛选颜色
        /// </summary>
        /// <param name="color"></param>
        private void GetAnnotationColors(System.Windows.Media.Color color)
        {
            if (AnnotationColors.Count > 0)
            {
                for (int i = 0; i < AnnotationColors.Count; i++)
                {
                    System.Windows.Media.Color color1 = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(AnnotationColors[i].Color.ToString());
                    if (color1.R == color.R && color1.G == color.G && color1.B == color.B
                    && color1.A == color.A)
                    {
                        AnnotationColors.Remove(AnnotationColors[i]);
                    }
                }
            }
            AnnotationColors.Add(new ColorItem(color));
        }

        public void OnDialogOpened(IDialogParameters parameters)
        {
            ObservableCollection<AnnotationHandlerEventArgs> list;
            parameters.TryGetValue<ObservableCollection<AnnotationHandlerEventArgs>>(ParameterNames.AnnotationList, out list);
            AnnotationListItems = list;
            List<string> colors = new List<string>();
            List<string> authors = new List<string>();
            List<AnnotArgsType> annotArgsTypes = new List<AnnotArgsType>();
            parameters.TryGetValue<List<string>>(ParameterNames.AnnotationColors, out colors);
            parameters.TryGetValue<List<string>>(ParameterNames.AnnotationAuthor, out authors);
            parameters.TryGetValue<List<AnnotArgsType>>(ParameterNames.AnnotArgsTypes, out annotArgsTypes);
            if (colors != null)
            {
                this.Colors = colors;
            }
            if (authors != null)
            {
                this.Authors = authors;
            }
            if (annotArgsTypes != null)
            {
                this.AnnotArgsTypes = annotArgsTypes;
            }
            if (AnnotationListItems.Count <= 0)
            {
                return;
            }
            foreach (var item in AnnotationListItems)
            {
                AnnotationAuthor.Add(new AuthorItem(item.Author));

                AnnotHandlerEventArgs data = item.AnnotHandlerEventArgs;

                switch (item.EventType)
                {
                    case AnnotArgsType.AnnotFreeText://文本
                        if (data is FreeTextAnnotArgs textAnnotArgs)
                        {
                            GetAnnotationColors(textAnnotArgs.FontColor);
                        }
                        AnnotFreeTextVisibility = Visibility.Visible;
                        break;

                    case AnnotArgsType.AnnotHighlight://高亮
                        if (data is TextHighlightAnnotArgs highlightAnnotArgs)
                        {
                            GetAnnotationColors(highlightAnnotArgs.Color);
                        }
                        HighlightVisibility = Visibility.Visible;
                        break;

                    case AnnotArgsType.AnnotFreehand://手绘
                        if (data is FreehandAnnotArgs freehandAnnotArgs)
                        {
                            GetAnnotationColors(freehandAnnotArgs.InkColor);
                        }
                        FreeHandVisibility = Visibility.Visible;
                        break;

                    case AnnotArgsType.AnnotSquiggly://波浪线

                        break;

                    case AnnotArgsType.AnnotStamp://图章
                        AnnotStampVisibility = Visibility.Visible;
                        break;

                    case AnnotArgsType.AnnotStrikeout://删除线
                        if (data is TextStrikeoutAnnotArgs textStrikeoutAnnotArgs)
                        {
                            GetAnnotationColors(textStrikeoutAnnotArgs.Color);
                        }
                        AnnotStickyVisibility = Visibility.Visible;
                        break;

                    case AnnotArgsType.AnnotSticky://便签
                        if (data is StickyAnnotArgs stickyAnnotArgs)
                        {
                            GetAnnotationColors(stickyAnnotArgs.Color);
                        }
                        AnnotStickyVisibility = Visibility.Visible;
                        break;

                    case AnnotArgsType.AnnotUnderline://下划线
                        if (data is TextUnderlineAnnotArgs textUnderlineAnnotArgs)
                        {
                            GetAnnotationColors(textUnderlineAnnotArgs.Color);
                        }
                        UnderLineVisibility = Visibility.Visible;
                        break;

                    case AnnotArgsType.AnnotLine:
                        if ((item.AnnotHandlerEventArgs as LineAnnotArgs).HeadLineType >= (C_LINE_TYPE)1 || (item.AnnotHandlerEventArgs as LineAnnotArgs).TailLineType >= (C_LINE_TYPE)1)
                        {
                            //箭头
                            SharpArrowVisibility = Visibility.Visible;
                        }
                        else
                        {
                            //线
                            SharpLineVisibility = Visibility.Visible;
                        }
                        GetAnnotationColors((item.AnnotHandlerEventArgs as LineAnnotArgs).LineColor);

                        break;

                    case AnnotArgsType.AnnotSquare://矩形
                        if (data is SquareAnnotArgs squareAnnotArgs)
                        {
                            GetAnnotationColors(squareAnnotArgs.BgColor);
                            GetAnnotationColors(squareAnnotArgs.LineColor);
                        }
                        AnnotSquareVisibility = Visibility.Visible;
                        break;

                    case AnnotArgsType.AnnotCircle://圆
                        if (data is CircleAnnotArgs circleAnnotArgs)
                        {
                            GetAnnotationColors(circleAnnotArgs.BgColor);
                            GetAnnotationColors(circleAnnotArgs.LineColor);
                        }
                        AnnotCircleVisibility = Visibility.Visible;
                        break;
                }
            }

            AnnotationAuthor = new ObservableCollection<AuthorItem>(AnnotationAuthor.DistinctHelper(s => s.Name));
        }
    }
}