public void Add(SimboloBasico _sb)
        {
            Add(_sb.getCI());

            switch (_sb.getCI())
            {
            case CodigosInterpretaveis.CONTADOR:
                if (_sb.iNumOperandos > 0)
                {
                    if (_sb.getOperandos(0) != null)
                    {
                        if (_sb.getOperandos(0).GetType().Name == EnderecamentoLadder.ClassName())
                        {
                            Add(((EnderecamentoLadder)_sb.getOperandos(0)).Indice);
                            Add(((EnderecamentoLadder)_sb.getOperandos(0)).Contador.Tipo);
                            Add(((EnderecamentoLadder)_sb.getOperandos(0)).Contador.Preset);
                        }
                    }
                }
                break;

            case CodigosInterpretaveis.TEMPORIZADOR:
                if (_sb.iNumOperandos > 0)
                {
                    if (_sb.getOperandos(0) != null)
                    {
                        if (_sb.getOperandos(0).GetType().Name == EnderecamentoLadder.ClassName())
                        {
                            Add(((EnderecamentoLadder)_sb.getOperandos(0)).Indice);
                            Add(((EnderecamentoLadder)_sb.getOperandos(0)).Temporizador.Tipo);
                            Add(((EnderecamentoLadder)_sb.getOperandos(0)).Temporizador.BaseTempo);
                            Add(((EnderecamentoLadder)_sb.getOperandos(0)).Temporizador.Preset);
                        }
                    }
                }
                break;

            default:
                if (_sb.iNumOperandos > 0)
                {
                    for (int i = 0; i < _sb.iNumOperandos; i++)
                    {
                        if (_sb.getOperandos(i) != null)
                        {
                            if (_sb.getOperandos(i).GetType().Name == EnderecamentoLadder.ClassName())
                            {
                                Add((EnderecamentoLadder)_sb.getOperandos(i));
                            }
                        }
                    }
                }
                break;
            }
        }
Exemple #2
0
 public CodigosInterpretaveis getCI()
 {
     if (codigoInterpretavel != null)
     {
         return(codigoInterpretavel.getCI());
     }
     else
     {
         return(CodigosInterpretaveis.NENHUM);
     }
 }
        private ControleLivre InsereSimboloUnicoVisual(int _indiceSimbolo, List <ControleLivre> _lstCL, SimboloBasico _sB)
        {
            /// Visual
            _lstCL.Insert(_indiceSimbolo, new ControleLivre(_sB));
            _lstCL[_indiceSimbolo].linhaAtual             = this;
            _lstCL[_indiceSimbolo].TabStop                = true;
            _lstCL[_indiceSimbolo].ControleSelecionado   += new ControleSelecionadoEventHandler(frmDiag.Simbolo_ControleSelecionado);
            _lstCL[_indiceSimbolo].MouseClick            += new MouseEventHandler(Simbolo_Click);
            _lstCL[_indiceSimbolo].KeyDown               += new KeyEventHandler(frmDiag.Simbolo_KeyDown);
            _lstCL[_indiceSimbolo].SolicitaMudarEndereco += new SolicitaMudarEnderecoEventHandler(frmDiag.ControleSelecionado_SolicitaMudarEndereco);
            _lstCL[_indiceSimbolo].Parent  = this.frmDiag;
            _lstCL[_indiceSimbolo].Visible = false;
            _lstCL[_indiceSimbolo].CreateControl();
            _lstCL[_indiceSimbolo].BringToFront();

            if (_sB.getCI() == CodigosInterpretaveis.TEMPORIZADOR ||
                _sB.getCI() == CodigosInterpretaveis.CONTADOR)
            {
                _lstCL[_indiceSimbolo].MouseHover += new EventHandler(frmDiag.SimboloQuadroSaida_MouseHover);
            }

            return(_lstCL[_indiceSimbolo]);
        }