public VisualElementPluginExtension(
            VisualElementGeneric parent,
            TreeViewLineCache cache,
            AdminShellPackageEnv package,
            AdminShell.Referable referable,
            Plugins.PluginInstance plugin,
            AasxIntegrationBase.AasxPluginResultVisualExtension ext)
            : base()
        {
            this.Parent       = parent;
            this.Cache        = cache;
            this.thePackage   = package;
            this.theReferable = referable;
            this.thePlugin    = plugin;
            this.theExt       = ext;

            this.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#A0A0A0"));
            this.Border     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#707070"));
            this.TagBg      = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"];
            this.TagFg      = Brushes.White;

            this.TagString = "" + ext?.Tag;

            RefreshFromMainData();
            RestoreFromCache();
        }
Example #2
0
        //==================

        public void Start(string startUrl, bool useAlwaysInternalBrowser, bool useOffscreen = false)
        {
#if WITHFAKEBROWSER
            this.theBrowser = new FakeBrowser();
            GoToContentBrowserAddress(startUrl);
#endif

#if WITHCEF
            if (!useOffscreen)
            {
                this.theOnscreenBrowser = new CefSharp.Wpf.ChromiumWebBrowser();
                GoToContentBrowserAddress(startUrl);
            }
#endif

#if WITHBROWSERPLUGIN
            // due to the nature of the plug-in, this forms as SINGLETON
            if (BrowserContainer.browserPlugin != null && BrowserContainer.theOnscreenBrowser != null)
            {
                // always fine
                return;
            }

            var pluginName = "AasxPluginWebBrowser";
            var actionName = "get-browser-grid";
            BrowserContainer.browserPlugin = Plugins.FindPluginInstance(pluginName);

            if (BrowserContainer.browserPlugin == null || !BrowserContainer.browserPlugin.HasAction(actionName))
            {
                // ok, fallback
                BrowserContainer.browserPlugin      = null;
                BrowserContainer.theOnscreenBrowser = null;

                this.theFallbackBrowser  = new FakeBrowser();
                this.browserHandlesFiles = fallbackBrowserHandlesFiles;
                GoToContentBrowserAddress(startUrl);
            }
            else
            {
                // setup
                var res = BrowserContainer.browserPlugin.InvokeAction(actionName, startUrl);
                if (res != null && res is AasxPluginResultBaseObject)
                {
                    BrowserContainer.theOnscreenBrowser = (res as AasxPluginResultBaseObject).obj as Grid;
                }
            }
#endif

            this.useAlwaysInternalBrowser = useAlwaysInternalBrowser;
            this.useOffscreen             = useOffscreen;
        }