本文整理汇总了C#中Connector.Close方法的典型用法代码示例。如果您正苦于以下问题:C# Connector.Close方法的具体用法?C# Connector.Close怎么用?C# Connector.Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connector
的用法示例。
在下文中一共展示了Connector.Close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
if (args.Length != 2)
{
Console.WriteLine("Wrong number of arguments. Got {0} instead.", args.Length);
return;
}
MyHandler myH = new MyHandler();
Parameters p = new Parameters();
p.ServerUrl = args[0];
Connector c = new Connector();
if (c.Open(p))
{
Message m = new Message();
m.Set("do_method", "notify");
m.Set("kn_to", args[1]);
m.Set("kn_payload", "Hello");
m.Set("nickname", "dotnet");
m.Set("kn_response_format", "simple");
c.Publish(m, myH);
c.Close();
}
}
示例2: Main
static void Main(string[] args)
{
Console.WriteLine("HelloEEG!");
Connector connector = new Connector();
connector.DeviceConnected += new EventHandler(OnDeviceConnected);
connector.DeviceConnectFail += new EventHandler(OnDeviceFail);
connector.DeviceValidating += new EventHandler(OnDeviceValidating);
connector.ConnectScan("COM13");
Thread.Sleep(450000);
System.Console.WriteLine("Goodbye.");
connector.Close();
Environment.Exit(0);
}
示例3: Main
public static void Main(string[] args)
{
Console.WriteLine("HelloEEG!");
// Initialize a new Connector and add event handlers
connector = new Connector();
connector.DeviceConnected += new EventHandler(OnDeviceConnected);
connector.DeviceConnectFail += new EventHandler(OnDeviceFail);
connector.DeviceValidating += new EventHandler(OnDeviceValidating);
// Scan for devices across COM ports
// The COM port named will be the first COM port that is checked.
connector.ConnectScan("COM40");
// Blink detection needs to be manually turned on
connector.setBlinkDetectionEnabled(true);
Thread.Sleep(450000);
System.Console.WriteLine("Goodbye.");
connector.Close();
Environment.Exit(0);
}
示例4: button_disconnect_Click
private void button_disconnect_Click(object sender, RoutedEventArgs e)
{
Connector connector = new Connector();
connector.Close();
}