在WF4 beta 2中从控制台读取 [英] Reading from the console in WF4 beta 2
问题描述
我正在尝试使用新的流程图活动从控制台读取用户输入,并看到WriteLine活动,但没有ReadLine或使用设计器的变量或参数赋值如何工作的示例(尤其是当存在多个时). 我搜索了2天才找到一个示例,并且只找到了在控制台上写一两个问候世界的文章,并立即着眼于高级主题,从而避免了这个基本问题.为了使事情更加令人沮丧,我看到了都柏林的一个视频,该视频具有自定义的ReadLine活动,但没有讨论它,也没有包含它的源代码.
我知道我只是忽略了这一点.任何帮助将不胜感激.
-ChitownBoy
Chitown Boy
I am attempting to read user input from the console using the new flowchart activity and see a WriteLine activity but no ReadLine or an example of how variable or argument assignment would work using the designer (especially when there is more than one). I have searched for 2 days to find an example and have only found articles that write a hello world or two to the console and proceed immediately to advanced topics avoiding this basic issue. To make things even more frustrating I saw a video from Dublin that had a custom ReadLine activity but did not discuss it or include the source code for it.
I know it is something I am simply overlooking. Any help would be immensely appreciated.
-ChitownBoy
Chitown Boy
推荐答案
您是否正在寻找如何实施ReadLine活动?顺便说一句,WF设计器将在属性"窗口中显示所有参数.
Are you looking for how to implement a ReadLine activity? BTW, WF designer will show all the arguments in Properties window.
public sealed class ReadLine : CodeActivity
{
public OutArgument<string> Text { get; set; }
protected override void Execute(CodeActivityContext context)
{
string text = Console.ReadLine();
context.SetValue<string>(Text, text);
}
}
谢谢,
安德斯
thanks,
Anders
这篇关于在WF4 beta 2中从控制台读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!