public static CefOptions GetCefOptions(this IAppFrame frame, FrameOptions options, FrameOptions oldOptions = null, object injectObj = null) { var cefOptions = new CefOptions { ContentPath = options.ContentPath, InjectObjName = injectObj == null ? null : GlobalConfig.AppOptions.InjectObjName, GetInjectObj = () => injectObj }; if (oldOptions == null) { cefOptions.JsDialogHandler = new CefJsDialogHandler(frame); } //todo cef加载完成后,handler不可改 //因draggable是可改选项,所以要加上这个判断,以减少创建CefDragHandler实例数,满足此条件代表之前的窗口没有设置过 if ((oldOptions == null || !oldOptions.Draggable) && options.Draggable) { cefOptions.DragHandler = new CefDragHandler(frame); } if (options.IsMain == true) { cefOptions.KeyboardHandler = new CefKeyboardHandler(); } return(cefOptions); }
public FrameMiddleware(ILoggerFactory factory, IAppFrame mainFrame) { _logger = factory.CreateLogger(this.GetType()); _mainFrame = mainFrame; framesMapper = new ConcurrentDictionary <string, IAppFrame>(); }
private IAppFrame GetFrameById(string frameId) { IAppFrame frame = _mainFrame; if (!string.IsNullOrEmpty(frameId) && GlobalConfig.AppOptions.MainFrameId != frameId) { framesMapper.TryGetValue(frameId, out frame); } return(frame); }
private void Close(AppRequest request) { request.Frame.BeforeCloing(); var hideToTray = true; if (request.Data != null && request.Data.Count > 0) { hideToTray = request.Data.Value <bool>("hideToTray"); } IAppFrame frame = null; request.Frame.CloseFrame(hideToTray ? CloseTypes.Hide2Tray : CloseTypes.CloseSelf); this.framesMapper.TryRemove(request.FrameId, out frame); }
public CefJsDialogHandler(IAppFrame target) { this._targetForm = target; }
public CefDragHandler(IAppFrame target) { this._targetForm = target; }