如何从MVP模式转向SCSF CAB模式?
我用 MVP 模式设计和开发了我的应用程序。我没有使用任何软件工厂来实现这一点。现在我想转向 SCSF 模式和 CAB 结构。
我需要知道是否可以通过任何更简单的方式来完成,因为 CAB 结构仅实现 MVP。
I have designed and developed my application in MVP Pattern. I have not used any software factory to achieve this. Now i want to shift to SCSF pattern and CAB structure.
I need to know if it can be done in any easier way as CAB structure implements MVP only.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我同意瓦利的观点。你已经准备好你的观点了。假设他们是完美的 MVP。现在您需要将它们分类为模块。
我们创建了子工作项,以便当启动用例时,它是添加到模块的工作项集合中的子工作项的新实例。因此,当用例完成时,我们只需终止子工作项即可。如果发生任何异常,则子工作项将成为当前模块工作项受影响的对象。
SCSF 具有可以在屏幕上组合多个视图的功能。因此,您需要注意是否可以使用 ZoneWorkspace 来避免重复的 UI 和逻辑。
决定模块如何进行通信,例如事件或命令。
数据如何在视图和模块之间传递。现在您已经有了 Shell,您需要决定 Shell 上的所有区域。 shell 中默认包含的内容。模块如何监听 Shell。 Shell 从模块监听哪些事件来自定义自身。
SCSF 具有依赖注入。因此,请决定您将拥有哪些 UI 服务。将它们相应地注入到 Presenter 中。
I would agree with Wali. you have got your views ready . Assuming they are in perfect MVP. now you need to classify them into Modules.
We created child workitems, so that when a use case is started it was a new instance of child workitem added to the workitems collection of the module. So when the use case is completed we simply terminated the child workitem. If any exception occurs then the childworkitem is the one going to be affected now the Module's work item.
SCSF has feature where you can compose multiple views on the screen. So you need to look out if you can use ZoneWorkspace to avoid duplicate UI and logic.
Decide how the modules are going to communicate, say events or Commands.
How data is going to be passed between views and modules. Now you have the Shell, you need to decide what all regions you are going to have on the shell. What comes by default on the shell. How the modules listen to Shell. What events Shell listen from modules to customize itself.
SCSF has dependency injection. So decide what are the UI Services you are going to have. Inject them in to Presenter accordingly.
在 CAB 和 SCSF 中,有代码就绪的 MVP 类(和接口)。因此,如果您已经干净地实现了它,那么一旦掌握了这些类,您就可以复制您的方法。
将尝试简要介绍一下:-
1)IView - 它是 View 的引用,它仅公开那些可由 Presenter(或任何其他类)访问的设置属性/方法
2)View - 它具有 Presenter 的引用和可以访问 Presenter 的所有公共/受保护方法。根据设计,它无法访问任何服务,因为您需要 WorkItem(服务、状态、命令、事件等的容器)。出于所有实际目的,View 仅用于管理 UI 控件、绑定、对象状态等。
3) Presenter——它具有对 WorkItem 的引用(通过它您可以访问所有服务)。演示者的责任是在服务的帮助下操作数据。
4) WorkItemController——WorkItemController 可以采用与 UseCase 相关的功能,如 ui 控件的连接/取消连接、视图的定位等。
它不仅仅是 SCSF/CAB 中的 MVP 作为 UI 应用程序的整体设计。其具有以下特点:-
等等。
所以首先你必须检查 codeplex 文档 看看你的项目是否可以在该平台/架构中轻松升级。如果您刚刚开始并考虑使项目具有可扩展性和企业级,我会推荐 CAB/SCSF。
In CAB and SCSF, there is code-ready MVP classes (and interfaces). So if you have implemented it cleanly, then you can just copy your methods once you get a hang of the classes.
Will try to brief it :-
1) IView -- Its a reference of View, which exposes only those set properties/Methods which can be accessed by Presenter (or any other class)
2) View -- It has a reference of Presenter and can access all the public/protected methods of presenter. By design it cannot access any service, as you would require WorkItem (container of Services, State, Command, Events Etc). For all practical purpose View is only there to manage the UI controls, Binding, State of object Etc.
3) Presenter -- It has a reference to WorkItem (through which you can access all the services). Presenter's responsibility it to manipulate data with the help of Services.
4) WorkItemController -- WorkItemController can take UseCase related functionality as in wiring/unwiring of ui controls, positioning of view etc.
Its more than just MVP in SCSF/CAB as its overall design of a UI Application. Which has the following :-
Etc.
So firstly you have to check codeplex docs to see if your project would be easily upgraded in that platform/architecture. I would recommend CAB/SCSF if you have just begun and thinking of making the project scalable and enterprise level.