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);
            }
        }
Ejemplo n.º 2
0
        public void showScreen(BuyScreens screen)
        {
            VirtualFilesystemResourceProvider resourceProvider = new VirtualFilesystemResourceProvider("BuyScreens");

            String file = String.Format("{0}/Index.rml", screen);

            if (resourceProvider.exists(file))
            {
                BuyScreen buyScreen = new BuyScreen(resourceProvider, controller.GUIManager);
                buyScreen.setFile(file);
                buyScreen.Hidden += (sender, e) =>
                {
                    openScreens.Remove(buyScreen);
                    buyScreen.Dispose();
                };
                buyScreen.show(0, 0);
                openScreens.Add(buyScreen);
            }
            else
            {
                MessageBox.show(String.Format("Cannot find buy screen '{0}'", file), "Missing Buy Screen File", MessageBoxStyle.IconError | MessageBoxStyle.Ok);
            }
        }