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

namespace GMLC01HerramientasCad.Logica
{
    /// <summary>
    /// Formulario de consulta de elementos
    /// </summary>
    public partial class ConsultarForm : BaseForm
    {
        private IConsultar iCommIF;
        private Collection<Elemento> iElementos;

        private String iCaption;

        /// <summary>
        /// Constructor de la clase
        /// </summary>
        /// <param name="commIF">Implementación de la interfaz de comunicación con el módulo CAD</param>
        /// <param name="elementos">Lista de elementos seleccionados para consultar</param>
        public ConsultarForm(IConsultar commIF, Collection<Elemento> elementos)
        {
            try
            {
                iCommIF = commIF;
                iElementos = elementos;
                InitializeComponent();
            }
            catch (Exception e)
            {
                Log.RegisterError(e);
                throw new ExcepcionGMLC(e.Message, e);
            }
        }

        private void ConsultarFormLoad(object sender, EventArgs e)
        {
            iCaption = this.Text;
            ctlConsultar1.Initialize(iCommIF, iElementos);
        }


        /// <summary>
        /// 
        /// </summary>
        public override void ActualizarIdiomaInterfaz()
        {
            try
            {
                this.Text = Properties.Resources.ConsultarEditar;
                ctlConsultar1.ActualizarIdiomaInterfaz();
            }
            catch (Exception e)
            {
                Log.RegisterError(e);
                throw new ExcepcionGMLC(e.Message, e);
            }
        }

        private void CtlConsultar1QueryClose(object sender, EventArgs e)
        {
            this.Close();
        }

        private void CtlConsultar1onCurrentElementChange(object sender, EventArgs e)
        {
            this.Text = iCaption + " (" + this.ctlConsultar1.Text + ")";
        }
    }
}
