using System.Collections.Generic;
using System.Windows.Forms;
using ChuPiao.AutoPrint.Machine;
using ChuPiao.AutoPrint.Services;

namespace ChuPiao.AutoPrint.Desktop.AutoPrint
{
    public class LogTabControl : TabControl
    {
        public RichTextBox richTextBoxSystemLogs=new RichTextBox();
        public RichTextBox richTextBoxAlertLogs = new RichTextBox();
        public TabPage tabPageSystemLogs;
        public TabPage tabPageAlertLogs;
        public Dictionary<string,RichTextBox> richTextBoxMachineLogDictionary=new Dictionary<string, RichTextBox>();
        public LogTabControl()
        {
            this.Controls.Clear();
            tabPageSystemLogs = new TabPage("系统日志");
            tabPageAlertLogs = new TabPage("警告日志");
            tabPageSystemLogs.Controls.Add(richTextBoxSystemLogs);
            tabPageAlertLogs.Controls.Add(richTextBoxAlertLogs);
            richTextBoxAlertLogs.Dock = DockStyle.Fill;
            richTextBoxSystemLogs.Dock = DockStyle.Fill;
            tabPageAlertLogs.Dock = DockStyle.Fill;
            tabPageSystemLogs.Dock = DockStyle.Fill;
            this.Controls.Add(tabPageSystemLogs);
            this.Controls.Add(tabPageAlertLogs);
            foreach (KeyValuePair<string, ILotMachine> keyValuePair in LotMachineService.LotMachineList)
            {
                TabPage tabPageMachineLog=new TabPage(keyValuePair.Value.MachineInfo.M_Number);
                RichTextBox richTextBox=new RichTextBox();
                richTextBox.Dock = DockStyle.Fill;
                richTextBoxMachineLogDictionary.Add(keyValuePair.Value.MachineInfo.M_Number,richTextBox);
                tabPageMachineLog.Controls.Add(richTextBox);
                tabPageMachineLog.Dock = DockStyle.Fill;
                this.Controls.Add(tabPageMachineLog);
            }
        }
    }
}
