Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

DSGraphEdit: A Reasonable Facsimile of Microsoft's GraphEdit in .NET

, 20 Dec 2007 CPOL
A library for adding DirectShow GraphEdit-like abilities to .NET applications.
dsgrapheditdemo.zip
WeifenLuo.WinFormsUI.Docking.dll
DaggerLib.dll
DaggerLib.DSGraphEdit.dll
DaggerLib.UI.Windows.dll
DirectShowLib-2005.dll
DSGraphEdit.exe
MediaFoundation.dll
dsgrapheditsrc.zip
DSGraphEdit
bin
Release
DSIcon.ico
Properties
Settings.settings
Referenced Libs
WeifenLuo.WinFormsUI.Docking.dll
RemoteGraphTile.jpg
DaggerLib
bin
Release
Core
Interfaces
Properties
SetGeneric
UI
DaggerLib.DSGraphEdit
DMOParameterControls
DSFilterTreeView
DSGraphEditControls
lib
Properties
ReferencedLibs
DirectShowLib-2005.dll
MediaFoundation.dll
DaggerLib.UI.Windows
AStar
bin
Debug
DaggerPropertyGrid
PropertyGridEx
Properties
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

using System.Runtime.Serialization;

namespace DaggerLib.Core
{
    [Serializable]
    public class DaggerOutputPinCollection : CollectionBase, ISerializable
    {
        #region Fields

        internal DaggerNode _parentNode;

        //DaggerGraph containing these pins (_parentNode and _parentGraph are mutually exclusive)
        internal DaggerGraph _parentGraph;

        internal event DaggerPinAdded PinAdded;
        internal event DaggerPinRemoved PinRemoved;

        #endregion

        #region ctor

        public DaggerOutputPinCollection(DaggerNode parentNode)
        {
            _parentNode = parentNode;
        }

        public DaggerOutputPinCollection(DaggerGraph parentGraph)
        {
            _parentGraph = parentGraph;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets a list of all pins that have a connection
        /// </summary>
        public List<DaggerOutputPin> ConnectedPins
        {
            get
            {
                List<DaggerOutputPin> pins = new List<DaggerOutputPin>();

                foreach (DaggerOutputPin pin in List)
                {
                    if (pin.IsConnected)
                    {
                        pins.Add(pin);
                    }
                }

                return pins;
            }
        }

        /// <summary>
        /// Get a pin by it's index
        /// </summary>
        /// <param name="Index"></param>
        /// <returns></returns>
        public DaggerOutputPin this[int Index]
        {
            get
            {
                return (DaggerOutputPin)List[Index];
            }
        }

        /// <summary>
        /// Get a pin by it's name
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public DaggerOutputPin this[string name]
        {
            get
            {
                DaggerOutputPin outpin = null;

                foreach (DaggerOutputPin pin in List)
                {
                    if (name == pin.Name)
                    {
                        outpin = pin;
                        break;
                    }
                }

                return outpin;
            }
        }

        /// <summary>
        /// Get a pin by it's guid
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        internal DaggerOutputPin this[Guid guid]
        {
            get
            {
                DaggerOutputPin outpin = null;

                foreach (DaggerOutputPin pin in List)
                {
                    if (guid == pin.InstanceGuid)
                    {
                        outpin = pin;
                        break;
                    }
                }

                return outpin;
            }
        }

        #endregion

        #region Methods

        public bool Contains(DaggerOutputPin Pin)
        {
            return List.Contains(Pin);
        }

        public int Add(DaggerOutputPin Pin)
        {
            int i;

            i = List.Add(Pin);
            Pin._parentNode = _parentNode;
            Pin._parentGraph = _parentGraph;

            if (PinAdded != null)
            {
                PinAdded(this, Pin);
            }
            return i;
        }

        public void Remove(DaggerOutputPin Pin)
        {
            List.Remove(Pin);

            if (PinRemoved != null)
            {
                PinRemoved(this, Pin);
            }

            Pin._parentNode = null;
            Pin._parentGraph = null;
        }

        #endregion

        //Serialization function.
        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("OutputPins", List);
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

JohnnyLocust
Software Developer (Senior) Haivision Network Video
United States United States
AKA Rich Insley.
 
I have over 25 years experience in programming, and I'm completely self taught. (Except for one year at California State University Fresno where I had to learn the God awful language Miranda (http://miranda.org.uk/). I've spent 10 years as a Paratrooper in the US Army during the Clinton Administration.
Follow on   LinkedIn

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.1411023.1 | Last Updated 20 Dec 2007
Article Copyright 2007 by JohnnyLocust
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid