using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using ABC.File;

namespace ABC.KetNoi
{
    
    public partial class Error_Form : DevExpress.XtraEditors.XtraForm {
        Get_CauHinh _Get_CauHinh = new Get_CauHinh();
        public string error_text = "";
        public Error_Form()
        {           

            InitializeComponent();
           
            _Get_CauHinh.ReadXML();
            this.Text = Get_CauHinh.Dt_DAT.Rows[0]["Name_Soft"].ToString();
            sbCustomization.Click += new EventHandler(sbCustomization_Click);
            simpleButton_ok.Click += new EventHandler(simpleButton_ok_Click);
            simpleButton_cancel.Click += new EventHandler(simpleButton_cancel_Click);
        }

        void simpleButton_cancel_Click(object sender, EventArgs e)
        {
            
            if (msgbox.dialog_yes_no("Đóng chương trình ?") == DialogResult.Yes)
            {
                this.DialogResult = DialogResult.Cancel;
                Application.Exit();
            }
        }

        void simpleButton_ok_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }


        #region Cấu Hình
        CauHinh_Form _CauHinh_Form;
        void sbCustomization_Click(object sender, EventArgs e)
        {
            _CauHinh_Form = new CauHinh_Form();
            _CauHinh_Form.FormClosed += new FormClosedEventHandler(_CauHinh_Form_FormClosed);
            _CauHinh_Form.ShowDialog();
        }

        void _CauHinh_Form_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (_CauHinh_Form.DialogResult == DialogResult.Yes)
            {
                _Get_CauHinh.ReadXML();
                this.Text = Get_CauHinh.Dt_DAT.Rows[0]["Name_Soft"].ToString();
                this.Refresh();
            }
        }
        #endregion

        private void Error_Form_Load(object sender, EventArgs e)
        {
            //label1.Text = "Lỗi Thực Thi Câu Lệnh...";
            txtloi.Text = error_text;
        }

        private void labelControl1_Click(object sender, EventArgs e)
        {

        }
    }
}
