Exemplo n.º 1
0
        protected void OnBtnDeleteClicked(object sender, EventArgs e)
        {
            string id = null;

            try {
                id = tblData.Model.GetValue(iterSelected, 7).ToString();
            } catch (Exception) {}
            if (string.IsNullOrEmpty(id))
            {
                dlg.show(this, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Ok, string.Format("Falta seleccionar el registro a eliminar"));
            }
            else
            {
                if (dlg.show(this, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.YesNo, "Confirmar la eliminación del registro") == ResponseType.Yes)
                {
                    if (!AutoConnectPrtsModel.deleteItem(id))
                    {
                        dlg.show(this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, string.Format("Ocurrió un error al intentar eliminar la configuracion, favor de interntarlo de nuevo"));
                    }
                    else
                    {
                        CleanForm();
                        tblData.Model = AutoConnectPrtsModel.getModel();
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected void OnBtnInsertClicked(object sender, EventArgs e)
        {
            Boolean isValid = true;

            if (string.IsNullOrEmpty(txtPuerto.Text))
            {
                dlg.show(this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, string.Format("Falta indicar el puerto"));
                txtPuerto.GrabFocus();
                isValid = false;
            }

            string baudRate = cmbBaudRate.ActiveText.ToString();
            string parity   = cmbParity.ActiveText.ToString();
            string databits = cmbDatabits.ActiveText.ToString();
            string stopbits = cmbStopbits.ActiveText.ToString();

            if (string.IsNullOrEmpty(baudRate))
            {
                dlg.show(this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, string.Format("Faltan datos"));
                cmbBaudRate.GrabFocus();
                isValid = false;
                return;
            }
            if (string.IsNullOrEmpty(parity))
            {
                dlg.show(this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, string.Format("Faltan datos"));
                cmbParity.GrabFocus();
                isValid = false;
                return;
            }
            if (string.IsNullOrEmpty(databits))
            {
                dlg.show(this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, string.Format("Faltan datos"));
                cmbDatabits.GrabFocus();
                isValid = false;
                return;
            }
            if (string.IsNullOrEmpty(stopbits))
            {
                dlg.show(this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, string.Format("Faltan datos"));
                cmbStopbits.GrabFocus();
                isValid = false;
                return;
            }

            if (isValid)
            {
                if (!AutoConnectPrtsModel.addItem(new string[] { txtPuerto.Text, txtalias.Text, txtDesc.Text, baudRate, parity, databits, stopbits }))
                {
                    dlg.show(this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, string.Format("Ocurrió un error al intentar guardar las configuraciones, favor de interntarlo de nuevo"));
                }
                else
                {
                    CleanForm();
                    tblData.Model = AutoConnectPrtsModel.getModel();
                }
            }
        }
Exemplo n.º 3
0
 private void tablePortInit()
 {
     tblData.AppendColumn("Puerto", new CellRendererText(), "text", 0);
     tblData.AppendColumn("Alias", new CellRendererText(), "text", 1);
     tblData.AppendColumn("Descripción", new CellRendererText(), "text", 2);
     tblData.AppendColumn("Baud Rate", new CellRendererText(), "text", 3);
     tblData.AppendColumn("Parity", new CellRendererText(), "text", 4);
     tblData.AppendColumn("Data Bits", new CellRendererText(), "text", 5);
     tblData.AppendColumn("Stop Bits", new CellRendererText(), "text", 6);
     tblData.Model = AutoConnectPrtsModel.getModel();
 }
Exemplo n.º 4
0
        protected void OnBtnEditClicked(object sender, EventArgs e)
        {
            string baudRate = cmbBaudRate.ActiveText.ToString();
            string parity   = cmbParity.ActiveText.ToString();
            string databits = cmbDatabits.ActiveText.ToString();
            string stopbits = cmbStopbits.ActiveText.ToString();

            if (!AutoConnectPrtsModel.editItem(new string[] { tblData.Model.GetValue(iterSelected, 7).ToString(), txtalias.Text, txtDesc.Text, baudRate, parity, databits, stopbits }))
            {
                dlg.show(this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, string.Format("Ocurrió un error al intentar editar las configuraciones, favor de interntarlo de nuevo"));
            }
            else
            {
                CleanForm();
                tblData.Model = AutoConnectPrtsModel.getModel();
            }
        }