Ejemplo n.º 1
0
        private static MenuItemDescriptionCollection GetMenuItems(Type dataSourceType, string dataMember, bool ribbonForm)
        {
            var dataSource = new BindingSource {
                DataSource = dataSourceType
            };

            using (var tool = new ReportDesignTool(new XtraReport {
                DataSource = dataSource
            }))
            {
                var form = ribbonForm ? tool.DesignRibbonForm : tool.DesignForm;
                SummaryFieldsFeature.Apply(form.DesignMdiController, form.DesignDockManager);
                form.OpenReport(tool.Report);

                var fieldListPanel = (FieldListDockPanel)form.DesignDockManager[DesignDockPanelType.FieldList];
                var fieldList      = (XRDesignFieldList)fieldListPanel.DesignControl;

                return((MenuItemDescriptionCollection)typeof(DataSourceNativeTreeList).GetMethod("CreateMenuItems", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(fieldList,
                                                                                                                                                                           new[] { fieldList.PickManager.FindDataMemberNode(fieldList.Nodes, dataSource, dataMember) }));
            }
        }
Ejemplo n.º 2
0
        private static int GetFieldListIcon(Type dataSourceType, string dataMember, CalculatedField[] calculatedFields, bool ribbonForm)
        {
            var dataSource = new BindingSource {
                DataSource = dataSourceType
            };

            using (var report = new XtraReport {
                DataSource = dataSource
            })
                using (var tool = new ReportDesignTool(report))
                {
                    report.CalculatedFields.AddRange(calculatedFields);

                    var form = ribbonForm ? tool.DesignRibbonForm : tool.DesignForm;
                    SummaryFieldsFeature.Apply(form.DesignMdiController, form.DesignDockManager);
                    form.OpenReport(tool.Report);

                    var fieldListPanel = (FieldListDockPanel)form.DesignDockManager[DesignDockPanelType.FieldList];
                    var fieldList      = (XRDesignFieldList)fieldListPanel.DesignControl;
                    return(((DataMemberListNode)fieldList.PickManager.FindDataMemberNode(fieldList.Nodes, dataSource, dataMember)).StateImageIndex);
                }
        }
Ejemplo n.º 3
0
        private static void AssertAddSummaryFieldCommandWorks(Type dataSourceType, string dataMember, bool ribbonForm)
        {
            var dataSource = new BindingSource {
                DataSource = dataSourceType
            };

            using (var tool = new ReportDesignTool(new XtraReport {
                DataSource = dataSource
            }))
            {
                var form = ribbonForm ? tool.DesignRibbonForm : tool.DesignForm;
                SummaryFieldsFeature.Apply(form.DesignMdiController, form.DesignDockManager);
                form.OpenReport(tool.Report);

                var fieldListPanel = (FieldListDockPanel)form.DesignDockManager[DesignDockPanelType.FieldList];
                var fieldList      = (XRDesignFieldList)fieldListPanel.DesignControl;
                fieldList.SelectDataMemberNode(dataSource, dataMember);
                fieldList.Selection.Set(new[] { fieldList.FocusedNode });

                var menuCommandService = form.DesignMdiController.ActiveDesignPanel.GetService <IXRMenuCommandService>();
                menuCommandService.GlobalInvoke(SummaryFieldsFeature.AddSummaryFieldCommand, new object[] { fieldList.FocusedNode });
                Assert.That(tool.Report.CalculatedFields.Count, Is.EqualTo(1));
            }
        }
Ejemplo n.º 4
0
 private static void winReportsServiceController_DesignFormCreated(object sender, DesignFormEventArgs e)
 {
     SummaryFieldsFeature.Apply(e.DesignForm);
 }
        public void EndInit()
        {
            var dockManager = this.Container.Components.OfType <XRDesignDockManager>().First();

            SummaryFieldsFeature.Apply(this, dockManager);
        }