Esempio n. 1
0
        private void RequestHandler_OnBeforeBrowse(object sender, CfxOnBeforeBrowseEventArgs e)
        {
            if (!e.Frame.IsMain)
            {
                return;
            }

            var request = e.Request;

            switch (request.TransitionType)
            {
            case CfxTransitionType.Explicit:
                return;

            case CfxTransitionType.ClientRedirectFlag:
                e.SetReturnValue(true);
                _Dispatcher.Dispatch(() => OnClientReload?.Invoke(this, new ClientReloadArgs(request.Url)));
                break;

            default:
                e.SetReturnValue(true);
                _Logger.Error($@"Navigation to {request.Url} triggered by ""{request.TransitionType}"" has been cancelled. It is not possible to trigger a page loading from javascript that may corrupt session and hot-reload. Use Neutronium API to alter HTML view.");
                break;
            }
        }
 private void FireReload(string url = null)
 {
     _Dispatcher.Dispatch(() => OnClientReload?.Invoke(this, new ClientReloadArgs(url)));
 }