本文整理汇总了C#中Connector.Open方法的典型用法代码示例。如果您正苦于以下问题:C# Connector.Open方法的具体用法?C# Connector.Open怎么用?C# Connector.Open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connector
的用法示例。
在下文中一共展示了Connector.Open方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RSSPub
RSSPub(string serverUrl)
{
m_Connector = new Connector();
Parameters p = new Parameters();
p.ServerUrl = serverUrl;
m_Connector.Open(p);
}
示例2: 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();
}
}
示例3: testConnect
public void testConnect()
{
TestUtil.INIT_TESTCASE("testConnect");
Connector c1 = new Connector();
Parameters p1 = new Parameters();
bool b;
b = c1.Open(p1);
Assertion.Assert("!b", !b);
Assertion.Assert("!c1.IsConnected()", !c1.IsConnected());
p1.ServerUrl = TestUtil.getServer();
b = c1.Open(p1);
Assertion.Assert("b", b);
Assertion.Assert("c1.IsConnected()", c1.IsConnected());
}
示例4: ExecuteSqlStatement
public SqlDataReader ExecuteSqlStatement(string sqlStatement)
{
try
{
using (_connector = new Connector())
{
_connector.Open();
SqlCommand sqlCommand = _connector.SqlCommandText(sqlStatement);
SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
return sqlDataReader;
}
}
catch
{
throw;
}
}
示例5: testPub
public void testPub()
{
TestUtil.INIT_TESTCASE("testPub");
TestUtil.resetCounters();
Connector c1 = new Connector();
Parameters p1 = new Parameters();
TestUtil.PubRequestStatusHandler prsh = new TestUtil.PubRequestStatusHandler();
bool b;
p1.ServerUrl = TestUtil.getServer();
b = c1.Open(p1);
Assertion.Assert("b", b);
Assertion.Assert("c1.IsConnected()", c1.IsConnected());
Message m1 = new Message();
m1.Set("do_method", "notify");
m1.Set("kn_to", "/what/knchat/messages");
m1.Set("nickname", "abc");
m1.Set("kn_response_format", "simple");
for(int i = 1; i <= 10; i++)
{
m1.Set("kn_payload", "Hello-" + i);
b = c1.Publish(m1, prsh);
}
TestUtil.dumpCounters();
//pubReqSH OnSuccess : 10 pub connections -----------------+
//pubReqSH OnError : ---------------------------------+ |
//pubConnSH OnConnStatus : No conn status handler -------+ | |
//subReqSH OnSuccess : No sub --------------------+ | | |
//subReqSH OnError : No sub -----------------+ | | | |
//subConnSH OnConnStatus : No sub --------------+ | | | | |
//subListener OnUpdate : No sub -----------+ | | | | | |
string counterResult1 = TestUtil.checkCounters(0, 0, 0, 0, 0, 0, 10);
Assertion.Assert(counterResult1, counterResult1 == TestUtil.TU_OK);
}