using System;
using System.Windows.Forms;

namespace QueueSys
{
    public partial class frmOptions : Form
    {
        public frmOptions()
        {
            InitializeComponent();
        }

        private void btnSaveClose_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.Save();
            this.Close();
        }

        private void cbConfirmDelete_CheckedChanged(object sender, EventArgs e)
        {
            switch(cbConfirmDelete.Checked)
            {
                case true:
                    Properties.Settings.Default.ConfirmDelete = true;
                    break;
                case false:
                    Properties.Settings.Default.ConfirmDelete = false;
                    break;
            }
            Properties.Settings.Default.Save();
        }

        private void frmOptions_Load(object sender, EventArgs e)
        {
            // Toggle the checkbox based on the confirmdelete option.
            switch (Properties.Settings.Default.ConfirmDelete)
            {
                case true:
                    {
                        this.cbConfirmDelete.Checked = true;
                        this.cbConfirmDelete.CheckState = System.Windows.Forms.CheckState.Checked;
                        break;
                    }
                case false:
                    {
                        this.cbConfirmDelete.Checked = false;
                        this.cbConfirmDelete.CheckState = System.Windows.Forms.CheckState.Unchecked;
                        break;
                    }
            }
        }
    }
}
