private void frmSystemRegister_Load(object sender, EventArgs e) { this.Icon = otc.forms.OTCForms.Icon; this.Text = Application.ProductName; _systems = new OTCSystems(); ListSystems(); }
private void btnAddSystem_Click(object sender, EventArgs e) { frmSystemRegister register = new frmSystemRegister(); register.ShowDialog(this); // Recarga el gestor de sistemas digitales _systems = new OTCSystems(); ListSystems(); }
private void btnRegister_Click(object sender, EventArgs e) { try { FileInfo file = new FileInfo(txtFilename.Text); if (!file.Exists) { throw new Exception("No se encuentra el archivo " + file.FullName); } OTCSystem system = new OTCSystem(); system.Name = (string)lblInfo.Tag; system.Filename = file.Name; system.Class = cboClasses.Text; OTCSystems systems = new OTCSystems(); foreach (OTCSystem regsys in systems.Systems) { if (regsys.Name.Trim().ToLower().Equals(system.Name.Trim().ToLower()) && regsys.Class.Trim().ToLower().Equals(system.Class.Trim().ToLower())) { MessageBox.Show("El controlador seleccionado ya está registrado. Si ha actualizado la librería (archivo DLL) no hace falta volver a registrar el controlador.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } systems.Systems.Add(system); systems.Save(); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception err) { MessageBox.Show(err.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }