using ComPDFKit_Conversion.Options;
using PDF_Office.Model;
using PDF_Office.Model.Dialog.ConverterDialogs;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;

namespace PDF_Office.ViewModels.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageConverter
{
    public class HomePageConverterExcelViewModel : BindableBase, INavigationAware
    {
        #region 参数和属性
        public ConverterExcelDialogModel ConverterExcelModel = new ConverterExcelDialogModel();

        public HomePageConverterDialogViewModel homePageConverterDialogViewModel { get; set; }
        #endregion

        #region 委托声明
        public DelegateCommand<string> RadioButtonCommand { get; set; }
        #endregion

        public HomePageConverterExcelViewModel()
        {
            RadioButtonCommand = new DelegateCommand<string>(radiobutton);
        }
        #region 逻辑函数
        private void radiobutton(string e)
        {
            string radioButton = e;
            if (radioButton != null)
            {
                switch (radioButton)
                {
                    case "ForEachPageRadioBtn":
                        homePageConverterDialogViewModel. ConverterExcelModel.excelOption = ConverterExcelModel.ExcelOptions();
                        break;
                    case "ForTheDocRadioBtn":
                        homePageConverterDialogViewModel.ConverterExcelModel.excelOption = ConverterExcelModel.ExcelOptions(WorksheetOptions.ForTheDocument);
                        break;
                    case "OnlyTableRadioBtn":
                        homePageConverterDialogViewModel.ConverterExcelModel.excelOption = ConverterExcelModel.ExcelOptions(WorksheetOptions.ForEachTable, ContentOptions.OnlyTable);
                        break;
                    default:
                        break;
                }
            }

        }
        #endregion
        #region 构架行为
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            var homePageConverterVM = navigationContext.Parameters[ParameterNames.ViewContentViewModel] as HomePageConverterDialogViewModel;
            if (homePageConverterVM != null)
            {
                homePageConverterDialogViewModel = homePageConverterVM;
            }
        }

        public bool IsNavigationTarget(NavigationContext navigationContext)
        {
            return true;
        }

        public void OnNavigatedFrom(NavigationContext navigationContext)
        {
        }
        #endregion
    }
}
