The delegate function to be executed on idle.
The delay in millisecond before executing the given callback.
This window to aid method chaining.
InputStream stream = ...; // A data provider. this.mainWindow.setIdleCommand(delegate(CommandArgs args){ // Use data. if (!stream.empty && stream.finished) { performStep(stream.next); } // Re-arm this callback and wait for more data. this.mainWindow.setIdleCommand(args.callback, 10_000); }, 10_000);
Caveats: The callback executed by this method is not asynchronous and could halt the GUI from processing events if it takes a long time to finish.
Set a callback to be executed after a delay and after processing all other events. The callback is executed only once and discarded. This is useful for refreshing the GUI at regular intervals when monitoring something or to schedule a future action.