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);
            }
        }
Esempio n. 2
0
        public BuyScreen(ResourceProvider resourceProvider, GUIManager guiManager)
            : base("Medical.GUI.BuyScreen.BuyScreen.layout", guiManager)
        {
            eventController = new DelegateRocketEventController();
            eventController.addHandler("close", evt => this.hide());
            eventController.addHandler("visitAnomalousPage", visitAnomalousPage);

            this.resourceProvider = resourceProvider;

            resourceProviderRocketFSExtension = new ResourceProviderRocketFSExtension(resourceProvider);
            RocketInterface.Instance.SystemInterface.AddRootPath(resourceProvider.BackingLocation);
            RocketInterface.Instance.FileInterface.addExtension(resourceProviderRocketFSExtension);

            rmlImage     = (ImageBox)widget.findWidget("RmlImage");
            rocketWidget = new RocketWidget(rmlImage, true);
        }