Click here to Skip to main content
12,066,952 members (54,286 online)
Click here to Skip to main content

Stats

184.8K views
9.4K downloads
138 bookmarked
Posted

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.Generic;
using System.Text;
using System.Threading;
using DaggerLib.Interfaces;

namespace DaggerLib.Core
{
    /// <summary>
    /// Default non-threaded Graph scheduler class
    /// </summary>
    public class OrdinalExecutionScheduler : IGraphScheduler
    {
        private DaggerGraph _graph;
        
        // list of subgraphs in ordinal sorted order
        private List<List<DaggerNode>> _subgraphs = new List<List<DaggerNode>>();

        public DaggerGraph Graph
        {
            get
            {
                return _graph;
            }
            set
            {
                CancelProcessing();
                _graph = value;
            }
        }

        public void CancelProcessing()
        {

        }

        public void OnTopologyChanged()
        {
            // recreate list of subgraphs in ordinal sorted order
            _subgraphs.Clear();
            for (int i = 0; i < _graph.SubGraphCount; i++)
            {
                _subgraphs.Add(_graph[i]);
            }
        }

        public void Dispose()
        {

        }

        /// <summary>
        /// Process the entire graph and it's subgraphs
        /// </summary>
        public void ProcessGraph()
        {
            // execute the list of subgraphs
            foreach (List<DaggerNode> subgraph in _subgraphs)
            {
                foreach (DaggerNode node in subgraph)
                {
                    node.DoProcessing();

                    // if the node has a UINode attached, call it's DoUIProcessing method
                    if (node.UINode != null)
                    {
                        node.UINode.DoUIProcessing();
                    }
                }
            }
        }

        /// <summary>
        /// Process the graph from a given node
        /// </summary>
        /// <param name="node"></param>
        public void ProcessGraph(DaggerNode node)
        {
            node.DoProcessing();

            // if the node has a UINode attached, call it's DoUIProcessing method
            if (node.UINode != null)
            {
                node.UINode.DoUIProcessing();
            }

            foreach (DaggerNode n in node._descendents)
            {
                n.DoProcessing();

                // if the node has a UINode attached, call it's DoUIProcessing method
                if (n.UINode != null)
                {
                    n.UINode.DoUIProcessing();
                }
            }
        }
    }
}

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.

You may also be interested in...

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