using ButcherFactory.BO.Utils;
using ButcherFactory.SegmentProduction_;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ButcherFactory.SegmentProductionAuto_
{
  public partial class TemplateSelector : Form
  {
    SegmentProductionFormConfig config;
    public TemplateSelector(SegmentProductionFormConfig _config)
    {
      InitializeComponent();
      config = _config;
      if (config.Template == "SegmentProductionPrint.html")
        tp1.Text += "(当前)";
      else
        tp2.Text += "(当前)";
    }

    private void closeBtn_Click(object sender, EventArgs e)
    {
      this.Close();
    }

    private void tp1_Click(object sender, EventArgs e)
    {
      if (config.Template != "SegmentProductionPrint.html")
      {
        config.Template = "SegmentProductionPrint.html";
        XmlUtil.SerializerObjToFile(config);
        tp1.Text = "鲜品标签(当前)";
        tp2.Text = "冻品标签";
      }
    }

    private void tp2_Click(object sender, EventArgs e)
    {
      if (config.Template != "SegmentProductionPrint1.html")
      {
        config.Template = "SegmentProductionPrint1.html";
        XmlUtil.SerializerObjToFile(config);
        tp1.Text = "鲜品标签";
        tp2.Text = "冻品标签(当前)";
      }
    }
  }
}
