public override void Dispose() { // FIXME: This isn't enough... so we have to resort to more drastic measures below. // Likely Qyoto bug. QCoreApplication.Quit(); System.Diagnostics.Process.GetCurrentProcess().Kill(); }
public void Start(string name, string oldValue, string newValue) { if (name != SERVICE_NAME || newValue == "") { return; } // find our remote iface = new QDBusInterface(SERVICE_NAME, "/", "com.trolltech.QtDBus.ComplexPong.Pong", QDBusConnection.SessionBus(), this); if (!iface.IsValid()) { Console.Error.WriteLine(QDBusConnection.SessionBus().LastError().Message()); QCoreApplication.Quit(); } Connect(iface, SIGNAL("aboutToQuit()"), QCoreApplication.Instance(), SLOT("quit()")); while (true) { Console.Write("Ask your question: "); string line = Console.ReadLine().Trim(); if (line == "") { iface.Call("quit"); return; } else if (line == "value") { QVariant reply = iface.Property("value"); if (!reply.IsNull()) { Console.WriteLine("value = {0}",reply.ToString()); } } else if (line.StartsWith("value=")) { iface.SetProperty("value",new QVariant(line.Substring(6))); } else { QDBusReply <string> reply = new QDBusReply <string>(iface.Call("query",new QVariant(line))); if (reply.IsValid()) { Console.WriteLine("Reply was: {0}",reply.Value()); } } if (iface.LastError().IsValid()) { Console.Error.WriteLine("Call failed: {0}",iface.LastError().Message()); } } }
public void TestAboutToQuit() { var wasFired = false; _qCoreApp.AboutToQuit += () => wasFired = true; QCoreApplication.Quit(); Assert.IsTrue(wasFired); }
void HandleUnhandledException(object sender, UnhandledExceptionEventArgs args) { Exception ex = (Exception)args.ExceptionObject; Console.Error.WriteLine("UNHANDLED EXCEPTION: " + ex); string desktopPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop); string crashFileName = Path.Combine(desktopPath, String.Format("synapse-crash-{0}.log", DateTime.Now.ToFileTime())); string crashLog = args.ExceptionObject.ToString(); Util.WriteToFile(crashFileName, crashLog); // FIXME: Figure out how to show a damn error dialog. QCoreApplication.Quit(); }
public void Dispose() { // TODO: Add tear down code. QCoreApplication.Quit(); }