using PDF_Office.CustomControl;
using PDF_Office.Helper;
using PDF_Office.ViewModels.Dialog.ConverterDialogs;
using PDF_Office.ViewModels.Dialog.HomePageToolsDialogs;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace PDF_Office.Views.Dialog.HomePageToolsDialogs
{
    /// <summary>
    /// MainPageExtractDialog.xaml 的交互逻辑
    /// </summary>
    public partial class HomePageExtractDialog : UserControl
    {
        public HomePageExtractDialog()
        {
            InitializeComponent();
        }

        private void PageTurningPreview_Loaded(object sender, RoutedEventArgs e)
        {
            ExtractPreview.document = ((HomePageExtractDialogViewModel)this.DataContext).document;
            char[] enumerationSeparator = new char[] { ',' };
            char[] rangeSeparator = new char[] { '-' };
            if (!CommonHelper.GetPagesInRange(ref ExtractPreview.PageIndexLists, "1-" + ExtractPreview.document.PageCount.ToString(), ExtractPreview.document.PageCount, enumerationSeparator, rangeSeparator))
            { //TODO
                Trace.WriteLine("输入不对");
                MessageBoxEx.Show("输入不对");
                return;
            }
            ExtractPreview.AwaitRenderBitmap(ExtractPreview.document);
            ExtractPreview.PageIndex.Text = ExtractPreview.document.PageCount.ToString();

        }
    }
}
