using Microsoft.Office.Interop.Word;
using PDF_Office.Model;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PDF_Office.ViewModels.Dialog.BOTA
{
    internal class BookmarkInfoDialogViewModel : BindableBase, IDialogAware
    {
        private string bookmarkInfo;

        public string BookmarkInfo
        {
            get { return bookmarkInfo; }
            set
            {
                SetProperty(ref bookmarkInfo, value);
            }
        }

        public DelegateCommand CancelCommand { get; set; }

        public DelegateCommand OkCommnad { get; set; }

        public string Title => "";

        public event Action<IDialogResult> RequestClose;

        public BookmarkInfoDialogViewModel()
        {
            CancelCommand = new DelegateCommand(CancelEvent);
            OkCommnad = new DelegateCommand(OkEvent);
        }

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

        private void OkEvent()
        {
            RequestClose.Invoke(new DialogResult(ButtonResult.OK));
        }

        public bool CanCloseDialog()
        {
            return true;
        }

        public void OnDialogClosed()
        {
        }

        public void OnDialogOpened(IDialogParameters parameters)
        {
            string mark;
            parameters.TryGetValue<string>(ParameterNames.BookmarkInfo, out mark);
            BookmarkInfo = mark;

            //string title;
            //parameters.TryGetValue<string>(ParameterNames.Title, out title);
            //Title = title;
            return;
        }
    }
}