When QT application is minimized to tray, and you shutdown PC, onClosing event in QML code isn't triggered.
Is there any other way to catch the moment when the app is closing in this scenario?
Related
I'm implementing a simple hierarchical interface for a watchOS app, using pushController(withName: String, context: Any?) to add views onto the stack. When trying to test on a watchOS 3 device, my app will reset itself back to the root view controller, losing the navigation state, after a "sleep" event.
Is this expected behavior? I would expect the navigation state to reset if the app was purged from memory, but not after the screen goes to sleep.
Setting the app target to watchOS 3 and implementing the handle(_:) WKExtensionDelegate method (which I had not done, since the watchOS targets were generated under Xcode 7) seems to provide the behavior I expected.
I have a silverlight app running in a browser as part of an overall ASP.NET website. I'm doing some event logging from it (tracking some UI click events and such).
I have a WCF service set up to create DB log records, and obviously the Silverlight app is calling it asynchronously.
This all works just fine, until I try to fire off a call to the logging service at the tail end of the app life. That is, when the user clicks a certain button, the silverlight calls some javascript on the website to redirects to another page, so the silverlight app closes, and then only sometimes do the last logger calls get through.
I am assuming it has something to do with the shutdown procedure of silverlight, and that it is a timing issue whereby sometimes the WCF channel is still open and the message gets through, and sometimes the channel closes and the logging doesn't occur.
Regardless of whether or not the logging occurs, the callback never fires for this last logger call.
As part of the handler for the last closing click event, the silverlight app calls this:
System.Windows.Browser.HtmlPage.Window.Eval("ViewEmployersPageWithMenu();")
Which, as I understand it, will trigger an exit of the silverlight app as the browser is navigating away from it.
Just before doing this, I fire off a simple logger call to my async wCF service.
I believe silverlight doesn't allow async service calls during its exit handling, is this the case? If there a different way I should be handling this o get that log call out successfully before the app closes?
If the logging is that important and considered an integral part of the application, you could hold off on calling the JavaScript function until the callback of the logging request. It may cause some delay in the execution of the redirect as it is now waiting for the WCF request to round-trip, but perhaps that is preferred to missing the log.
If you can replicate the issue, I would be curious to how Fiddler sees the series of requests (logging request and redirect request) when it works compared to when it does not. That may show that the browser is canceling the log request when it executes the redirect.
Is there a way to do a "wait()" on the javafx thread that pauses the execution of a method until a background task finishes but allowing the javafx thread to continue.
I have found a propietary method to do something like this
Toolkit.getToolkit().enterNestedEventLoop(key);
and
Toolkit.getToolkit().exitNestedEventLoop(key, value);
Imagine that you have an #FXML action method when the user clicks a button and inside that method (running on the FX Thread) I want to do the following:
1 get a value from a javafx observable property
2 disable an area of the screen and display a progress indicator
3 call a long running task on a server and stop the excution of the action method here without blocking the UI (or in other words, letting the user navigate to another screen while the background task runs)
4 continue here on the fx thread reenabling the ui and hiding the progress indicator
5 update the UI with values returned from the server.
I know one can use a javafx Task to achieve a similar thing, but that would require moving 4 and 5 to the suceeded() method of the javafx task and that is not what i want.
We've got a framework which allows the developer to annotate some of the remote service stubs on a javafx controller with a #Background annotation and replaces those stubs with a jdk dynamic proxy which switches all invocations to any method in the stubs to run on a non javafx thread and continue on 4 when the server call has finished so we don't have to fill up our code with javafx thread synchronization code.
The Toolkit.getToolkit().enterNestedEventLoop(key); and Toolkit.getToolkit().exitNestedEventLoop(key, value); work well in most cases, except in some scenarios like:
if the invocation happens on the javafx thread at application startup time (prepopulating a screen with server data on startup)
if a #FXML action method has two server calls in the same method
{using Qt 4.7.0, Windows Xp, Visual Studio 2005}
hi, i've develope a Qt console project to implement a protocol which is up and running on the intended product for quite sometime now. But recently a problem has come up. The application is never meant to shutdown so there is nothing to quit it from inside the application. What it does is it implements a new thread for each client connection on the developed protocol and when the client disconnects, it ends the thread and continues polling for new connections, which is all fine. Now when the tester runs it in debug mode the console window pops up showing the logs of the ongoing activities. The problem is when this console window is manually closed it gives an error the instruction at 0xwhatever referenced memory at 0xwhatever which could not be read. Click Ok to terminate. I've identified this problem and it comes because one of the shutdown functions is not called.
How do i call this custom shutdown function whenever the application is closed in such a way? (by the way, if one "ends process" in the task manager this problem does not pop up and that's why the release mode shutdowns are always fine as they don't pop up a console window and only way to do is is through task manager)
p.s: i have tried using QCoreApplication's aboutToQuit() signal to call a custom slot which calls the shutdown functions indicated above. This does not seem to work. I don't know if the signal is fired up in such application shutdown events.
NativeApplication.nativeApplication.exit(); - this method is used for exit the application of flex/air .
application.close(); - this method also used for exit the application of flex/air -
So what is different?
He is referring to NativeApplication.exit() vs WindowedApplication.close().
WindowedApplication.close() Closes the
application's NativeWindow (the
initial native window opened by the
application). This action is
cancelable.
Calling close() on the application window will effectively shut down the application, but using the exit() method on NativeApplication is the proper way to terminate it. See the following link for more info:
http://livedocs.adobe.com/flex/3/html/help.html?content=app_launch_1.html
I am not sure I am understanding your question entirely because I am not finding an application.close() method.
Here is the documentation on NativeApplication, an AIR only class: http://livedocs.adobe.com/flex/3/langref/flash/desktop/NativeApplication.html#exit()
It defines the exit method like this:
Terminates this application.
The call to the exit() method will
return; the shutdown sequence does not
begin until the currently executing
code (such as a current event handler)
has completed. Pending asynchronous
operations are canceled and may or may
not complete.
Note that an exiting event is not
dispatched. If an exiting event is
required by application logic, call
NativeApplication.nativeApplication.dispatchEvent(),
passing in an Event object of type
exiting. Likewise, closing and close
events are not dispatched before
application windows are closed. If
windows should be notified before your
application exits, you can dispatch
closing events for each open window.
If a window close event is required,
call the window's close() method
before exiting.
Here is the documetation on Application, a Flex class: http://livedocs.adobe.com/flex/3/langref/mx/core/Application.html#methodSummary
It does not seem to have a close() method associated with it. Are you possibly confusing the application class with a window class that you need to close before calling the NativeApplication.nativeApplication.exit() ?
I would be happy to help you research this further if you can clarify the question.
One completely exits the application, the other only closes the main window. It's important to understand the difference. On a Mac, for instance, closing all of an application's windows often leaves that application running in the dock. This is rarely the case on Windows, but if you have a dock icon, you should get similar behavior, I think.