using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
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.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MessageBox = System.Windows.MessageBox;
using OpenFileDialog = Microsoft.Win32.OpenFileDialog;

namespace AutoUnity
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        ServiceConfigure serviceConfigure;
        public MainWindow()
        {
            InitializeComponent();

            serviceConfigure = new ServiceConfigure();
        }

        private void btnOpenClick(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "xlsx|*.xlsx";
            if (ofd.ShowDialog() == true) 
            {
                bool ret = serviceConfigure.Load(ofd.FileName);
                if (!ret)
                {
                    MessageBox.Show(serviceConfigure.ErrMsg);
                }
                else 
                {
                    MessageBox.Show("加载成功");
                }
            }
        }

        private void btnOutputClick(object sender, RoutedEventArgs e)
        {
            //FolderBrowserDialog fbd = new FolderBrowserDialog();
            //fbd.SelectedPath = serviceConfigure.OutPath;
            //if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            //{
               
            
            //serviceConfigure.OutPath = fbd.SelectedPath;
            serviceConfigure.ToXml();
            MessageBox.Show("输出成功");
                
            //}
        }
    }
}
