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);
            }
        }
        public void endRmlUpdate()
        {
            RocketEventListenerInstancer.resetEventController();

            //Find all custom controls and hook them up
            ElementDocument document = rocketWidget.Context.GetDocument(0);

            foreach (Element element in document.GetElementsByTagName("data"))
            {
                switch (element.GetAttributeString("type"))
                {
                case "volume":
                    dataDisplays.Add(new VolumeDisplay(element, context, rocketWidget));
                    break;

                case "measurement":
                    dataDisplays.Add(new MeasurementDisplay(element, context, rocketWidget));
                    break;

                default:
                    element.InnerRml = String.Format("Unknown data display type '{0}'", element.GetAttributeString("type"));
                    Logging.Log.Error("Could not create a display type for '{0}'", element.GetAttributeString("type"));
                    break;
                }
            }

            float height = 0.0f;

            foreach (var child in document.Children)
            {
                height += child.ScrollHeight;
            }
            widget.Height = (int)(height + 0.5f);
        }
Exemple #3
0
        public void setFile(String file)
        {
            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();
                }
            }
            RocketEventListenerInstancer.resetEventController();
        }