Exemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of a Networkvisualizer which renders the specified network in real-time
        /// </summary>
        /// <param name='n'>
        /// N.
        /// </param>
        /// <param name='layout'>
        /// Layout.
        /// </param>
        public static void Start(Network network, ILayoutProvider layout, NetworkColorizer colorizer = null, int width=800, int height=600)
        {
            // The actual rendering needs to be done in a separate thread placed in the single thread appartment state
            _mainThread = new Thread(new ThreadStart(new Action(delegate() {
                    NetworkVisualizer p =  new NetworkVisualizer(network, layout, colorizer, width, height);
                    p.Run(80f);
            })));

            _mainThread.SetApartmentState(ApartmentState.STA);
            _mainThread.Name = "STA Thread for NETGen Visualizer";

            // Fire up the thread
            _mainThread.Start();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new instance of a Networkvisualizer which renders the specified network in real-time
        /// </summary>
        /// <param name='n'>
        /// N.
        /// </param>
        /// <param name='layout'>
        /// Layout.
        /// </param>
        public static void Start(Network network, LayoutProvider layout, NetworkColorizer colorizer = null, int width = 800, int height = 600)
        {
            // The actual rendering needs to be done in a separate thread placed in the single thread appartment state
            _mainThread = new Thread(new ThreadStart(new Action(delegate() {
                Instance = new NetworkVisualizer(network, layout, colorizer, width, height);
                _initialized.Set();
                Instance.Run(80f);
            })));

            _mainThread.SetApartmentState(ApartmentState.STA);
            _mainThread.Name = "STA Thread for NETGen Visualizer";

            // Fire up the thread
            _mainThread.Start();
            _initialized.WaitOne();
        }