Ejemplo n.º 1
0
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();
            var columnViewEditor = View.Editor as IColumnViewEditor;

            if (columnViewEditor != null)
            {
                SyncronizeDataSourceWithCriteria(columnViewEditor);
                if (IsMasterDetail())
                {
                    var masterDetailColumnView = (IMasterDetailColumnView)(columnViewEditor).ColumnView;
                    Frame.GetController <ShowNavigationItemController>().ShowNavigationItemAction.Executing += ShowNavigationItemActionOnExecuting;
                    var grid = columnViewEditor.Grid;
                    grid.ViewRegistered += Grid_ViewRegistered;
                    grid.ViewRemoved    += Grid_ViewRemoved;
                    masterDetailColumnView.MasterRowGetRelationCount          += ViewOnMasterRowGetRelationCount;
                    masterDetailColumnView.MasterRowGetRelationName           += ViewOnMasterRowGetRelationName;
                    masterDetailColumnView.MasterRowGetRelationDisplayCaption += MasterRowGetRelationDisplayCaption;
                    masterDetailColumnView.MasterRowGetChildList        += ViewOnMasterRowGetChildList;
                    masterDetailColumnView.MasterRowEmpty               += ViewOnMasterRowEmpty;
                    masterDetailColumnView.MasterRowGetLevelDefaultView += ViewOnMasterRowGetLevelDefaultView;
                    masterDetailColumnView.MasterRowCollapsing          += GridViewOnMasterRowCollapsing;
                    grid.FocusedViewChanged += GridOnFocusedViewChanged;
                }
            }
        }
Ejemplo n.º 2
0
 MasterDetailRuleInfo GetRule(int index, object currentObject, Frame frame)
 {
     if (currentObject != null)
     {
         var masterDetailRuleInfos = FilterRules(currentObject, frame);
         return(masterDetailRuleInfos.Count >= index + 1 ? masterDetailRuleInfos[index] : null);
     }
     return(null);
 }
Ejemplo n.º 3
0
        protected override void OnDeactivated()
        {
            base.OnDeactivated();
            Frame.GetController <ShowNavigationItemController>().ShowNavigationItemAction.Executing -= ShowNavigationItemActionOnExecuting;
            var editor = View.Editor as WinColumnsListEditor;

            if (editor == null)
            {
                return;
            }

            var columnView             = editor.ColumnView as DevExpress.XtraGrid.Views.Grid.GridView;
            var masterDetailColumnView = columnView as IMasterDetailColumnView;
            var columnViewEditor       = editor as IColumnViewEditor;

            if (editor.Grid != null)
            {
                editor.Grid.ViewRegistered -= Grid_ViewRegistered;
                editor.Grid.ViewRemoved    -= Grid_ViewRemoved;
                if (columnViewEditor != null && masterDetailColumnView != null && !masterDetailColumnView.IsDetailView(columnViewEditor))
                {
                    var gridViews = editor.Grid.Views.OfType <IMasterDetailColumnView>().ToList();
                    for (int i = gridViews.Count - 1; i > -1; i--)
                    {
                        var xpandXafGridView = gridViews[i];
                        CloseNestedWindow(xpandXafGridView);
                    }
                }
            }

            if (columnView != null)
            {
                columnView.MasterRowCollapsing                -= GridViewOnMasterRowCollapsing;
                columnView.MasterRowGetRelationCount          -= ViewOnMasterRowGetRelationCount;
                columnView.MasterRowGetRelationName           -= ViewOnMasterRowGetRelationName;
                columnView.MasterRowGetRelationDisplayCaption -= MasterRowGetRelationDisplayCaption;
                columnView.MasterRowGetChildList              -= ViewOnMasterRowGetChildList;
                columnView.MasterRowEmpty -= ViewOnMasterRowEmpty;
                columnView.MasterRowGetLevelDefaultView -= ViewOnMasterRowGetLevelDefaultView;
                if (columnViewEditor != null && masterDetailColumnView != null && masterDetailColumnView.IsDetailView(columnViewEditor))
                {
                    View.CollectionSource.CriteriaApplied -= CollectionSourceOnCriteriaApplied;
                }
                View.Closing -= ViewOnClosing;
            }
        }
Ejemplo n.º 4
0
 public List <MasterDetailRuleInfo> FilterRules(object currentObject, Frame frame)
 {
     return(CreateRules(frame).Where(info => info.Criteria.Fit(currentObject)).ToList());
 }
Ejemplo n.º 5
0
 protected abstract List <MasterDetailRuleInfo> CreateRules(Frame frame1);
Ejemplo n.º 6
0
 public static Controller GetController(this DevExpress.ExpressApp.Frame frame, System.Type controllerType)
 {
     return((Controller)frame.CallMethod(new[] { controllerType }, "GetController"));
 }
Ejemplo n.º 7
0
 public static IEnumerable <ActionBase> Actions(this DevExpress.ExpressApp.Frame frame)
 {
     return(frame.Actions <ActionBase>());
 }
Ejemplo n.º 8
0
 public static IEnumerable <T> Actions <T>(this DevExpress.ExpressApp.Frame frame) where T : ActionBase
 {
     return(frame.Controllers.Cast <Controller>().SelectMany(controller => controller.Actions).OfType <T>());
 }