void Run()
{
m_eng.Start();
m_eng.OnMessage += new _DBG.MessageEventHandler(OnMessage);
m_eng.Stop();
m_eng = null;
}
void OnMessage(_WP.IncomingMessage msg, string text)
{
txtRead.Text = text;//Console.write(text);
}
为什么用consoleapplication: Console.write(text);数据就可以显示,可换成windowapplication要怎么改呢?
{
m_eng.Start();
m_eng.OnMessage += new _DBG.MessageEventHandler(OnMessage);
m_eng.Stop();
m_eng = null;
}
void OnMessage(_WP.IncomingMessage msg, string text)
{
txtRead.Text = text;//Console.write(text);
}
为什么用consoleapplication: Console.write(text);数据就可以显示,可换成windowapplication要怎么改呢?
解决方案 »
- 分析历史数据获取信息
- 分享自己的ExcelCheckClass(Excel数据检查,基于OLEDB)
- c#编程中发现了Button一个很奇怪的问题!似乎是控件本身BUG!
- 菜鸟求救
- 各位大哥,datagrid上直接修改了数据,我该怎么保存。
- 测试中,自己如何创建mock对象
- 急啊,请问如何统计网站的总访问量和今日访问量?高手们请帮忙,先谢了,在线等...
- 路过的大神帮我看下这么样才能再listview里面实现点击网址就能打开网页
- 又见水晶报表问题,为什么它就只能显示一页呢?显示下一页它就会我密码,库呀,表的?!
- 关于C#里WEB页数据捆绑的问题.
- C# WINFROM进度条问题
- 【求教】socket连接问题(当对方拒绝访问时)..我的办法可行么?
不能在 不是创建该控件的线程中 访问该控件void OnMessage(_WP.IncomingMessage msg, string text)
{
txtRead.BeginInvoke(delegate(){txtRead.Text=text;}); //txtRead.Text = text;//Console.write(text);
}
good
using System;
using System.IO;
using System.Text;
using System.Collections;
using System.Reflection;
using System.Threading;
using System.Diagnostics;using _DBG = Microsoft.SPOT.Debugger;
using _WP = Microsoft.SPOT.Debugger.WireProtocol;namespace Microsoft.SPOT.Tools
{
class SerialDump
{
_DBG.Engine m_eng;
bool m_fUsb = true;
SerialDump() //连接USB
{
_DBG.PortDefinition pd = null;
string port = null;
if (m_fUsb)
{
_DBG.PortDefinition[] ports = _DBG.AsyncUsbStream.EnumeratePorts(); if (port == null)
{
if (ports.Length == 0)
{
System.Console.WriteLine("No Usb SPOT device is present"); throw new ApplicationException();
}
else if (ports.Length == 1)
{
pd = ports[0];
}
else
{
System.Console.WriteLine("More than one USB SPOT device is present");
System.Console.WriteLine("To dump data from a specific device, choose your device from the list below and execute:");
System.Console.WriteLine(" serialdump -usb <device> ");
System.Console.WriteLine(""); //
// More than one usb device attached; dump list so user can choose
//
for (int i = 0; i < ports.Length; ++i)
{
System.Console.WriteLine("Device " + i + ": " + ports[i].DisplayName);
} throw new ApplicationException();
}
}
else
{
foreach (_DBG.PortDefinition pd2 in ports)
{
if (port.Equals(pd2.DisplayName))
{
pd = pd2;
break;
}
}
}
} m_eng = new _DBG.Engine(pd);//link
}
//提取数据 下面的codewindowapplication要怎么改?
void Run()
{
m_eng.Start();
m_eng.OnMessage += new _DBG.MessageEventHandler(OnMessage); Console.WriteLine("####### PRESS RETURN TO EXIT #######");
Console.ReadLine(); m_eng.Stop();
m_eng = null;
}
void OnMessage(_WP.IncomingMessage msg, string text)
{
console.write(text);// 显示数据
}
static void Main(string[] args)
{
try
{
SerialDump o = new SerialDump(); o.Run();//WINDOWN application 也可以这样吗?
}
catch (ApplicationException)
{
}
catch (Exception e)
{
Console.WriteLine("{0}", e.ToString());
}
}
Debug.Write