Beispiel #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // This is the path in the users non roaming application folder
            // (You may consider if this should be removed after use, or even remove the cache path, which is essentially incognito mode)
            RequestContext rc = new RequestContext(new RequestContextSettings()
            {
                CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"CefSharp\Cache")
            });

            // Register the handlers for this
            rc.RegisterSchemeHandlerFactory("https", AuthProtocolSchemeHandlerFactory.AuthAddress(_context), new AuthProtocolSchemeHandlerFactory(_app, _context));
            // rc.RegisterSchemeHandlerFactory("https", AuthProtocolSchemeHandlerFactory.FhirFacadeAddress(_context), new FhirFacadeProtocolSchemeHandlerFactory(_app, _context, () => { return new ComCare.FhirServer.Models.ComCareSystemService(Configuration()); }));
            rc.RegisterSchemeHandlerFactory("https", AuthProtocolSchemeHandlerFactory.FhirFacadeAddress(_context), new FhirProxyProtocolSchemeHandlerFactory(_app, _context, Globals.ApplicationSettings.FhirBaseUrl));

            _browser = new ChromiumWebBrowser("about:blank", rc)
            {
                Dock = DockStyle.Fill
            };
            panel2.Controls.Add(_browser);

            _browser.ConsoleMessage              += OnBrowserConsoleMessage;
            _browser.StatusMessage               += OnBrowserStatusMessage;
            _browser.TitleChanged                += OnBrowserTitleChanged;
            _browser.AddressChanged              += OnBrowserAddressChanged;
            _browser.LoadingStateChanged         += OnBrowserLoadingStateChanged;
            _browser.IsBrowserInitializedChanged += _browser_IsBrowserInitializedChanged;
            _browser.LoadError += _browser_LoadError;

            string bitness = Environment.Is64BitProcess ? "x64" : "x86";
            string version = $"Chromium: {Cef.ChromiumVersion}, CEF: {Cef.CefVersion}, Environment: {Cef.CefSharpVersion}";

            GetMdiParent().DisplayOutput(version);
        }
Beispiel #2
0
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);

            // dispose of the request context too
            _browser.RequestContext.RegisterSchemeHandlerFactory("https", AuthProtocolSchemeHandlerFactory.AuthAddress(_context), null);
            _browser.RequestContext.RegisterSchemeHandlerFactory("https", AuthProtocolSchemeHandlerFactory.FhirFacadeAddress(_context), null);
        }
Beispiel #3
0
 internal void LoadSmartApp(SmartApplicationDetails application, IFhirSmartAppContext context)
 {
     _app     = application;
     _context = context;
     _url     = $"{application.Url}?iss=https://{AuthProtocolSchemeHandlerFactory.FhirFacadeAddress(_context)}&launch={context.LaunchContext}";
 }