using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RySkins
{
    public partial class FrmMessageBox : SKinForm
    {
        public FrmMessageBox()
        {
            InitializeComponent();
        }
        private bool ProcUse = false;
        public MessageBoxButtons ResultDg { get; set; } = MessageBoxButtons.OKCancel;
        private void BtnYes_Click(object sender, EventArgs e)
        {
            ProcUse = true;
            if (this.Modal)
            {
                switch (ResultDg)
                {
                    case MessageBoxButtons.YesNo:
                        this.DialogResult = DialogResult.Yes;
                        break;
                    default:
                        this.DialogResult = DialogResult.OK;
                        break;
                }
            }
            else
            {
                Close();
            }
        }

        private void BtnCancel_Click(object sender, EventArgs e)
        {
            ProcUse = true;
            switch (ResultDg)
            {
                case MessageBoxButtons.YesNo:
                    this.DialogResult = DialogResult.No;
                    break;
                default:
                    this.DialogResult = DialogResult.Cancel;
                    break;
            }
        }

        private void LblMsg_TextChanged(object sender, EventArgs e)
        {
            lblMsg.UpdateInfo();
            lblMsg.Refresh();
        }

        private void FrmMessageBox_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing && !ProcUse)
            {
                this.DialogResult = DialogResult.Cancel;
            }
        }
    }
}
