private void openRml() { VirtualFilesystemResourceProvider resourceProvider = new VirtualFilesystemResourceProvider("BuyScreens"); String file = "TaskMenuAd/Index.rml"; if (resourceProvider.exists(file)) { ResourceProviderRocketFSExtension resourceProviderRocketFSExtension = new ResourceProviderRocketFSExtension(resourceProvider); RocketInterface.Instance.SystemInterface.AddRootPath(resourceProvider.BackingLocation); RocketInterface.Instance.FileInterface.addExtension(resourceProviderRocketFSExtension); DelegateRocketEventController eventController = new DelegateRocketEventController(); eventController.addHandler("visitAnomalousPage", visitAnomalousPage); RocketEventListenerInstancer.setEventController(eventController); RocketWidgetInterface.clearAllCaches(); rocketWidget.Context.UnloadAllDocuments(); using (ElementDocument document = rocketWidget.Context.LoadDocument(resourceProvider.getFullFilePath(file))) { if (document != null) { document.Show(); rocketWidget.removeFocus(); rocketWidget.renderOnNextFrame(); adImage.setSize(adImage.Width, (int)document.OffsetHeight); rocketWidget.resized(); } } RocketEventListenerInstancer.resetEventController(); RocketInterface.Instance.FileInterface.removeExtension(resourceProviderRocketFSExtension); RocketInterface.Instance.SystemInterface.RemoveRootPath(resourceProvider.BackingLocation); } }