Exemplo n.º 1
0
        private void Final_Click(object sender, RoutedEventArgs e)
        {
            nextClick = new OutputFinal();
            OutputFinal res = (OutputFinal)nextClick;

            Eject += new Action <object, RoutedEventArgs>(res.a);
        }
Exemplo n.º 2
0
        private void Canvas_CLick(object sender, MouseButtonEventArgs mouse)
        {
            ju = mouse;
            if (nextClick is Linea)
            {
                nextClick = null;
            }
            else if (nextClick != null)
            {
                Point posicion = mouse.GetPosition(this);
                if (posicion.Y > 26)
                {
                    Canvas.SetTop(nextClick, posicion.Y);
                    Canvas.SetLeft(nextClick, posicion.X);
                    uf.Children.Add(nextClick);
                    nextClick.ContextMenu = new ContextMenu();
                    MenuItem conectar = new MenuItem();
                    conectar.Header = "_Conectar";
                    nextClick.ContextMenu.Items.Add(conectar);
                    conectar.Click += hacerLinea;
                    MenuItem CancelarConexion = new MenuItem();
                    CancelarConexion.Header = "_Cancelar Conexión";
                    nextClick.ContextMenu.Items.Add(CancelarConexion);
                    CancelarConexion.Click += noHacerLinea;
                    delete        = new MenuItem();
                    delete.Header = "_Borrar";
                    nextClick.ContextMenu.Items.Add(delete);
                    execute        = new MenuItem();
                    execute.Header = "_Ejecutar";
                    nextClick.ContextMenu.Items.Add(execute);

                    if (nextClick is Suma)
                    {
                        Suma res = (Suma)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is Resta)
                    {
                        Resta res = (Resta)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is Multiplicación)
                    {
                        Multiplicación res = (Multiplicación)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is División)
                    {
                        División res = (División)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is Input)
                    {
                        Input res = (Input)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is OutputIntermedio)
                    {
                        OutputIntermedio res = (OutputIntermedio)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is OutputFinal)
                    {
                        OutputFinal res = (OutputFinal)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is Factorial)
                    {
                        Factorial res = (Factorial)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is Seno)
                    {
                        Seno res = (Seno)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is Coseno)
                    {
                        Coseno res = (Coseno)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is ComparadorDistinto)
                    {
                        ComparadorDistinto res = (ComparadorDistinto)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is ComparadorIgual)
                    {
                        ComparadorIgual res = (ComparadorIgual)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }

                    else if (nextClick is ComparadorMayor)
                    {
                        ComparadorMayor res = (ComparadorMayor)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is ComparadorMayorIgual)
                    {
                        ComparadorMayorIgual res = (ComparadorMayorIgual)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is ComparadorMenor)
                    {
                        ComparadorMenor res = (ComparadorMenor)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is ComparadorMenorIgual)
                    {
                        ComparadorMenorIgual res = (ComparadorMenorIgual)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is Fibonacci)
                    {
                        Fibonacci res = (Fibonacci)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is Separador)
                    {
                        Separador res = (Separador)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                    else if (nextClick is Plotter)
                    {
                        Plotter res = (Plotter)nextClick;
                        res.a(sender, mouse);
                        execute.Click += res.a;
                        delete.Click  += res.b;
                    }
                }
                nextClick = null;
            }
        }