public char [,] InterPretarBloque(BloqueControl Crt_BloqueEntrada) { // buscar el actuante en la matriz dentro del compilador this.Cmp_PosicionActuante = this.BuscarACtuante(this.Cmp_SimboloActuante); // mover al actuante deacurdo al tipo de bloque y asu texto // arrancar segun el tipo de bloque switch (Crt_BloqueEntrada.Blq_TipoBloque) { case TipoBloques.Tipo_Bloque_Lineal: // arrancar segun el texto de la etiqueta switch (Crt_BloqueEntrada.Blq_EtiquetaInterna.Content.ToString()) { case BloqueControl.Txt_MvArriba: // verificar las dimenciones de la matriz if (this.Cmp_PosicionActuante.Y >= 1) { // mover al actuante a la nueva posicion FijarNuevaPosicion((int)this.Cmp_PosicionActuante.X, (int)this.Cmp_PosicionActuante.Y - 1); } break; case BloqueControl.Txt_MvAbajo: // verificar las dimenciones de la matriz if (this.Cmp_PosicionActuante.Y < this.Cmp_Dims.Height - 1) { FijarNuevaPosicion((int)this.Cmp_PosicionActuante.X, (int)this.Cmp_PosicionActuante.Y - 1); } break; case BloqueControl.Txt_MvDrch: // verificar las dimenciones de la matriz if (this.Cmp_PosicionActuante.X < this.Cmp_Dims.Width - 1) { FijarNuevaPosicion((int)this.Cmp_PosicionActuante.X - 1, (int)this.Cmp_PosicionActuante.Y); } break; case BloqueControl.Txt_MvIzqrd: // verificar las dimenciones de la matriz if (this.Cmp_PosicionActuante.X >= 1) { FijarNuevaPosicion((int)this.Cmp_PosicionActuante.X + 1, (int)this.Cmp_PosicionActuante.Y); } break; } break; } // fijar al actuante en la nueva posicion actual return(this.Cmp_MatrizResultado); }
private void Btn_Compilar_Click(object sender, RoutedEventArgs e) { BloqueControl b1 = new BloqueControl(TipoBloques.Tipo_Bloque_Lineal, TextoInterno.Texto_Lineal_Abajo, new Point(100, 50), new Size(100, 50)); BloqueControl b2 = new BloqueControl(TipoBloques.Tipo_Bloque_Ciclo_While, TextoInterno.Texto_Lineal_Izquierda, new Point(0, 0), new Size(100, 50)); BloqueControl b3 = new BloqueControl(TipoBloques.Tipo_Bloque_Ciclo_For, TextoInterno.Texto_Lineal_Derecha, new Point(100, 150), new Size(100, 50)); BloqueControl b4 = new BloqueControl(TipoBloques.Tipo_Bloque_Condicion, TextoInterno.Texto_Lineal_Arriba, new Point(100, 250), new Size(100, 50)); Matriz m = new Matriz(new Size(3, 3), 'X'); this.CanvasMatriz.Children.Add(m.RegresarContenedor()); this.CanvasPnlExc.Children.Add(b1.RegresarBloque()); this.CanvasPnlExc.Children.Add(b2.RegresarBloque()); this.CanvasPnlExc.Children.Add(b3.RegresarBloque()); this.CanvasPnlExc.Children.Add(b4.RegresarBloque()); }
public void moverSobre(object sender, MouseEventArgs e) { string c = new BloqueControl().GetType().FullName; }