using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using UniversalEditor.Classes;

namespace UniversalEditor.Tools
{
    public partial class toolSetEncryption : DevExpress.XtraEditors.XtraForm
    {
        frmMain main;

        public toolSetEncryption(frmMain mainfrm)
        {
            InitializeComponent();
            main = mainfrm;
            // populate list
            foreach (EncryptionType Type in Enum.GetValues(typeof(EncryptionType)))
            {
                lstEncryption.Items.Add(Type);
            }
            lstEncryption.SelectedItem = main.Encryption;
        }

        private void btnDefault_Click(object sender, EventArgs e)
        {
            main.Encryption = EncryptionType.Default;
            main.SQLStatus.Caption = String.Format("Encryption type has been set to {0}. <3 Mars", main.Encryption);
            this.Close();
        }

        private void btnChange_Click(object sender, EventArgs e)
        {
            main.Encryption = (EncryptionType)lstEncryption.SelectedItem;
            main.SQLStatus.Caption = String.Format("Encryption type has been set to {0}. <3 Mars", main.Encryption);
            this.Close();
        }
    }
}