本文整理汇总了C#中Process.GetMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Process.GetMessage方法的具体用法?C# Process.GetMessage怎么用?C# Process.GetMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Process
的用法示例。
在下文中一共展示了Process.GetMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendMessageToProcessWithVariableExpression
public void SendMessageToProcessWithVariableExpression()
{
Context context = new Context();
Process process = new Process();
context.SetValue("X", 1);
SendExpression expr = new SendExpression(new ConstantExpression(process), new VariableExpression(new Variable("X")));
Assert.IsNotNull(expr.ProcessExpression);
Assert.IsInstanceOfType(expr.ProcessExpression, typeof(ConstantExpression));
Assert.IsNotNull(expr.MessageExpression);
Assert.IsInstanceOfType(expr.MessageExpression, typeof(VariableExpression));
Assert.IsTrue(expr.HasVariable());
Assert.AreEqual(1, expr.Evaluate(context));
Assert.AreEqual(1, process.GetMessage());
}
示例2: LoadAreaServer
public void LoadAreaServer()
{
Machine machine = new Machine();
var module = machine.LoadModule("area_server");
Assert.IsNotNull(module);
Assert.IsNotNull(module.Context);
Assert.AreEqual("area_server", module.Name);
Assert.IsNotNull(module.Context.GetValue("loop/0"));
machine.RootContext.SetValue(module.Name, module);
this.EvaluateExpression("Pid = spawn(fun() -> area_server:loop() end).", machine.RootContext);
Process process = new Process();
Process.Current = process;
this.EvaluateExpression("Pid ! {self(), rectangle, 6, 10}.", machine.RootContext);
Assert.AreEqual(60, process.GetMessage());
this.EvaluateExpression("Pid ! {self(), circle, 23}.", machine.RootContext);
Assert.AreEqual(3.14159 * 23 * 23, process.GetMessage());
this.EvaluateExpression("Pid ! stop.", machine.RootContext);
}