using System.Text;
using System.Windows.Forms;
using CefSharpWrap.AceEditorWrap;

namespace CefSharpWrap.Test
{
    public partial class CefTestForm : Form
    {
        private readonly CefSharpAceEditorWrap _editor;

        private int _chg = 0;
        public CefTestForm()
        {
            InitializeComponent();
            _editor = new CefSharpAceEditorWrap();
            _editor.FillToControl(panel1);
            _editor.TextChanged += _editor_TextChanged;
        }

        private void _editor_TextChanged(object sender, System.EventArgs e)
        {
            toolStripStatusLabel1.Text = $"Length:{_editor.Text.Length} chg:{++_chg}";
        }

        private void button1_Click(object sender, System.EventArgs e)
        {
            _editor.ShowF12();
        }

        private void button2_Click(object sender, System.EventArgs e)
        {
            _editor.Refresh();
        }

        private void button3_Click(object sender, System.EventArgs e)
        {
            _editor.Text = Encoding.UTF8.GetString(Properties.Resources.Sample);
        }
    }
}