Beispiel #1
0
        public static void Show(this DashboardViewer dashboardViewer, XafApplication application, IDashboardDefinition dashboardDefinition)
        {
            var dashboardCollectionDataSourceFillService = (IXpandDashboardDataSourceFillService)((XpandDashboardDataProvider)DashboardsModule.DataProvider)
                                                           .AttachViewService(dashboardViewer.ServiceContainer, (IDashboardData)dashboardDefinition);

            dashboardCollectionDataSourceFillService.FillService.LoadBeforeParameters += (sender, args) =>
                                                                                         args.Handled = new[] { RuleMode.Always, RuleMode.Runtime }.Contains(dashboardDefinition.EditParameters);
            dashboardDefinition.GetDashboard(application, RuleMode.Runtime, dashboardCollectionDataSourceFillService, null, null, () => {});

            dashboardViewer.Dashboard = dashboardDefinition.GetDashboard(application, RuleMode.Runtime, dashboardCollectionDataSourceFillService, dashboardViewer.DataSourceOptions,
                                                                         dashboard => dashboardViewer.DashboardChanged += (_, args) => dashboardViewer.ShowDashboardParametersForm());
        }
Beispiel #2
0
        public void LoadTemplate(IDashboardDefinition dashboardDefinition, XafApplication application)
        {
            _template = dashboardDefinition;
            dashboardDefinition.GetDashboard(application, RuleMode.DesignTime, null, null, null, () => {});
            var dashboardCollectionDataSourceFillService = (IXpandDashboardDataSourceFillService)((XpandDashboardDataProvider)DashboardsModule.DataProvider)
                                                           .AttachService(Designer.ServiceContainer, (IDashboardData)dashboardDefinition);

            dashboardCollectionDataSourceFillService.FillService.LoadBeforeParameters += (sender, args) =>
                                                                                         args.Handled = new[] { RuleMode.Always, RuleMode.DesignTime }.Contains(dashboardDefinition.EditParameters);
            Designer.Dashboard = dashboardDefinition.GetDashboard(application, RuleMode.DesignTime, dashboardCollectionDataSourceFillService, Designer.DataSourceOptions,
                                                                  dashboard => Designer.DashboardChanged += (sender, args) => Designer.ShowDashboardParametersForm());
            _editHistory.Changed += _EditHistory_Changed;
        }
Beispiel #3
0
        public static DevExpress.DashboardCommon.Dashboard GetDashboard(this IDashboardDefinition dashboardDefinition,
                                                                        XafApplication application, RuleMode ruleMode, IXpandDashboardDataSourceFillService dashboardDataSourceFillService = null,
                                                                        DataSourceOptionsContainer options = null, Action <DevExpress.DashboardCommon.Dashboard> editParameters = null, Action modeParametersEdited = null)
        {
            var dashboard = dashboardDefinition.GetDashboard();

            dashboard.ApplyModel(ruleMode, dashboardDefinition, application.Model);
            var datasourceFilterList      = dashboard.CreateDashboardDatasourceFilterList(dashboardDefinition, ruleMode, application);
            var dashboardDatasourceFilter = datasourceFilterList.Filters.FirstOrDefault();

            if (modeParametersEdited != null)
            {
                if (dashboardDatasourceFilter != null)
                {
                    var detailView =
                        application.CreateDetailView(dashboardDatasourceFilter.ObjectSpace, datasourceFilterList);
                    detailView.ViewEditMode = ViewEditMode.Edit;
                    application.ShowViewStrategy.ShowViewInPopupWindow(detailView,
                                                                       () => {
                        SaveModel(datasourceFilterList, application);
                        modeParametersEdited();
                    });
                }
                return(dashboard);
            }
            ConfigureDashboard(dashboardDefinition, ruleMode, dashboardDataSourceFillService, options, editParameters, datasourceFilterList, dashboard);
            return(dashboard);
        }