zoukankan      html  css  js  c++  java
  • How to: Merge End-User Customizations into the XAF Solution 如何:将最终用户自定义合并到 XAF 解决方案中

    End-users can customize an XAF application user interface (UI) at runtime with ease. The Layout Manager, Column Chooser and other capabilities allow end-users to configure a UI in a "what you see is what you get" way. But when you, as a developer, customize a UI in the Model Editor, you have to deal with indexes, widths, heights, groups, etc. So, you may want to customize a UI as an end-user, and then merge changes to one of the Application Model layers in your XAF solution. This topic describes how to achieve this task using the Model Merge Tool. As an example, the column order settings will be merged from user differences into the module project layer. However, you can use the same approach to merge any end-user customizations. For example:

    最终用户可以在运行时轻松自定义 XAF 应用程序用户界面 (UI)。布局管理器、列选择器和其他功能允许最终用户以"您所看到的就是你得到的"的方式配置 UI。但是,当您作为开发人员在模型编辑器中自定义 UI 时,您必须处理索引、宽度、高度、组等。因此,您可能希望将 UI 自定义为最终用户,然后将更改合并到 XAF 解决方案中的应用程序模型图层之一。本主题介绍如何使用模型合并工具完成此任务。例如,列顺序设置将从用户差异合并到模块项目层中。但是,您可以使用相同的方法来合并任何最终用户自定义项。例如:

    • List View columns visibility, width, grouping, filter settings;
    • Dashboard and Detail View layouts;
    • Chart and Pivot settings.

    最终用户可以在运行时轻松自定义 XAF 应用程序用户界面 (UI)。布局管理器、列选择器和其他功能允许最终用户以"您所看到的就是你得到的"的方式配置 UI。但是,当您作为开发人员在模型编辑器中自定义 UI 时,您必须处理索引、宽度、高度、组等。因此,您可能希望将 UI 自定义为最终用户,然后将更改合并到 XAF 解决方案中的应用程序模型图层之一。本主题介绍如何使用模型合并工具完成此任务。例如,列顺序设置将从用户差异合并到模块项目层中。但是,您可以使用相同的方法来合并任何最终用户自定义项。例如:

    • 列表 视图列可见性、宽度、分组、筛选器设置;
    • 仪表板和详细视图布局;
    • 图表和数据透视设置。
    Note 注意
    Mobile applications do not support Users' Model Differences, so the approach described in this topic is not supported by the Mobile platform.
    移动应用程序不支持用户的模型差异,因此移动平台不支持本主题中描述的方法。

    Customize a UI at Run Time

    在运行时自定义 UI

    In this topic we will use the MainDemo application, located in the %PUBLIC%DocumentsDevExpress Demos 19.2ComponentseXpressApp FrameworkMainDemo folder. Open the MainDemo solution (C# or VB), set MainDemo.Win as the startup project and run the Windows Forms application. Select the Resume navigation item. You will see the Resume object's List View. Use drag-and-drop to swap the File column with Contact.

    在本主题中,我们将使用位于%PUBLIC%DocumentsDevExpress Demos 19.2ComponentseXpressApp FrameworkMainDemo folder.打开 MainDemo 解决方案(C# 或 VB),将 MainDemo.Win 设置为启动项目并运行 Windows 窗体应用程序。选择"恢复"导航项。您将看到"恢复"对象的"列表"视图。使用拖放将"文件"列与"联系人"交换。

    ModelMerge_HowTo_SwapColumns

    Close the Windows Forms application. The customizations you have made are saved to the Model.User.xafml file located in the project output folder (binDebug by default).

    关闭 Windows 窗体应用程序。您所做的自定义将保存到位于项目输出文件夹中的 Model.User.xafml 文件(默认情况下为 bin_Debug_)。

    • XML
    <ListView Id="Resume_ListView">
      <Columns>
        <ColumnInfo Id="Contact" Index="0" />
        <ColumnInfo Id="File" Index="1" />
      </Columns>
    </ListView>

    Merge User Differences into the Module Project Layer

    将用户差异合并到模块项目层

    Now let us merge the end-user customizations into the Application Model of the module project. In the Solution Explorer, right click the MainDemo.Win application project and click Merge User Model. In the invoked Open dialog, choose the Model.User.xafml file.

    现在,让我们将最终用户自定义项合并到模块项目的应用程序模型中。在解决方案资源管理器中,右键单击 MainDemo.Win 应用程序项目,然后单击"合并用户模型"。在调用的"打开"对话框中,选择 Model.User.xafml 文件。

    ModelMerge_HowTo_MergeUserModel

    As a result, the Model Merge Tool dialog is invoked. Navigate to the Resume_ListView node in the tree list. This node caption is displayed in bold, as the node contains customizations. Use the checkbox to the left to select this node. In the dropdown below, select MainDemo.Module and click Merge. The Resume_ListView node's differences will be merged into the MainDemo.Module project.

    因此,将调用"模型合并工具"对话框。导航到树列表中的Resume_ListView节点。此节点标题以粗体显示,因为节点包含自定义项。使用左侧的复选框选择此节点。在下面的下拉列表中,选择 MainDemo.模块并单击"合并"。Resume_ListView节点的差异将合并到 MainDemo.模块项目中。

    ModelMerge_HowTo_MergeDialog

    Finally, click Save to persist changes and close the Model Merge Tool dialog.

    最后,单击"保存"以保留更改并关闭"模型合并工具"对话框。

    Note 注意
    • You can select several nodes at once, and repeat the merging operation as many times as required, before clicking Save. If a part of the selected differences cannot be applied to the selected target, a warning message will be displayed. In this instance, you can try another target (e.g. MainDemo.Module.Win).
    • If your application is already deployed, and one of end-users has a carefully crafted layout, you may want to use this layout in a new version of the application. In this instance, just copy the Model.User.xafml file from the end-user workstation, and select this file in the Open dialog when running the Model Merge Tool.
    • 您可以同时选择多个节点,并根据需要重复合并操作多次,然后单击"保存"。如果所选差异的一部分无法应用于所选目标,将显示一条警告消息。在这种情况下,您可以尝试另一个目标(例如 MainDemo.module.win)。
    • 如果应用程序已部署,并且其中一个最终用户具有精心设计的布局,则可能需要在应用程序的新版本中使用此布局。在这种情况下,只需从最终用户工作站复制 Model.user.xafml 文件,并在运行模型合并工具时在"打开"对话框中选择此文件。

    Check Changes

    检查更改

    After merging, you can see the Resume_ListView node customizations in the Model Editor invoked for the MainDemo.Module project.

    合并后,您可以在为 MainDemo.module 项目调用的模型编辑器中看到Resume_ListView节点自定义项。

    ModelMerge_HowTo_ME

    To test changes at run time, reset the user model differences. The simplest way to do this is to delete the Model.User.xafml file from your application project output folder. Then, run the Windows Forms application to see that a layout is customized as required.

    要在运行时测试更改,请重置用户模型差异。最简单的方法是从应用程序项目输出文件夹中删除 Model.user.xafml 文件。然后,运行 Windows 窗体应用程序以查看根据需要自定义布局。

    ModelMerge_HowTo_Win

    As the differences were moved into a platform-agnostic module, you can see that your customizations affect the ASP.NET application as well.

    当差异被移动到与平台无关的模块中时,您可以看到自定义也会影响ASP.NET应用程序。

    ModelMerge_HowTo_Web

  • 相关阅读:
    python 基础2.5 循环中continue与breake用法
    python 基础 2.4 while 循环
    python 基础 2.3 for 循环
    python 基础 2.2 if流程控制(二)
    python 基础 2.1 if 流程控制(一)
    python 基础 1.6 python 帮助信息及数据类型间相互转换
    python 基础 1.5 python数据类型(四)--字典常用方法示例
    Tornado Web 框架
    LinkCode 第k个排列
    LeetCode 46. Permutations
  • 原文地址:https://www.cnblogs.com/foreachlife/p/How-to-Merge-End-User-Customizations-into-the-XAF-Solution.html
Copyright © 2011-2022 走看看