コード例 #1
0
ファイル: TypeNodeViewModel.cs プロジェクト: mastertnt/XRay
        /// <summary>
        /// Initializes a new instance of the <see cref="TypeNodeViewModel"/> class.
        /// </summary>
        /// <param name="pType">Type of the port.</param>
        public TypeNodeViewModel(Type pType)
        {
            this.DisplayString = pType.Name;
            this.Description = "A class sample node.";
            foreach (PropertyInfo lPropertyInfo in pType.GetProperties())
            {
                if (lPropertyInfo.CanWrite)
                {
                    PortViewModel lPort = null;
                    lPort = new PortViewModel {Direction = PortDirection.Input, DisplayString = lPropertyInfo.Name, PortType = "Property"};
                    this.Ports.Add(lPort);
                }

                if (lPropertyInfo.CanRead)
                {
                    PortViewModel lPort = null;
                    lPort = new PortViewModel { Direction = PortDirection.Output, DisplayString = lPropertyInfo.Name, PortType = "Property" };
                    this.Ports.Add(lPort);
                }
            }

            foreach (EventInfo lEventInfo in pType.GetEvents())
            {
                PortViewModel lPort = new PortViewModel {Direction = PortDirection.Output, PortType = "Event", DisplayString = lEventInfo.Name};
                this.Ports.Add(lPort);
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: mastertnt/XGraph
        /// <summary>
        /// This method creates the node.
        /// </summary>
        /// <param name="pId">The identifier.</param>
        /// <param name="pTitle">The title.</param>
        /// <param name="pInputPort">The input port.</param>
        /// <param name="pOutputPort">The output port.</param>
        /// <returns>The initialized node</returns>
        public NodeViewModel CreateNode(string pId, string pTitle, int pInputPort, int pOutputPort)
        {
            NodeViewModel lNode = new NodeViewModel();
            lNode.DisplayString = pTitle;
            for (int i = 0; i < pInputPort; i++)
            {
                PortViewModel lPort = new PortViewModel();
                lPort.DisplayString = string.Format("IPort {0}", i);
                lPort.Direction = PortDirection.Input;

                lNode.Ports.Add(lPort);
            }

            for (int i = 0; i < pOutputPort; i++)
            {
                PortViewModel lPort = new PortViewModel();
                lPort.DisplayString = string.Format("OPort {0}", i);
                lPort.Direction = PortDirection.Output;

                lNode.Ports.Add(lPort);
            }
            return lNode;
        }
コード例 #3
0
ファイル: NodeView.cs プロジェクト: mastertnt/XGraph
 /// <summary>
 /// Returns the node view containing the given view model.
 /// </summary>
 /// <param name="pItem">The item contained by the view.</param>
 /// <returns>The found view if any, null otherwise.</returns>
 public PortView GetContainerForPortViewModel(PortViewModel pItem)
 {
     return this.mInnerPortContainer.ItemContainerGenerator.ContainerFromItem(pItem) as PortView;
 }
コード例 #4
0
 /// <summary>
 /// Fires the request connection creation.
 /// </summary>
 /// <param name="pOutput">The output.</param>
 /// <param name="pInput">The input.</param>
 protected internal abstract void RequestConnectionCreation(PortViewModel pOutput, PortViewModel pInput);
コード例 #5
0
ファイル: PortViewModel.cs プロジェクト: mastertnt/XGraph
 /// <summary>
 /// Determines whether this source port can be connected to the specified p port view model.
 /// </summary>
 /// <param name="pTargetPortViewModel">The target port view model.</param>
 /// <returns>True if the connection can be done, false otherwise.</returns>
 public virtual bool CanBeConnectedTo(PortViewModel pTargetPortViewModel)
 {
     return true;
 }
コード例 #6
0
ファイル: PortViewModel.cs プロジェクト: Hengle/XGraph
 /// <summary>
 /// Determines whether this source port can be connected to the specified p port view model.
 /// </summary>
 /// <param name="pTargetPortViewModel">The target port view model.</param>
 /// <returns>True if the connection can be done, false otherwise.</returns>
 public virtual bool CanBeConnectedTo(PortViewModel pTargetPortViewModel)
 {
     return(true);
 }