我对 Winforms 场景的 Castle Windsor 的正确实现感到困惑,我发现的所有文档都是关于 WCF 和 ASP.NET MVC 所以我寻求帮助以在 Windows 窗体中正确实现 Castle Windsor。现在这是我的代码...我从 MVP http://dotnetchris.wordpress.com/2009/02/16/creating-a-generic-model-view-presenter-framework/这种方法开始
传递到 Winforms 我做了这个
public interface IPresenter<TViewModel>
{
TViewModel View { get; set; }
event EventHandler ViewInitialized;
void OnViewInitialized(EventArgs e);
event EventHandler ViewLoaded;
void OnViewLoaded(EventArgs e);
}
基本形式是
public partial class MvpForm<TPresenter, TViewModel> : Form
where TPresenter : IPresenter<TViewModel>
where TViewModel : class
在第一部分之后,我的主持人是
public class PatientSearchCreatePresenter: IPresenter<IPatientFilterViewModel>
{
IPatientBusinessService patient;
/// <summary>
/// Initializes a new instance of the <see cref="PatientFilterPresenter" /> class.
/// </summary>
public PatientSearchCreatePresenter(IPatientBusinessService Patient)
{
patient = Patient;
}
我的搜索和创建患者的表格是这样的
public partial class FormSearchCreatePatient : MvpForm<PatientSearchCreatePresenter,IPatientSearchCreateViewModel> , IPatientSearchCreateViewModel
{
我应该在哪里以及如何为 View 和 Presenter 服务属性执行 Castle 组件的安装和注册
太感谢了