• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Node类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Node的典型用法代码示例。如果您正苦于以下问题:C# Node类的具体用法?C# Node怎么用?C# Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Node类属于命名空间,在下文中一共展示了Node类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SendPing

        public void SendPing()
        {
            engine.Add(node);
            engine.TimeOut = TimeSpan.FromMilliseconds(75);
            ManualResetEvent handle = new ManualResetEvent(false);
            engine.MessageLoop.QuerySent += delegate(object o, SendQueryEventArgs e) {
                if (!e.TimedOut && e.Query is Ping)
                    handle.Set();

                if (!e.TimedOut || !(e.Query is Ping))
                    return;

                PingResponse response = new PingResponse(node.Id, e.Query.TransactionId);
                listener.RaiseMessageReceived(response, e.EndPoint);
            };

            Assert.AreEqual(NodeState.Unknown, node.State, "#1");

            DateTime lastSeen = node.LastSeen;
            Assert.IsTrue(handle.WaitOne(1000, false), "#1a");
            Node nnnn = node;
            node = engine.RoutingTable.FindNode(nnnn.Id);
            Assert.IsTrue (lastSeen < node.LastSeen, "#2");
            Assert.AreEqual(NodeState.Good, node.State, "#3");
        }
开发者ID:dontnod,项目名称:monotorrent,代码行数:25,代码来源:MessageHandlingTests.cs


示例2: Comment

        public Comment(Node hostNode)
        {
            HostNode = hostNode;

            var scrollViewer = new ScrollViewer
            {
                HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
                VerticalScrollBarVisibility = ScrollBarVisibility.Visible,
                Height = 70,
                CanContentScroll = true
            };

            var textBlock = new TextBlock
            {
                Background = Brushes.Transparent,
                TextWrapping = TextWrapping.Wrap,
                Margin = new Thickness(5),
                FontSize = 12
            };

            Child = scrollViewer;
            CornerRadius = new CornerRadius(5);
            scrollViewer.Content = textBlock;


            var bindingTextToTextBlock = new Binding("Text")
            {
                Source = this,
                Mode = BindingMode.OneWay
            };
            textBlock.SetBinding(TextBlock.TextProperty, bindingTextToTextBlock);

            hostNode.SpaceCanvas.Children.Add(this);
        }
开发者ID:bsudhakarGit,项目名称:TUM.CMS.VPLControl,代码行数:34,代码来源:Comment.cs


示例3: OnMailBox

 public override void OnMailBox(Node from, string address, object letter)
 {
     for (var i = 0; i < lineCount-1; i++) {
         GetComponent<Label> (i).Text = GetComponent<Label> (i + 1).Text;
     }
     GetComponent<Label> (lineCount - 1).Text = (string)letter;
 }
开发者ID:weimingtom,项目名称:erica,代码行数:7,代码来源:MyLogger.cs


示例4: magix_viewport_load_viewport

		public static void magix_viewport_load_viewport(object sender, ActiveEventArgs e)
		{
            Node ip = Ip(e.Params);
            if (ShouldInspect(ip))
            {
                AppendInspectFromResource(
                    ip["inspect"],
                    "Magix.tiedown",
                    "Magix.tiedown.hyperlisp.inspect.hl",
                    "[magix.viewport.load-viewport-dox].value");
                return;
			}

			Node node = new Node();
            node["file"].Value = "plugin:magix.file.load-from-resource";
            node["file"]["assembly"].Value = "Magix.tiedown";
            node["file"]["resource-name"].Value = "Magix.tiedown.hyperlisp.load-viewport.hl";

			RaiseActiveEvent(
				"magix.execute.execute-script",
				node);

            Control ctrl = ModuleControllerLoader.Instance.LoadActiveModule(node["params"]["viewport"].Get<string>());
            e.Params["viewport"].Value = ctrl;
        }
开发者ID:polterguy,项目名称:magix,代码行数:25,代码来源:ViewportCore.cs


示例5: Bullet

        public Bullet(Node parent, string name)
            : base(parent, name)
        {
            Render = new ImageRender(this, "Render");
            Render.SetTexture(GetRoot<State>().GetService<AssetCollector>().GetAsset<Texture2D>("bullet"));
            Render.Layer = .1f;
            Render.Scale = new Vector2(.1f);
            Render.Color = Color.White;
            Render.LinkDependency(ImageRender.DEPENDENCY_BODY, Body);

            //Make our collision rectangles the size of the rendered sprite.
            Body.Bounds = Render.Bounds;
            Body.Origin = new Vector2(Render.Texture.Width / 2f, Render.Texture.Height / 2f);

            Shape = new Circle(this, "Shape", Body.Width / 2);
            Shape.Offset = new Vector2(Body.Width / 2, Body.Height / 2);
            Shape.LinkDependency(Circle.DEPENDENCY_BODY, Body);

            Collision.Group.AddMask(1);
            Collision.Pair.AddMask(2);
            Collision.Immovable = true;
            Collision.CollideEvent += collision => Recycle();
            Collision.LinkDependency(Collision.DEPENDENCY_SHAPE, Shape);
            Shape.LinkDependency(Circle.DEPENDENCY_COLLISION, Collision);

            DeathTimer = new Timer(this, "DeathTimer");
            DeathTimer.Milliseconds = 2000;
            DeathTimer.LastEvent += Recycle;
            DeathTimer.LastEvent += DeathTimer.Stop;
        }
开发者ID:redcodefinal,项目名称:EntityEngineV4TestBed,代码行数:30,代码来源:Bullet.cs


示例6: Tilemap

 public Tilemap(Node parent, string name, Texture2D tileTexture, Point size, Point tileSize)
     : base(parent, name)
 {
     Body = new Body(this, "Body");
     Render = new TilemapRender(this, "TilemapRender", tileTexture, size, tileSize);
     Render.LinkDependency(TilemapRender.DEPENDENCY_BODY, Body);
 }
开发者ID:HaKDMoDz,项目名称:EntityEngineV4,代码行数:7,代码来源:Tilemap.cs


示例7: SaveAllConncectedComponents

    private static void SaveAllConncectedComponents(Node<int> node,
        HashSet<int> visitedNodes, List<string> connectedComponents)
    {
        string graphs = string.Empty;
        Stack<Node<int>> nodesStack = new Stack<Node<int>>();
        nodesStack.Push(node);

        while (nodesStack.Count > 0)
        {
            Node<int> currentNode = nodesStack.Pop();
            visitedNodes.Add(currentNode.Value);
            graphs += " -> " + currentNode.Value;

            foreach (var child in currentNode.Children)
            {
                if (!visitedNodes.Contains(child.Value))
                {
                    visitedNodes.Add(child.Value);
                    nodesStack.Push(child);
                }
            }
        }

        connectedComponents.Add(graphs.Substring(4));
    }
开发者ID:RamiAmaire,项目名称:TelerikAcademy,代码行数:25,代码来源:Demo.cs


示例8: ElectricityCalcul

 static void ElectricityCalcul(Node actual, ref int VoltageColector, int Intensity, bool previous, Node From)
 {
     if (VoltageColector <= 0 || previous ==  false ||  actual._activatedByPlayer == false || Intensity == 0)
     {
         actual._activated = false;
     }
     else
     {
         if (VoltageColector < actual.getCost())
         {
            actual._activated = false;
         }
         else
         {
            actual._activated = true;
            actual._intensity = Intensity;
            VoltageColector = VoltageColector - actual.getCost();
         }
     }
     int localVoltage  = VoltageColector;
     actual._peerOut.ForEach(delegate(Node other)
     {
       if (other != From)
         ElectricityCalcul(other, ref localVoltage, (int)actual.energyDiv(), actual._activated, actual);
         });
     VoltageColector = localVoltage;
 }
开发者ID:Haseo,项目名称:Electric-Potatoe-TD,代码行数:27,代码来源:ElectricityManager.cs


示例9: NodeViewModel

        public NodeViewModel(Node node, Vector location, IControlTypesResolver controlTypesResolver)
        {
            Node = node;
            Title = node.Title;
            Location = new CanvasPoint(location);
            ControlTypesResolver = controlTypesResolver;

            foreach (var pin in node.InputPins)
            {
                AddInputPin(pin);
            }

            foreach (var pin in node.OutputPins)
            {
                AddOutputPin(pin);
            }

            node.Processed += OnNodeProcessed;
            node.PinsChanged += OnNodePinsChanged;

            _disposable = Disposable.Create(() =>
            {
                node.PinsChanged -= OnNodePinsChanged;
                node.Processed -= OnNodeProcessed;
            });
        }
开发者ID:misupov,项目名称:Turbina,代码行数:26,代码来源:NodeViewModel.cs


示例10: ConstructAmbiguousEntity

		/// <summary>
		/// Validates and constructs generic entities out of an ambiguous generic definition entity.
		/// </summary>
		private IEntity ConstructAmbiguousEntity(Node constructionNode, Ambiguous ambiguousDefinition, IType[] typeArguments)
		{
			var checker = new GenericConstructionChecker(typeArguments, constructionNode); 
			var matches = new List<IEntity>(ambiguousDefinition.Entities);
			bool reportErrors = false;
			foreach (Predicate<IEntity> check in checker.Checks)
			{
				matches = matches.Collect(check);

				if (matches.Count == 0)
				{
					Errors.Add(checker.Errors[0]); // only report first error, assuming the rest are superfluous
					return TypeSystemServices.ErrorEntity;
				}

				if (reportErrors)
					checker.ReportErrors(Errors);

				checker.DiscardErrors();

				// We only want full error reporting once we get down to a single candidate
				if (matches.Count == 1)
					reportErrors = true;
			}

			IEntity[] constructedMatches = Array.ConvertAll<IEntity, IEntity>(matches.ToArray(), def => MakeGenericEntity(def, typeArguments));
			return Entities.EntityFromList(constructedMatches);
		}
开发者ID:HaKDMoDz,项目名称:GNet,代码行数:31,代码来源:GenericsServices.cs


示例11: CreateControls

        private void CreateControls(Node node)
        {
            foreach(Node idx in node)
            {
                string caption = idx["Caption"].Get<string>();
                string value = idx["Value"].Get<string>();
                string type = idx["Type"].Get<string>();
                int position = idx["Position"].Get<int>();

                Panel pnl = new Panel();
                pnl.CssClass = "bordered-panel";

                Label cpt = new Label();
                cpt.CssClass = "label-caption";
                cpt.Text = caption;
                pnl.Controls.Add(cpt);

                Label val = new Label();
                val.CssClass = "label-value";
                val.Text = value;
                pnl.Controls.Add(val);

                // Rooting...
                wrpPnl.Controls.Add(pnl);
            }
        }
开发者ID:greaterwinner,项目名称:ra-brix,代码行数:26,代码来源:ViewWhiteboardDetails.ascx.cs


示例12: MoshParser

        public MoshParser(ILexer lexer)
        {
            m_startRuleToken = new Token { TokenType = TokenType.NEW_RULE };
            m_tree = new Node<string>();
            m_lexer = lexer;
            m_consumed = new Stack<Token>();
            m_err = new Queue<Error>();

            // Setup rule pre-calling conditions
            m_rulePreHook = name =>
                                {
                                    if (m_tree.Value == null)
                                    {
                                        m_tree.Value = name;
                                        return m_tree;
                                    }

                                    var tempNode = m_tree;
                                    var newTopNode = m_tree.AddChild(name);
                                    m_tree = newTopNode;
                                    return tempNode;
                                };

            // Setup rule post-calling conditions
            m_rulePostHook = node => m_tree = node;
        }
开发者ID:predator5047,项目名称:recursive-descent,代码行数:26,代码来源:MoshParser.cs


示例13: Setup

 public void Setup()
 {
     listener = new TestListener();
     node = new Node(NodeId.Create(), new IPEndPoint(IPAddress.Any, 0));
     engine = new DhtEngine(listener);
     //engine.Add(node);
 }
开发者ID:dontnod,项目名称:monotorrent,代码行数:7,代码来源:MessageHandlingTests.cs


示例14: SolverValidator

 public SolverValidator(Solver solver, NodeCollection nodes, Node root, IPositionLookupTable<Node> transpositionTable)
 {
     this.solver = solver;
     this.nodes = nodes;
     this.root = root;
     this.transpositionTable = transpositionTable;
 }
开发者ID:ricksladkey,项目名称:Sokoban,代码行数:7,代码来源:SolverValidator.cs


示例15: CircularDependency_ThrowsCircularDependencyException_Test

        public void CircularDependency_ThrowsCircularDependencyException_Test()
        {
            var a = new Node<object>("a");
            var b = new Node<object>("b");
            var c = new Node<object>("c");
            var d = new Node<object>("d");
            var e = new Node<object>("e");

            a.Edges.Add(b); // a depends on b
            a.Edges.Add(d); // a depends on d
            b.Edges.Add(c); // b depends on c
            b.Edges.Add(e); // b depends on e
            c.Edges.Add(d); // c depends on d
            c.Edges.Add(e); // c depends on e
            d.Edges.Add(b); // d depends on b

            var resolved = new List<Node<object>>();

            CircularDependencyException<object> exception = null;
            try
            {
                a.ResolveDependencies();
            }
            catch (CircularDependencyException<object> ex)
            {
                exception = ex;
            }

            Assert.NotNull(exception);
            Assert.Equal(d, exception.A);
            Assert.Equal(b, exception.B);
        }
开发者ID:joskid,项目名称:sprockets-dotnet,代码行数:32,代码来源:DependencyTest.cs


示例16: SandboxCode

        /*
         * actual implementation of sandbox
         */
        private static void SandboxCode(Node pars, Node ip)
        {
            // storing and clearing old whitelist
            // and checking to see that no keyword not previously whitelisted has been whitelisted
            Node oldWhitelist = null;
            if (pars.Contains("_whitelist"))
            {
                foreach (Node idx in ip["whitelist"])
                {
                    if (!pars["_whitelist"].Contains(idx.Name))
                        throw new HyperlispExecutionErrorException("cannot [whitelist] an active event that was blacklisted in a previous [sandbox]");
                }
                oldWhitelist = pars["_whitelist"].Clone();
                pars["_whitelist"].Clear();
            }

            // setting new whitelist
            pars["_whitelist"].AddRange(ip["whitelist"].Clone());
            try
            {
                pars["_ip"].Value = ip["code"];
                RaiseActiveEvent(
                    "magix.execute",
                    pars);
            }
            finally
            {
                pars["_whitelist"].UnTie();
                if (oldWhitelist != null)
                    pars["_whitelist"].AddRange(oldWhitelist);
            }
        }
开发者ID:polterguy,项目名称:magix,代码行数:35,代码来源:SandboxCore.cs


示例17: DoorSensor

 public DoorSensor(Node node)
     : base(node)
 {
     node.GetCommandClass<Basic>().Changed += Basic_Changed;
     node.GetCommandClass<SensorBinary>().Changed += SensorBinary_Changed;
     node.GetCommandClass<SensorAlarm>().Changed += SensorAlarm_Changed;
 }
开发者ID:roblans,项目名称:ZWave4Net,代码行数:7,代码来源:DoorSensor.cs


示例18: ElecticityUpdate

 public static void ElecticityUpdate(Game game, Node center)
 {
     Node tmp = center;
     int Volt = game.getScore();
     int In = game.getScore();
     ElectricityCalcul(tmp, ref Volt, In, true, tmp);
 }
开发者ID:Haseo,项目名称:Electric-Potatoe-TD,代码行数:7,代码来源:ElectricityManager.cs


示例19: Test_CollideWith

        public void Test_CollideWith()
        {
            var node1 = new Node ("Node1");
            node1.Attach(new CollisionObject ());
            node1.CollisionObject.Shape = new BoxShape (1, 1, 1);
            node1.GroupID = 1;

            var node2 = new Node ("Node2");
            node2.Attach (new CollisionObject ());
            node2.CollisionObject.Shape = new BoxShape (1, 1, 1);
            node2.GroupID = 2;

            var wld = new World ();
            wld.AddChild (node1);
            wld.AddChild (node2);

            node1.CollisionObject.CollideWith = -1;
            Assert.AreEqual (true, wld.Overlap (node1, node2));

            node1.CollisionObject.CollideWith = 1;
            Assert.AreEqual (false, wld.Overlap (node1, node2));

            node1.CollisionObject.CollideWith = 2;
            Assert.AreEqual (true, wld.Overlap (node1, node2));

            node1.CollisionObject.CollideWith = 2;
            node1.CollisionObject.IgnoreWith = 2;
            Assert.AreEqual (false, wld.Overlap (node1, node2));
        }
开发者ID:weimingtom,项目名称:erica,代码行数:29,代码来源:TestCollisionAnalyze.cs


示例20: doNeighborListUpdate

        public void doNeighborListUpdate(Node.NodeList neighborList)
        {
            Debug.WriteLine("doNeighborListUpdate");

                        lock (neighborListLock)
                        {
                                neighborListView.Items.Clear();

                                neighborListView.BeginUpdate();

                                Debug.WriteLine("Looping through neighbors");
                                foreach (Haggle.Node neighbor in neighborList.AsArray())
                                {
                                        string ifaceStr = "";
                                        Debug.WriteLine("Adding neighbor " + neighbor.GetName());
                                        ListViewItem neighItem = new ListViewItem(neighbor.GetName());
                                        foreach (Node.Interface iface in neighbor.InterfacesArray())
                                        {
                                                ifaceStr += iface.GetIdentifierStr() + ",";
                                        }

                                        char[] tc = { ',' };
                                        neighItem.SubItems.Add(ifaceStr.TrimEnd(tc));
                                        neighborListView.Items.Add(neighItem);

                                }
                                neighborListView.EndUpdate();
                                Debug.WriteLine("Neighborlist update end");
                        }
        }
开发者ID:iamsamwood,项目名称:ENCODERS,代码行数:30,代码来源:NeighborListWindow.cs



注:本文中的Node类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NodeAttributes类代码示例发布时间:2022-05-24
下一篇:
C# NoSpecimen类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap