Closed mattkol closed 3 years ago
ReloadDemo.zip
class Program { [STAThread] static void Main(string[] args) { var config = DefaultConfiguration.CreateForRuntimePlatform(); config.StartUrl = "local://app/index.html"; AppBuilder .Create() .UseConfig<DefaultConfiguration>(config) .UseApp<DemoApp>() .Build() .Run(args); } } public class DemoApp : ChromelyBasicApp { public override void ConfigureServices(IServiceCollection services) { base.ConfigureServices(services); RegisterControllerAssembly(services, typeof(DemoApp).Assembly); } }
<a href="http://command.com//window/reload">Reload</a>
[ControllerProperty(Name = "WindowController")] public class WindowController : ChromelyController { private readonly IChromelyConfiguration _config; public WindowController(IChromelyConfiguration config) { _config = config; } [CommandAction(RouteKey = "/window/reload")] public void Reload(IDictionary<string, string> queryParameters) { var scriptExecutor = _config?.JavaScriptExecutor; if (scriptExecutor != null) { Xilium.CefGlue.CefBrowser browser = scriptExecutor.GetBrowser() as Xilium.CefGlue.CefBrowser; if (browser != null) { browser.GetMainFrame().LoadUrl("https://google.com"); } } } }
Before reload:
After reload:
ReloadDemo.zip
Before reload:![image](https://user-images.githubusercontent.com/18384207/130347193-4f1b5164-4863-4740-aefa-977575fadbf9.png)
After reload:![image](https://user-images.githubusercontent.com/18384207/130347005-e07a94e8-3c79-481c-ba07-5c279c04034e.png)