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 RmlWidgetComponent(RmlView view, AnomalousMvcContext context, MyGUIViewHost viewHost)
            : base("Medical.GUI.AnomalousMvc.RmlView.RmlWidgetComponent.layout", viewHost)
        {
            this.context         = context;
            this.eventController = view.createRocketEventController(context, viewHost);

            rmlImage     = (ImageBox)widget;
            rocketWidget = new RocketWidget(rmlImage, viewHost.View.Transparent, false);
            imageHeight  = widget.Height;
            imageWidth   = widget.Width;

            if (view.RmlFile != null)
            {
                startRmlUpdate();
                if (view.RmlFile != null)
                {
                    rocketWidget.Context.ZoomLevel = view.ZoomLevel;
                    documentName = RocketInterface.createValidFileUrl(context.ResourceProvider.getFullFilePath(view.RmlFile));
                    using (ElementDocument document = rocketWidget.Context.LoadDocument(documentName))
                    {
                        if (document != null)
                        {
                            document.Show();
                            rocketWidget.removeFocus();
                            rocketWidget.renderOnNextFrame();
                        }
                    }
                }
                endRmlUpdate();
            }

            view._fireComponentCreated(this);
        }
Ejemplo n.º 3
0
 void ICmpInitializable.OnInit(InitContext context)
 {
     if (context == InitContext.Activate && DualityApp.ExecEnvironment == DualityApp.ExecutionEnvironment.Launcher)
     {
         _document = GuiCore.Context.LoadDocument(DocumentPath);
         _document.Show();
     }
 }
Ejemplo n.º 4
0
 public void OnInit(InitContext context)
 {
     if (context == InitContext.Activate)
     {
         if (GuiCore.Context != null && _document == null && Filename != null)
         {
             _document = GuiCore.Context.LoadDocument(Filename);
             _document?.Show();
         }
     }
 }
        private bool setDocumentRml(String rml, bool maintainScrollPosition)
        {
            float   scrollLeft = 0.0f;
            float   scrollTop  = 0.0f;
            Element topContentElement;

            if (maintainScrollPosition)
            {
                topContentElement = TopContentElement;
                if (topContentElement != null)
                {
                    scrollLeft = topContentElement.ScrollLeft;
                    scrollTop  = topContentElement.ScrollTop;
                }
            }

            RocketWidgetInterface.clearAllCaches();
            rocketWidget.Context.UnloadAllDocuments();
            cancelAndHideEditor();
            selectedElementManager.clearSelectedAndHighlightedElement();

            if (rml != null)
            {
                using (ElementDocument document = rocketWidget.Context.LoadDocumentFromMemory(rml, FakeLoadLocation))
                {
                    if (document != null)
                    {
                        saveDocumentStartAndEnd(rml);
                        document.Show();
                        rocketWidget.removeFocus();
                        rocketWidget.renderOnNextFrame();

                        if (maintainScrollPosition)
                        {
                            topContentElement = TopContentElement;
                            if (topContentElement != null)
                            {
                                topContentElement.ScrollLeft = scrollLeft;
                                topContentElement.ScrollTop  = scrollTop;
                            }
                        }

                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 6
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();
        }
Ejemplo n.º 7
0
        public RocketWindow()
            : base("Anomalous.Minimus.Full.GUI.RocketWindow.RocketWindow.layout")
        {
            RocketInterface.Instance.FileInterface.addExtension(new RocketAssemblyResourceLoader(typeof(RocketWindow).Assembly));

            rocketWidget = new RocketWidget(window.findWidget("Image") as ImageBox, false);
            //rocketWidget.Context.LoadDocument ("~/Phoneworld_droid.GUI.RocketWindow.TestRml.rml");

            RocketWidgetInterface.clearAllCaches();
            rocketWidget.Context.UnloadAllDocuments();
            using (ElementDocument document = rocketWidget.Context.LoadDocumentFromMemory(testRml))
            {
                if (document != null)
                {
                    document.Show();
                    rocketWidget.removeFocus();
                    rocketWidget.renderOnNextFrame();
                }
            }

            window.WindowChangedCoord += HandleWindowChangedCoord;
        }
Ejemplo n.º 8
0
        public SceneErrorWindow(GUIManager guiManager)
            : base("Medical.GUI.SceneErrorWindow.SceneErrorWindow.layout")
        {
            rmlImage     = (ImageBox)window.findWidget("RmlImage");
            rocketWidget = new RocketWidget(rmlImage, false);

            window.WindowChangedCoord += window_WindowChangedCoord;
            this.guiManager            = guiManager;
            guiManager.addManagedDialog(this);
            guiManager.autoDisposeDialog(this);

            rocketWidget.Context.UnloadAllDocuments();

            StringBuilder htmlString = new StringBuilder();

            htmlString.Append(DocumentStart);

            foreach (var error in SimObjectErrorManager.Errors)
            {
                htmlString.AppendFormat(ErrorLine, error.Subsystem, error.SimObject, error.Type, error.ElementName, error.Message);
            }

            htmlString.Append(DocumentEnd);

            var resourceLoader = new RocketAssemblyResourceLoader(this.GetType().Assembly);

            RocketInterface.Instance.FileInterface.addExtension(resourceLoader);
            using (ElementDocument document = rocketWidget.Context.LoadDocumentFromMemory(htmlString.ToString()))
            {
                if (document != null)
                {
                    document.Show();
                    rocketWidget.removeFocus();
                    rocketWidget.renderOnNextFrame();
                }
            }
            RocketInterface.Instance.FileInterface.removeExtension(resourceLoader);
        }
Ejemplo n.º 9
0
        public void reloadDocument()
        {
            if (rocketWidget != null)
            {
                RocketWidgetInterface.clearAllCaches();

                rocketWidget.Context.UnloadAllDocuments();

                if (documentName != null)
                {
                    startRmlUpdate();
                    using (ElementDocument document = loadDocument())
                    {
                        if (document != null)
                        {
                            document.Show();
                            rocketWidget.removeFocus();
                            rocketWidget.renderOnNextFrame();
                        }
                    }
                    endRmlUpdate();
                }
            }
        }
Ejemplo n.º 10
0
 public override void LoadContent()
 {
     _document =  _service.Context.LoadDocument(Properties.Settings.Default.GuiDocument);
     _document.Show(ElementDocument.FocusFlags.None);
     base.LoadContent();
 }