Example #1
0
 /// <summary>
 /// 从HostControl中获得指定类型的视图对象
 /// </summary>
 /// <typeparam name="T">视图类型</typeparam>
 /// <param name="context">上下文环境</param>
 /// <param name="result">返回结果</param>
 /// <param name="name">视图名称(视图变量名)</param>
 /// <returns>当视图类型和视图变量名两个条件都满足时,返回true</returns>
 protected BaseView GetTargetView(GridControlViewStateContext <E> context, string name)
 {
     for (int index = 0; index < context.HostControl.ViewCollection.Count; index++)
     {
         if (context.HostControl.ViewCollection[index].Name.Equals(name, StringComparison.OrdinalIgnoreCase))
         {
             return(context.HostControl.ViewCollection[index]);
         }
     }
     return(null);
 }
Example #2
0
 protected bool ExtractTagetView(GridControlViewStateContext <E> context, string name)
 {
     for (int index = 0; index < context.HostControl.ViewCollection.Count; index++)
     {
         if (context.HostControl.ViewCollection[index].Name.Equals(name, StringComparison.OrdinalIgnoreCase))
         {
             TargetView = (V)context.HostControl.ViewCollection[index];
             return(true);
         }
     }
     return(false);
 }
Example #3
0
 public override void OnShiftState(GridControlViewStateContext <E> context)
 {
     if (IsContextTargetState(context) == false)
     {
         context.CurrentStateComponent = GetNextStateComponet();
         context.ExecuteStateShift();
     }
     else
     {
         onSaveContextProperties(context.Properties);
         onPrepareMainViewUpdate(context);
         TargetViewName = onGetCurrentViewName(context.Properties);
         if (IsMainViewTarget(context, TargetViewName) == false)
         {
             if (ExtractTagetView(context, TargetViewName) && this.TargetView != null)
             {
                 onBeforeMainViewUpdate(context);
                 context.HostControl.MainView = TargetView;
                 onAfterMainViewUpdate(context);
                 context.Properties.IsStateFirstLoad[GetCurrentState()] = false;
             }
         }
         else
         {
             if (context.Properties.IsStateFirstLoad[GetCurrentState()])
             {
                 if (ExtractTagetView(context, TargetViewName) && this.TargetView != null)
                 {
                     onBeforeMainViewUpdate(context);
                     context.HostControl.MainView = TargetView;
                     onAfterMainViewUpdate(context);
                     context.Properties.IsStateFirstLoad[GetCurrentState()] = false;
                 }
             }
         }
     }
 }
Example #4
0
 public virtual bool IsContextTargetState(GridControlViewStateContext <E> context)
 {
     return(context.CurrentState.Equals(GetCurrentState()));
 }
Example #5
0
 public virtual void onPrepareMainViewUpdate(GridControlViewStateContext <E> context)
 {
 }
Example #6
0
 public abstract void onAfterMainViewUpdate(GridControlViewStateContext <E> context);
Example #7
0
 /// <summary>
 /// 判断指定视图是否是当前gridControl的主视图
 /// </summary>
 /// <typeparam name="T">视图类型</typeparam>
 /// <param name="context">上下文环境</param>
 /// <param name="name">视图名称(视图变量名)</param>
 /// <returns></returns>
 protected bool IsMainViewTarget(GridControlViewStateContext <E> context, string name)
 {
     return(context.HostControl.MainView.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
 }
Example #8
0
 public override void onPrepareMainViewUpdate(GridControlViewStateContext <E> context)
 {
     base.onPrepareMainViewUpdate(context);
     TargetBuilder    = ConvertToTargetBuilder <B>();
     TargetProperties = ConvertToTargetProperties <P>();
 }
Example #9
0
 public abstract void OnShiftState(GridControlViewStateContext <E> context);