/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="formNumber">Número de formulario</param>
 public MenuFormWpf(int formNumber)
 {
     this.canvasPath       = "CanvasMenuForm.xaml";
     InputConnectionPoint  = new ConnectionPointWpf(ConnectionPointType.Input, this);
     OutputConnectionPoint = new ConnectionPointWpf(ConnectionPointType.Output, this);
     this.SetTitle(UtnEmall.ServerManager.Properties.Resources.MenuForm + " " + formNumber);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor de la clase. Este método inicializa el punto de conexión de entrada y salida.
 /// </summary>
 /// <param name="formNumber">Número del formulario de servicio</param>
 public EnterSingleDataFormWpf(int formNumber)
 {
     canvasPath            = "CanvasEnterSingleDataForm.xaml";
     InputConnectionPoint  = new ConnectionPointWpf(LogicalLibrary.ServerDesignerClasses.ConnectionPointType.Input, this);
     OutputConnectionPoint = new ConnectionPointWpf(LogicalLibrary.ServerDesignerClasses.ConnectionPointType.Output, this);
     this.SetTitle(UtnEmall.ServerManager.Properties.Resources.Input + formNumber);
 }
        /// <summary>
        /// Construye el canvas del formulario de menu y agrega los eventos del mouse
        /// </summary>
        public void MakeCanvas()
        {
            Canvas formCanvas = Utilities.CanvasFromXaml(this.canvasPath);

            // Alarga el formulario de menu, usando 30 como alto.
            formCanvas.Height += MenuItems.Count * 30;

            formCanvas.PreviewMouseDown += new MouseButtonEventHandler(formCanvas_PreviewMouseDown);
            formCanvas.PreviewMouseUp   += new MouseButtonEventHandler(formCanvas_PreviewMouseUp);

            ConnectionPointWpf inputConnectionPoint = this.InputConnectionPoint as ConnectionPointWpf;

            // Cargar el canvas desde el punto de conexión.
            inputConnectionPoint.MakeCanvas();

            // Agrega los eventos al punto de conexión
            inputConnectionPoint.Click += new EventHandler(ConnectionPoint_Click);

            // Agrega los items del menu al canvas
            int i = 1;

            foreach (FormMenuItemWpf item in this.MenuItems)
            {
                item.Width  = formCanvas.Width;
                item.Height = 30;// formCanvas.Height;
                item.MakeCanvas();

                // Agrega los eventos.
                if (!item.ConnectionClickAttached)
                {
                    item.ConnectionClickAttached = true;
                    item.ConnectionClick        += new EventHandler(ConnectionPoint_Click);
                }
                Canvas itemCanvas = (item as FormMenuItemWpf).MyCanvas;
                formCanvas.Children.Add(itemCanvas);
                Canvas.SetTop(itemCanvas, i * item.Height);
                i++;
            }

            // Compone el grupo de canvas
            Canvas groupFormCanvas = new Canvas();

            groupFormCanvas.Background = Brushes.Transparent;
            groupFormCanvas.Width      = formCanvas.Width + (inputConnectionPoint.MyCanvas.Width * 2);
            groupFormCanvas.Height     = formCanvas.Height;
            groupFormCanvas.MouseUp   += new MouseButtonEventHandler(groupFormCanvas_MouseUp);

            groupFormCanvas.Children.Add(formCanvas);
            Canvas.SetLeft(formCanvas, inputConnectionPoint.MyCanvas.Width);
            groupFormCanvas.Children.Add(inputConnectionPoint.MyCanvas);

            GenerateContextMenu(groupFormCanvas);

            this.MyCanvas = groupFormCanvas;
            ChangeTitle();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Convierte un ConnectionPointEntity guardado en la base de datos que representa un ConnectionPoint en un ConnectionPointWpf para ser usado en un proyecto wpf
        /// </summary>
        /// <param name="connectionPointEntity"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        public static ConnectionPointWpf ConvertEntityToConnectionPoint(ConnectionPointEntity connectionPointEntity, Component parent)
        {
            ConnectionPointWpf connectionPointWpf = new ConnectionPointWpf((LogicalLibrary.ServerDesignerClasses.ConnectionPointType)connectionPointEntity.ConnectionType, parent);

            connectionPointWpf.Parent = parent;
            connectionPointWpf.XCoordinateRelativeToParent = connectionPointEntity.XCoordinateRelativeToParent;
            connectionPointWpf.YCoordinateRelativeToParent = connectionPointEntity.YCoordinateRelativeToParent;

            return(connectionPointWpf);
        }
        /// <summary>
        /// Hace el lienzo del formulario de lista WPF y adjunta eventos del mouse
        /// </summary>
        public void MakeCanvas()
        {
            Canvas formCanvas = Utilities.CanvasFromXaml(this.canvasPath);

            formCanvas.PreviewMouseDown += new MouseButtonEventHandler(formCanvas_PreviewMouseDown);
            formCanvas.PreviewMouseUp   += new MouseButtonEventHandler(formCanvas_PreviewMouseUp);

            ConnectionPointWpf inputConnectionPoint  = this.InputConnectionPoint as ConnectionPointWpf;
            ConnectionPointWpf outputConnectionPoint = this.OutputConnectionPoint as ConnectionPointWpf;

            // Carga el lienzo desde los puntos de conexión.
            inputConnectionPoint.MakeCanvas();
            outputConnectionPoint.MakeCanvas();

            // Adjunta eventos a los puntos de conexión.
            inputConnectionPoint.Click  += new EventHandler(ConnectionPoint_Click);
            outputConnectionPoint.Click += new EventHandler(ConnectionPoint_Click);

            // Compone el grupo de lienzos.
            Canvas groupFormCanvas = new Canvas();

            groupFormCanvas.Background = Brushes.Transparent;
            groupFormCanvas.Width      = formCanvas.Width + (inputConnectionPoint.MyCanvas.Width * 2);
            groupFormCanvas.Height     = formCanvas.Height;
            groupFormCanvas.MouseUp   += new MouseButtonEventHandler(groupFormCanvas_MouseUp);

            groupFormCanvas.Children.Add(formCanvas);
            Canvas.SetLeft(formCanvas, inputConnectionPoint.MyCanvas.Width);
            groupFormCanvas.Children.Add(inputConnectionPoint.MyCanvas);
            groupFormCanvas.Children.Add(outputConnectionPoint.MyCanvas);

            // Establece la posición del ConnectionPoint.
            outputConnectionPoint.XCoordinateRelativeToParent = groupFormCanvas.Width - outputConnectionPoint.MyCanvas.Width;
            outputConnectionPoint.YCoordinateRelativeToParent = groupFormCanvas.Height - outputConnectionPoint.MyCanvas.Height;
            Canvas.SetLeft(outputConnectionPoint.MyCanvas, outputConnectionPoint.XCoordinateRelativeToParent);
            Canvas.SetTop(outputConnectionPoint.MyCanvas, outputConnectionPoint.YCoordinateRelativeToParent);

            GenerateContextMenu(groupFormCanvas);

            this.MyCanvas = groupFormCanvas;
            ChangeTitle();
        }
Exemplo n.º 6
0
 /// <summary>
 /// Constructor de la clase
 /// </summary>
 public EnterSingleDataFormWpf()
 {
     canvasPath            = "CanvasEnterSingleDataForm.xaml";
     InputConnectionPoint  = new ConnectionPointWpf(LogicalLibrary.ServerDesignerClasses.ConnectionPointType.Input, this);
     OutputConnectionPoint = new ConnectionPointWpf(LogicalLibrary.ServerDesignerClasses.ConnectionPointType.Output, this);
 }
Exemplo n.º 7
0
        public static ConnectionWpf ConvertEntityToConnection(Dictionary <Component, ComponentEntity> connectableComponents,
                                                              ConnectionWidgetEntity connectionWidgetEntity, ServiceDocumentWpf serviceDocumentWpf)
        {
            Component relatedSourceWpf = null;
            Component relatedTargetWpf = null;

            ConnectionPointWpf source = null;
            ConnectionPointWpf target = null;

            // Busca por el componente origen
            relatedSourceWpf = SearchForSourceComponent(connectableComponents, connectionWidgetEntity, serviceDocumentWpf);

            // Busca el componente destino
            relatedTargetWpf = SearchForTargetComponent(connectableComponents, connectionWidgetEntity, serviceDocumentWpf);


            DataSourceWpf          dataSourceWpf          = relatedSourceWpf as DataSourceWpf;
            ListFormWpf            listFormWpf            = relatedSourceWpf as ListFormWpf;
            MenuFormWpf            menuFormWpf            = relatedSourceWpf as MenuFormWpf;
            EnterSingleDataFormWpf enterSingleDataFormWpf = relatedSourceWpf as EnterSingleDataFormWpf;
            ShowDataFormWpf        showDataFormWpf        = relatedSourceWpf as ShowDataFormWpf;

            // Si el Source es de entrada
            //obtengo y guardo el connectionpoint del widget correspondiente
            if (connectionWidgetEntity.Source.ConnectionType == (int)ConnectionPointType.Input)
            {
                if (dataSourceWpf != null)
                {
                    source = dataSourceWpf.InputConnectionPoint as ConnectionPointWpf;
                }
                if (listFormWpf != null)
                {
                    source = listFormWpf.InputConnectionPoint as ConnectionPointWpf;
                }
                if (menuFormWpf != null)
                {
                    source = menuFormWpf.InputConnectionPoint as ConnectionPointWpf;
                }
                if (enterSingleDataFormWpf != null)
                {
                    source = enterSingleDataFormWpf.InputConnectionPoint as ConnectionPointWpf;
                }
                if (showDataFormWpf != null)
                {
                    source = showDataFormWpf.InputConnectionPoint as ConnectionPointWpf;
                }
            }
            // El Source es de Output obtengo y guardo el Widget correpondiente
            else
            {
                if (dataSourceWpf != null)
                {
                    source = dataSourceWpf.OutputConnectionPoint as ConnectionPointWpf;
                }
                if (listFormWpf != null)
                {
                    source = listFormWpf.OutputConnectionPoint as ConnectionPointWpf;
                }
                if (menuFormWpf != null)
                {
                    foreach (FormMenuItemWpf menuItem in menuFormWpf.MenuItems)
                    {
                        if (String.CompareOrdinal(menuItem.Text, connectionWidgetEntity.Source.ParentComponent.Text) == 0)
                        {
                            source = menuItem.OutputConnectionPoint as ConnectionPointWpf;
                        }
                    }
                }
                if (enterSingleDataFormWpf != null)
                {
                    source = enterSingleDataFormWpf.OutputConnectionPoint as ConnectionPointWpf;
                }
                if (showDataFormWpf != null)
                {
                    source = showDataFormWpf.OutputConnectionPoint as ConnectionPointWpf;
                }
            }

            dataSourceWpf          = relatedTargetWpf as DataSourceWpf;
            listFormWpf            = relatedTargetWpf as ListFormWpf;
            menuFormWpf            = relatedTargetWpf as MenuFormWpf;
            enterSingleDataFormWpf = relatedTargetWpf as EnterSingleDataFormWpf;
            showDataFormWpf        = relatedTargetWpf as ShowDataFormWpf;

            // Si el Target es input
            if (connectionWidgetEntity.Target.ConnectionType == (int)ConnectionPointType.Input)
            {
                if (dataSourceWpf != null)
                {
                    target = dataSourceWpf.InputConnectionPoint as ConnectionPointWpf;
                }
                if (listFormWpf != null)
                {
                    target = listFormWpf.InputConnectionPoint as ConnectionPointWpf;
                }
                if (menuFormWpf != null)
                {
                    target = menuFormWpf.InputConnectionPoint as ConnectionPointWpf;
                }
                if (enterSingleDataFormWpf != null)
                {
                    target = enterSingleDataFormWpf.InputConnectionPoint as ConnectionPointWpf;
                }
                if (showDataFormWpf != null)
                {
                    target = showDataFormWpf.InputConnectionPoint as ConnectionPointWpf;
                }
            }
            // El Target es de Output obtengo y guardo el Widget correpondiente
            else
            {
                if (dataSourceWpf != null)
                {
                    target = dataSourceWpf.OutputConnectionPoint as ConnectionPointWpf;
                }

                if (listFormWpf != null)
                {
                    target = listFormWpf.OutputConnectionPoint as ConnectionPointWpf;
                }
                if (menuFormWpf != null)
                {
                    target = menuFormWpf.OutputConnectionPoint as ConnectionPointWpf;
                }

                if (enterSingleDataFormWpf != null)
                {
                    target = enterSingleDataFormWpf.OutputConnectionPoint as ConnectionPointWpf;
                }
                if (showDataFormWpf != null)
                {
                    target = showDataFormWpf.OutputConnectionPoint as ConnectionPointWpf;
                }
            }

            ConnectionWpf connectionWpf = new ConnectionWpf(source, target);

            return(connectionWpf);
        }
 /// <summary>
 /// Constructor
 /// </summary>
 public MenuFormWpf()
 {
     this.canvasPath       = "CanvasMenuForm.xaml";
     InputConnectionPoint  = new ConnectionPointWpf(ConnectionPointType.Input, this);
     OutputConnectionPoint = new ConnectionPointWpf(ConnectionPointType.Output, this);
 }