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

namespace Flight
{
    public partial class LaserDlg : Form
    {
        private Flight _MainUI;

        public LaserDlg(Flight MainUI)
        {
            _MainUI = MainUI;
            InitializeComponent();
        }

        private void LaserDlg_FormClosing(object sender, FormClosingEventArgs e)
        {
            _MainUI.FlightMarker.SetLaser(false);
        }

        private void LaserDlg_Load(object sender, EventArgs e)
        {
            if (_MainUI.Colors.ListCount > 0)
            {
                for (int i = 0; i < _MainUI.Colors.ListCount; i++)
                    cmbColor.Items.Add("Color " + i.ToString());
                cmbColor.SelectedIndex = 0;
            }
            else cbEmission.Enabled = false;
        }

        private void cbEmission_CheckedChanged(object sender, EventArgs e)
        {
            if (cbEmission.Checked)
            {
                _MainUI.FlightMarker.SelectColor(cmbColor.SelectedIndex);
                _MainUI.FlightMarker.SetLaser(true);
                lbEmission.Text = "EMISSION ON";
                lbEmission.BackColor = Color.Yellow;
            }
            else
            {
                _MainUI.FlightMarker.SetLaser(false);
                lbEmission.Text = "EMISSION OFF";
                lbEmission.BackColor = Color.White;
            }
        }
    }
}
