public void AddRange(IViewHandler[] value) { if (value == null) { throw new ArgumentNullException ("Value null"); } arrayList.AddRange (value); }
internal ComponentActionDispatcher(IComponentModel componentModel, MethodInfo methodToExecute, object[] parameters, IViewHandler viewHandler, MethodInfo methodToResponse) { this.componentModel = componentModel; this.methodToExecute = methodToExecute; this.parameters = parameters; this.viewHandler = viewHandler; this.methodToResponse = methodToResponse; threadStart = new ThreadStart (CallBackExecuteRedirectView); thread = new Thread (threadStart); }
/// <summary> /// Registers a view handler /// </summary> /// <param name="handler">Handler to register</param> /// <param name="viewHandlerId">Optional ID, so the handler can later be re-identified if needed</param> /// <param name="replaceHandlersWithMatchingId">If true (default) then current registered handlers with identical ID will be replaced</param> /// <remarks>Document handlers are objects that are given a chance to handle views when they need launching.</remarks> public static void RegisterViewHandler(IViewHandler handler, string viewHandlerId = "", bool replaceHandlersWithMatchingId = true) { if (string.IsNullOrEmpty(viewHandlerId)) viewHandlerId = Guid.NewGuid().ToString(); if (_viewHandlers == null) _viewHandlers = new Dictionary<string, IViewHandler>(); if (_viewHandlers.ContainsKey(viewHandlerId)) { if (replaceHandlersWithMatchingId) _viewHandlers[viewHandlerId] = handler; } else _viewHandlers.Add(viewHandlerId, handler); }
/// <summary> /// 创建 PartialRenderAdapter 实例 /// </summary> /// <param name="urlHelper">用于产生 URL 的 URL 帮助器</param> /// <param name="viewContext">当前视图上下文</param> /// <param name="viewHandler">当前视图处理程序</param> public PartialViewAdapter( ViewContext viewContext, JumonyUrlHelper urlHelper, IViewHandler viewHandler ) : base( viewContext.HttpContext, viewHandler ) { if ( viewContext == null ) throw new ArgumentNullException( "viewContext" ); if ( urlHelper == null ) throw new ArgumentNullException( "urlHelper" ); if ( viewHandler == null ) throw new ArgumentNullException( "viewHandler" ); ViewContext = viewContext; ViewHandler = viewHandler; Url = urlHelper; }
/// <summary> /// 创建 PartialRenderAdapter 实例 /// </summary> /// <param name="view">需要渲染部分视图的宿主视图</param> public PartialRenderAdapter( ViewContext viewContext, JumonyUrlHelper urlHelper, IViewHandler viewHandler ) { if ( viewContext == null ) throw new ArgumentNullException( "viewContext" ); if ( urlHelper == null ) throw new ArgumentNullException( "urlHelper" ); if ( viewHandler == null ) throw new ArgumentNullException( "viewHandler" ); ViewContext = viewContext; ViewHandler = viewHandler; Url = urlHelper; var wrapper = viewHandler as IHandlerWrapper; if ( wrapper != null ) _partialExecutors = GetPartialExecutors( wrapper.Handler.GetType() ); else _partialExecutors = GetPartialExecutors( viewHandler.GetType() ); }
/// <summary>Closes the view associated with the provided model.</summary> /// <param name="model">Model associated with the view that is to be closed</param> /// <remarks>This only works if the model is only used with a single view. This will not work (or work unpredictably) for models that are shared across views.</remarks> public static void CloseViewForModel(object model) { if (_viewHandlers == null) return; var handlers = new IViewHandler[_viewHandlers.Values.Count]; _viewHandlers.Values.CopyTo(handlers, 0); foreach (var handler in handlers) handler.CloseViewForModel(model); }
public static void MapShadowProperty(IViewHandler viewHandler, View virtualView) { var control = viewHandler as SkiaControl; control.SetEnvironment(EnvironmentKeys.View.Shadow, virtualView.GetShadow(), false); }
public static void MapOverlayProperty(IViewHandler viewHandler, View virtualView) { var control = viewHandler as SkiaControl; control.Overlay(virtualView.GetOverlay()); }
public static void Redraw(IViewHandler viewHandler, View virtualView) { var control = viewHandler as SkiaControl; control.Invalidate(); }
public static void MapColorProperty(IViewHandler viewHandler, View virtualView) { var control = viewHandler as SkiaControl; control.Color(virtualView.GetColor(Color.Transparent)); }
public bool Contains(IViewHandler value) { return arrayList.Contains (value); }
public static void MapBackgroundColor(IViewHandler handler, IView view) { (handler.NativeView as NativeView)?.UpdateBackgroundColor(view); }
/// <summary> /// Removes a view handler from this binding /// </summary> public void RemoveHandler(IViewHandler handler) { _handlers.Remove(handler); if (_handlers.Count == 0 && _bindingEmpty != null) { _bindingEmpty (this); } }
public int IndexOf(IViewHandler value) { return arrayList.IndexOf (value); }
public static NativeView?GetWrappedNativeView(this IViewHandler viewHandler) => (NativeView?)(viewHandler.ContainerView ?? viewHandler.NativeView);
public ResponseMethodDTO Execute(string methodName, object[] parameters, IViewHandler viewHandler) { return this.Execute (methodName, parameters, true, viewHandler, true); }
public static void MapColorProperty(IViewHandler viewHandler, Text virtualView) { }
public void Remove(IViewHandler value) { arrayList.Remove (value); }
private void bindViewHandler(IViewHandler handler) { unbindViewHandler(); this.viewHandler = handler; this.viewHandler.NextPageDisplay += viewHandler_NextPageDisplay; this.viewHandler.PreviousPageDisplay += viewHandler_PreviousPageDisplay; this.viewHandler.Display += viewHandler_Display; }
public void Insert(int index, IViewHandler value) { arrayList.Insert (index, value); }
public static void MapFrame(IViewHandler handler, IView view) { handler.SetFrame(view.Frame); }
public void RemoveViewHandler(IViewHandler handler) { _handlers.Remove(handler); foreach(object container in _containers) { _registry.GetBinding(container).RemoveHandler(handler); } if (_handlerRemove != null) { _handlerRemove (handler); } }
public int Add(IViewHandler value) { return arrayList.Add (value); }
private ResponseMethodDTO ExecuteRedirectView(MethodInfo methodToExecute, object[] parameters, IViewHandler viewHandler, MethodInfo methodToResponse) { ResponseMethodDTO responseMethodDTO = (ResponseMethodDTO) FactoryDTO.Instance.Create (CreateDTO.ResponseMethod); try { object ret = methodToExecute.Invoke (this, parameters); responseMethodDTO.MethodResult = ret; responseMethodDTO.SetExecutionSuccess (true); if (VirtualMethod != null) { VirtualMethod (responseMethodDTO); VirtualMethod = null; } //Beta Implementation // if (!ViewHandlerCollection.Contains (viewHandler)) { ViewHandlerCollection.Add (viewHandler); logger.Debug ("A new view has been added to View Cache"); } else { logger.Debug ("This view has already been registered at View Cache."); } // //End methodToResponse.Invoke (viewHandler, new object[] {responseMethodDTO}); } catch (TargetInvocationException exception) { this.MapException (exception); } return responseMethodDTO; }
public static void MapDrawable(IViewHandler handler, IGraphicsView graphicsView) { }
/// <summary> /// 获取 HTML 渲染代理 /// </summary> /// <remarks> /// 默认的渲染代理包含一个: /// 1. 部分视图渲染代理,处理 <partial> 标签 /// </remarks> /// <returns>HTML 渲染代理列表</returns> public virtual IList<IHtmlRenderAdapter> GetRenderAdapters( IViewHandler handler ) { var result = new List<IHtmlRenderAdapter>() { new PartialViewAdapter( ViewContext, Url, handler ), }; var customRenderAdapters = handler as ICustomRenderAdapters; if ( customRenderAdapters != null ) result.AddRange( customRenderAdapters.GetCustomRenderAdapters() ); return result; }
public static void MapPoints(IViewHandler handler, Polyline polygon) { }
public static void MapText(IViewHandler handler, ILabel label) { }
public static void MapContentProperty(IViewHandler viewHandler, ContentView virtualView) { var nativeView = (BView)viewHandler.NativeView; nativeView.View = virtualView.Content; }
public static void MapIsEnabled(IViewHandler handler, IView view) { (handler.NativeView as NativeView)?.UpdateIsEnabled(view); }
public static void MapTextProperty(IViewHandler viewHandler, Button virtualButton) { var nativeButton = (WPFButton)viewHandler.NativeView; nativeButton.Content = virtualButton.Text; }
public static void MapAutomationId(IViewHandler handler, IView view) { (handler.NativeView as NativeView)?.UpdateAutomationId(view); }
public void AddHandler(IViewHandler handler) { _handlers.Add(handler); }
public static void MapBackgroundColor(IViewHandler viewHandler, View virtualView) { var control = viewHandler as SkiaControl; control.Background(virtualView.GetBackgroundColor(Color.Transparent)); }
public static void MapTextColor(IViewHandler handler, IEntry entry) { }
public static void MapBorderProperty(IViewHandler viewHandler, View virtualView) { var control = viewHandler as SkiaControl; control.Border(virtualView.GetBorder()); }
public static void MapIsPassword(IViewHandler handler, IEntry entry) { }
public static void MapClipShapeProperty(IViewHandler viewHandler, View virtualView) { var control = viewHandler as SkiaControl; control.ClipShape(virtualView.GetClipShape()); }
public static void MapHorizontalTextAlignment(IViewHandler handler, IEntry entry) { }
public static void MapAnchorY(IViewHandler handler, IView view) { handler.GetWrappedNativeView()?.UpdateTransformation(view); }
public static void MapIsTextPredictionEnabled(IViewHandler handler, IEntry entry) { }
/// <summary> /// Closes all currently open views. /// </summary> public static void CloseAllViews() { if (_viewHandlers == null) return; var handlers = new IViewHandler[_viewHandlers.Values.Count]; _viewHandlers.Values.CopyTo(handlers, 0); foreach (var handler in handlers) handler.CloseAllViews(); }
public static void MapFont(IViewHandler handler, IEntry entry) { }
public void AddViewHandler(IViewHandler handler) { if (_handlers.Contains(handler)) return; _handlers.Add(handler); // Add new handler to our containers if (_fallbackContainer != null) { _registry.GetBinding (_fallbackContainer).AddHandler (handler); } else { foreach (object container in _containers) { _registry.AddContainer (container).AddHandler (handler); } } if (_handlerAdd != null) { _handlerAdd (handler); } }
public static void MapReturnType(IViewHandler handler, IEntry entry) { }
/*Servicio ejecutor*/ public ResponseMethodDTO Execute(string componentName, string methodName, object[] parameters, bool redirect, IViewHandler viewHandler, bool block) { IComponentModel componentModel = this.GetComponentByName (componentName); return componentModel.Execute (methodName, parameters, redirect, viewHandler, block); }
public static void MapClearButtonVisibility(IViewHandler handler, IEntry entry) { }
/*Executor commander !*/ public ResponseMethodDTO Execute(string methodName, object[] parameters, bool redirect, IViewHandler viewHandler, bool block) { /*Existen cosas que siempre deben de buscarse*/ MethodInfo methodToExecute = this.GetMethodToExecute (methodName, parameters); ComponentMethodAttribute componentMethodAttribute = this.GetComponentAttributes (methodToExecute); /*Primero discernimos si es bloqueante o no lo es*/ if (block) { //Operaciones que son bloqueantes if (redirect) { MethodInfo methodToResponse ; Type viewType; if (viewHandler == null) { //FIX: Aún se podria mejorar esta invocación. viewType = this.GetViewType (componentMethodAttribute); methodToResponse = this.GetMethodToResponse (viewType, componentMethodAttribute); return ExecuteRedirectNewView (methodToExecute, parameters, viewType, methodToResponse); } else { //Redirigimos a la que nos pide viewType = viewHandler.GetType (); methodToResponse = this.GetMethodToResponse (viewType, componentMethodAttribute); return ExecuteRedirectView (methodToExecute, parameters, viewHandler, methodToResponse); } } else { //No necesitamos información sobre la vista, ni el response. //No se va a ejecutar. return ExecuteNoRedirect (methodToExecute, parameters); } } else { ComponentActionDispatcher componentActionDispatcher; //Operaciones bloqueantes, envolver en un hilo if (redirect) { MethodInfo methodToResponse; Type viewType; if (viewHandler == null) { //Exception handling ¿¿ viewType = this.GetViewType (componentMethodAttribute); methodToResponse = this.GetMethodToResponse (viewType, componentMethodAttribute); componentActionDispatcher = new ComponentActionDispatcher (this, methodToExecute, parameters, viewType, methodToResponse); try { componentActionDispatcher.Do (); } catch (TargetInvocationException exception) { this.MapException (exception); } return componentActionDispatcher.ResponseMethodDTO; } else { viewType = viewHandler.GetType (); methodToResponse = this.GetMethodToResponse (viewType, componentMethodAttribute); componentActionDispatcher = new ComponentActionDispatcher (this, methodToExecute, parameters, viewHandler, methodToResponse); try { componentActionDispatcher.Do (); } catch (TargetInvocationException exception) { this.MapException (exception); } return componentActionDispatcher.ResponseMethodDTO; } } else { componentActionDispatcher = new ComponentActionDispatcher (this, methodToExecute, parameters); try { componentActionDispatcher.Do (); } catch (TargetInvocationException exception) { this.MapException (exception); } return componentActionDispatcher.ResponseMethodDTO; } } //return null; }
public static void MapCharacterSpacing(IViewHandler handler, IEntry entry) { }
/*============================================================================*/ /* Public Functions */ /*============================================================================*/ /// <summary> /// Adds a view handler to this binding /// </summary> /// <param name="handler">Handler.</param> public void AddHandler(IViewHandler handler) { if (_handlers.Contains (handler)) return; _handlers.Add(handler); }
public static void MapKeyboard(IViewHandler handler, IEntry entry) { }
public HandlerToRendererShim(IViewHandler vh) { ViewHandler = vh; }
public static void MapCharacterSpacing(IViewHandler handler, ILabel label) { }
/// <summary> /// 处理 HTML 文档 /// </summary> protected virtual void ProcessScope( IViewHandler handler ) { handler.ProcessScope( CreateViewContext(), Scope, Url ); }
public void CopyTo(IViewHandler[] array, int index) { arrayList.CopyTo (array, index); }