public static int Main(string[] args) { QCoreApplication app = new QCoreApplication(args); if (!QDBusConnection.SessionBus().IsConnected()) { Console.Write("Cannot connect to the D-BUS session bus.\n" + "To start it, run:\n" + "\teval `dbus-launch --auto-syntax`\n"); return(1); } if (!QDBusConnection.SessionBus().RegisterService(SERVICE_NAME)) { Console.WriteLine(QDBusConnection.SessionBus().LastError().Message()); return(1); } Pong pong = new Pong(); Connect(app, SIGNAL("aboutToQuit()"), pong, SLOT("Terminator()")); QDBusConnection.SessionBus().RegisterObject("/",pong,(int)QDBusConnection.RegisterOption.ExportAllSlots); return(QCoreApplication.Exec()); }
public static int Main(string[] args) { QCoreApplication app = new QCoreApplication(args); if (!QDBusConnection.SessionBus().IsConnected()) { Console.Error.WriteLine("Cannot connect to the D-BUS session bus.\n" + "To start it, run:\n" + "\teval `dbus-launch --auto-syntax`\n"); return(1); } Ping ping = new Ping(); ping.Connect(QDBusConnection.SessionBus().Interface(), SIGNAL("serviceOwnerChanged(QString,QString,QString)"), SLOT("Start(QString,QString,QString)")); // start the process manually - doesn't work this way.. // QProcess pong = new QProcess(qApp); // pong.Start("mono ./complexpong.exe"); // pong.WaitForStarted(); return(QCoreApplication.Exec()); }
public static int Main(string[] args) { QCoreApplication app = new QCoreApplication(args); QObject obj = new QObject(); Pong pong = new Pong(obj); pong.Connect(app,SIGNAL("aboutToQuit()"),SIGNAL("aboutToQuit()")); pong.value = "initial value"; QDBusConnection.SessionBus().RegisterObject("/",obj); if (!QDBusConnection.SessionBus().RegisterService(SERVICE_NAME)) { Console.Error.WriteLine(QDBusConnection.SessionBus().LastError().Message()); return(1); } return(QCoreApplication.Exec()); }
public unsafe void TestDeleteLater() { var argc = 0; string[] argv = new string[argc + 1]; var a = Assembly.GetEntryAssembly(); if (a == null) { a = Assembly.GetExecutingAssembly(); } var attrs = a.GetCustomAttributes(typeof(AssemblyTitleAttribute), false); if (attrs.Length > 0) { argv[0] = ((AssemblyTitleAttribute)attrs[0]).Title; } else { QFileInfo info = new QFileInfo(a.Location); argv[0] = info.BaseName; } var p = Marshal.StringToHGlobalAuto(argv[0]); var k = (char *)p; var core = new QCoreApplication(ref argc, &k); _qObject.DeleteLater(); Assert.IsNotNull(_qObject); QCoreApplication.Exec(); Assert.IsNull(_qObject); }