示例#1
0
        private void btnAlterar_Click(object sender, EventArgs e)
        {
            try
            {
                Logica    logicaAux = (Logica)logicas[logica];
                ArrayList instAux   = logicaAux.obterArrayList();
                Instrucao inst      = (Instrucao)instAux[pos];
                txtNovoNome.Text         = inst.obterNome();
                txtNovoNome.SelectedText = null;
                rbn1.Visible             = true;
                rbn2.Visible             = true;
                label2.Visible           = true;
                switch (inst.obterTipo())
                {
                case "SEL": rbn1.Text = "SEL";
                    rbn2.Text         = "SED";
                    rbn1.Select();
                    break;

                case "SED": rbn1.Text = "SEL";
                    rbn2.Text         = "SED";
                    rbn2.Select();
                    break;

                case "E": rbn1.Text = "E";
                    rbn2.Text       = "EN";
                    rbn1.Select();
                    break;

                case "EN": rbn1.Text = "E";
                    rbn2.Text        = "EN";
                    rbn2.Select();
                    break;

                case "OU": rbn1.Text = "OU";
                    rbn2.Text        = "OUN";
                    rbn1.Select();
                    break;

                case "OUN": rbn1.Text = "OU";
                    rbn2.Text         = "OUN";
                    rbn2.Select();
                    break;

                case "MEMO":
                    rbn1.Text      = "MEMO";
                    rbn1.Visible   = false;
                    rbn2.Visible   = false;
                    label2.Visible = false;
                    break;

                default: break;
                }
                panelAlterar.Visible = true;
            }
            catch
            {
                MessageBox.Show("Nada para alterar");
            }
        }
示例#2
0
 private void insereEN(String nome)
 {
     panelAlterar.Visible = false;
     pos++;
     try
     {
         leftAtual += 150;
         Button btnAux = buttonsAdded[0];
         upAtual = btnAux.Location.Y;
         Logica aux = (Logica)logicas[logica];
         aux.insereEN(nome, pos); Panel pnl = panelsAdded[logica];
         #region peçaEN
         Button btn = new Button();
         btn.Location          = new Point(leftAtual, upAtual);
         btn.Height            = 120;
         btn.Width             = 150;
         btn.Text              = nome;
         btn.Image             = imageList1.Images[3];
         btn.TextImageRelation = TextImageRelation.TextAboveImage;
         btn.FlatStyle         = FlatStyle.Flat;
         btn.Tag    = pos;
         btn.Click += delegate { btnLadder(btn, pnl); };
         pnl.Controls.Add(btn);
         buttonsAdded.Add(btn);
         btnLadder(btn, pnl);
         #endregion
         txtNome.Text = "";
     }
     catch
     {
         MessageBox.Show("Deve se iniciar com SEL ou SED");
     }
 }
示例#3
0
        private void insereSED(String nome)
        {
            panelAlterar.Visible = false;
            logica = logicas.Count - 1;
            logica++;
            logicas.Add(new Logica());
            Logica aux = (Logica)logicas[logica];
            Panel  pnl = new Panel();

            pnl.AutoSize = true;
            pnl.Tag      = logica;
            panelsAdded.Add(pnl);
            #region peçaSED
            if (logica == 0)
            {
                Button btn = new Button();
                btn.Location          = new Point(leftAtual, upAtual);
                btn.Height            = 120;
                btn.Width             = 150;
                btn.Text              = nome;
                btn.Image             = imageList1.Images[1];
                btn.TextImageRelation = TextImageRelation.TextAboveImage;
                btn.FlatStyle         = FlatStyle.Flat;
                btn.Tag    = pos;
                btn.Click += delegate { btnLadder(btn, pnl); };
                pnl.Controls.Add(btn);
                buttonsAdded.Add(btn);
                aux.insereSED(nome, pos);
                pnl.Location = new Point(leftAtual, upAtual);
                btnLadder(btn, pnl);
            }
            else
            {
                Panel pnlAux = panelsAdded[logica - 1];
                upAtual   = upIni;
                leftAtual = leftIni;
                pos       = 0;
                Button btn = new Button();
                btn.Location          = new Point(leftAtual, upAtual);
                btn.Height            = 120;
                btn.Width             = 150;
                btn.Text              = nome;
                btn.Image             = imageList1.Images[1];
                btn.TextImageRelation = TextImageRelation.TextAboveImage;
                btn.FlatStyle         = FlatStyle.Flat;
                btn.BackColor         = Color.LightBlue;
                btn.Tag    = pos;
                btn.Click += delegate { btnLadder(btn, pnl); };
                pnl.Controls.Add(btn);
                buttonsAdded.Add(btn);
                aux.insereSED(nome, pos);
                int upAux = pnlAux.Bottom;
                pnl.Location = new Point(leftIni, upAux);
                changeColor(btn);
            }
            Controls.Add(pnl);
            #endregion
            txtNome.Text = "";
        }
示例#4
0
 private void btnCopiar_Click(object sender, EventArgs e)
 {
     try
     {
         panelAlterar.Visible = false;
         String lg  = "";
         Logica aux = (Logica)logicas[logica];
         lg = aux.obterML();
         Clipboard.SetText(lg);
     }
     catch
     {
         MessageBox.Show("Nada para exportar");
     }
 }
示例#5
0
 private void btnLimpar_Click(object sender, EventArgs e)
 {
     #region limpaEspaço
     logica = logicas.Count - 1;
     limpaTela();
     while (logicas.Count > 0)
     {
         Logica aux = (Logica)logicas[logica];
         logicas.Remove(aux);
         logica--;
     }
     upAtual              = upIni;
     leftAtual            = leftIni;
     logica               = -1;
     pos                  = 0;
     panelAlterar.Visible = false;
     #endregion
 }
示例#6
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            bool flagLog = true;

            try
            {
                panelAlterar.Visible = false;
                Panel  pnlAux = panelsAdded[logica];
                Logica aux    = (Logica)logicas[logica];
                flagLog = aux.removerInstrucao(pos);
            }
            catch
            {
                MessageBox.Show("Nada para remover");
            }
            if (!flagLog)
            {
                logicas.Remove(logicas[logica]);
            }
            redraw();
        }
示例#7
0
        private void redraw()
        {
            int index = 0;

            upAtual   = upIni;
            leftAtual = leftIni;
            List <String> logicaML = new List <String>();

            limpaTela();
            while (logicas.Count != 0)
            {
                Logica    logicaAux  = (Logica)logicas[0];
                ArrayList instrucoes = logicaAux.obterArrayList();
                logicaML.Add("");
                for (int j = 0; j < instrucoes.Count; j++)
                {
                    Instrucao instAux = (Instrucao)instrucoes[j];
                    logicaML[index] += instAux.obterTipo();
                    logicaML[index] += "(";
                    logicaML[index] += instAux.obterNome();
                    logicaML[index] += ")";
                    logicaML[index] += System.Environment.NewLine;
                }
                logicas.Remove(logicas[0]);
                logica--;
                index++;
            }
            for (int i = 0; i < index; i++)
            {
                pos = 0;
                colarML(logicaML[i]);
            }
            for (int i = 0; i < buttonsAdded.Count; i++)
            {
                buttonsAdded[i].BackColor = Color.White;
            }
        }
示例#8
0
 private void insereOUN(String nome)
 {
     panelAlterar.Visible = false;
     pos++;
     try
     {
         Logica aux = (Logica)logicas[logica];
         aux.insereOUN(nome, pos);
         Panel pnl = panelsAdded[logica];
         if (leftAtual == 20)
         {
             #region peçaOUNs
             Button btn = new Button();
             btn.Location          = new Point(leftAtual, upAtual + 120);
             btn.Height            = 120;
             btn.Width             = 150;
             btn.Text              = nome;
             btn.Image             = imageList1.Images[6];
             btn.TextImageRelation = TextImageRelation.TextAboveImage;
             btn.FlatStyle         = FlatStyle.Flat;
             btn.Tag    = pos;
             btn.Click += delegate { btnLadder(btn, pnl); };
             pnl.Controls.Add(btn);
             buttonsAdded.Add(btn);
             btnLadder(btn, pnl);
             #endregion
         }
         else
         {
             #region peçaOUNm
             Button btn = new Button();
             btn.Location          = new Point(leftAtual, upAtual + 120);
             btn.Height            = 120;
             btn.Width             = 150;
             btn.Text              = nome;
             btn.Image             = imageList1.Images[7];
             btn.TextImageRelation = TextImageRelation.TextAboveImage;
             btn.FlatStyle         = FlatStyle.Flat;
             btn.Tag      = pos;
             btn.AutoSize = true;
             btn.Click   += delegate { btnLadder(btn, pnl); };
             pnl.Controls.Add(btn);
             buttonsAdded.Add(btn);
             btnLadder(btn, pnl);
             #endregion
             #region linhasDeContinuidadeOUN
             int leftAux = leftAtual;
             while (leftAux >= 20)
             {
                 leftAux -= 150;
                 if (leftAux == 20)
                 {
                     Button btn1 = new Button();
                     btn1.Location          = new Point(leftAux, upAtual);
                     btn1.Height            = 120;
                     btn1.Width             = 150;
                     btn1.Text              = " ";
                     btn1.Image             = imageList1.Images[9];
                     btn1.TextImageRelation = TextImageRelation.TextAboveImage;
                     btn1.FlatStyle         = FlatStyle.Flat;
                     btn1.BackColor         = Color.White;
                     btn1.Tag      = pos;
                     btn1.AutoSize = true;
                     pnl.Controls.Add(btn1);
                     buttonsAdded.Add(btn1);
                 }
                 else
                 {
                     if (leftAux > 20)
                     {
                         Button btn1 = new Button();
                         btn1.Location          = new Point(leftAux, upAtual);
                         btn1.Height            = 120;
                         btn1.Width             = 150;
                         btn1.Text              = " ";
                         btn1.Image             = imageList1.Images[10];
                         btn1.TextImageRelation = TextImageRelation.TextAboveImage;
                         btn1.FlatStyle         = FlatStyle.Flat;
                         btn1.BackColor         = Color.White;
                         btn1.Tag      = pos;
                         btn1.AutoSize = true;
                         pnl.Controls.Add(btn1);
                         buttonsAdded.Add(btn1);
                     }
                 }
                 #endregion
             }
         }
         txtNome.Text = "";
     }
     catch
     {
         MessageBox.Show("Deve se iniciar com SEL ou SED");
     }
 }
示例#9
0
        public void alterarInstrucao(String tipo, String novoNome)
        {
            Logica logicaAux = (Logica)logicas[logica];

            logicaAux.alterarInstrucao(tipo, novoNome, pos);
        }