本文整理汇总了C#中Udbus.Cancel方法的典型用法代码示例。如果您正苦于以下问题:C# Udbus.Cancel方法的具体用法?C# Udbus.Cancel怎么用?C# Udbus.Cancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Udbus
的用法示例。
在下文中一共展示了Udbus.Cancel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestDbusCalls
//.........这里部分代码省略.........
//result = connector.ReceiveStruct(out recv);
//Console.WriteLine("ListNames recv result: {0}. msg: {1}", result, recv);
//using (var msg = connector.ReceiveHandle(out result))
using(var msg = Udbus.Core.UdbusVisitorFunctions.LoopUdbusFind(connector, visitors, Console.Out, stop).Handle)
{
//result = connector.ReceiveStruct(out recv);
msg.HandleToStructure(out recv);
Console.WriteLine("ListNames recv result: {0}. msg: {1}", result, recv);
Udbus.Serialization.UdbusMessageReader reader = new Udbus.Serialization.UdbusMessageReader(msg);
uint counter = 0;
foreach (Udbus.Serialization.UdbusMessageReader subreader in reader.ArrayReader(Udbus.Types.dbus_type.DBUS_STRING))
{
string name = subreader.ReadStringValue(out result);
if (result != 0)
{
Console.WriteLine("Error ! {0:d}/0x{0:x8}", result);
}
Console.WriteLine("Entry {0:d2}: {1}", counter++, name);
}
} // Ends using ListNames response
#endif // _LISTNAMES
// read_icon
TestDbusReadIcon(builder, visitors, connector, stop, preNextAction);
#if _GETSIGNAL
preNextAction("AddMatch");
// AddMatch for signal.
using (var msg = builder.UdbusMethodMessage(
"org.freedesktop.DBus", "/org/freedesktop/DBus",
"org.freedesktop.DBus", "AddMatch").Message)
{
Udbus.Types.dbus_sig signature = Udbus.Types.dbus_sig.Initialiser;
signature.a[0] = Udbus.Types.dbus_type.DBUS_STRING;
signature.a[1] = Udbus.Types.dbus_type.DBUS_INVALID;
builder.SetSignature(ref signature)
.BodyAdd(4096)
.BodyAdd_String("type='signal',interface='com.citrix.xenclient.xenmgr.host',member='storage_space_low'")
//.BodyAdd_String("type='signal',interface='com.citrix.xenclient.xenmgr.host'")
;
result = connector.Send(msg);
Console.WriteLine("AddMatch send result: {0}", result);
}
preNextAction("LoopSignals");
// Handle signals and other bits of magic.
//Console.TreatControlCAsInput = true;
Console.CancelKeyPress += delegate(Object sender, ConsoleCancelEventArgs consoleargs)
{
consoleargs.Cancel = true;
Console.WriteLine("Setting stop event...");
stop.Set();
connection.Cancel();
};
try
{
Udbus.Core.UdbusVisitorFunctions.LoopUdbus(connector, visitor, Console.Out, stop);
}
catch (System.Runtime.InteropServices.SEHException seh)
{
Console.WriteLine("Error: " + seh.ToString());
}
#endif // _GETSIGNAL
#if HAVESOMECCODE
r = 0;
msg = NULL;
msg = dbus_msg_new_method_call(serial++,
"org.freedesktop.DBus", "/org/freedesktop/DBus",
"org.freedesktop.DBus", "AddMatch");
if (!msg) {
dio.io_debug(dio.logpriv, "Unable to create method message for AddMatch\n");
exit(1);
}
MessageInfo::dumpMethodSend(&io_debug, msg);
dbus_sig signature;
signature.a[0] = DBUS_STRING;
signature.a[1] = DBUS_INVALID;
dbus_msg_set_signature(msg, &signature);
dbus_msg_body_add(msg, 4096);
//r |= dbus_msg_body_add_string(msg, "type='signal',interface='com.citrix.xenclient.xenmgr.host'");
//r |= dbus_msg_body_add_string(msg, "type='method_call'");
r |= dbus_msg_body_add_string(msg, "type='signal',interface='com.citrix.xenclient.xenmgr.host'");
r |= dbus_msg_send(&dio, msg);
loop_dbus(dio, visitor);
#endif // HAVESOMECCODE
Console.WriteLine("Press <ENTER> to end connection");
Console.ReadLine();
return connector;
}