Example #1
0
        private void InsereSimbolo(LinhaCompletaVisual.LocalInsereSimbolo _lIS, params CodigosInterpretaveis[] _cI)
        {
            if (!IsDiagramaAberto())
            {
                return;
            }

            if (frmProj.frmDiagLadder.ControleSelecionado.IsDisposed)
            {
                return;
            }

            /// aborta a simulação quando for executar uma alteração
            if (btnSimular.Checked)
            {
                btnSimular.Checked = false;
                Thread.Sleep(100);
            }

            ControleLivre       _controle = frmProj.frmDiagLadder.ControleSelecionado;
            LinhaCompletaVisual _linha    = frmProj.frmDiagLadder.LinhaSelecionada;

            _controle = _linha.InsereSimbolo(_lIS, _controle, _cI);

            /// Redesenha linhas e fundo
            frmProj.frmDiagLadder.ReorganizandoLinhas();
            //_linha.simboloDesenhoFundo.Invalidate();

            _controle.Select();
        }
Example #2
0
        private void PasteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // TODO: Use System.Windows.Forms.Clipboard.GetText() or System.Windows.Forms.GetData to retrieve information from the clipboard.
            if (IsDiagramaAberto())
            {
                if (frmProj.frmDiagLadder.ControleSelecionado != null)
                {
                    if (!frmProj.frmDiagLadder.ControleSelecionado.IsDisposed)
                    {
                        DataFormats.Format   myFormat     = DataFormats.GetFormat("List<SimboloBasico>");
                        Object               returnObject = null;
                        List <SimboloBasico> _lstSB       = new List <SimboloBasico>();
                        ListaSimbolo         _lstSB2      = new ListaSimbolo();

                        IDataObject iData = Clipboard.GetDataObject();

                        // Determines whether the data is in a format you can use.
                        if (iData.GetDataPresent(myFormat.Name))
                        {
                            try
                            {
                                returnObject = iData.GetData(myFormat.Name);
                            }
                            catch
                            {
                                MessageBox.Show("Erro");
                            }
                        }

                        _lstSB = (List <SimboloBasico>)returnObject;

                        _lstSB2.InsertAllWithClearBefore(_lstSB);

                        ControleLivre _controle = frmProj.frmDiagLadder.LinhaSelecionada.InsereSimboloIndefinido(true, frmProj.frmDiagLadder.ControleSelecionado, _lstSB2);
                        frmProj.frmDiagLadder.ReorganizandoLinhas();
                        _controle.Select();
                    }
                }
            }
        }