Here is an MVP example I created for a form. All forms in this little
tutorial project on EF was converted to use MVP.
http://www.vbforums.com/showthread.php?t=540421
The view to the form
using BLL.DTO;
using System.Collections.Generic;
using System.Windows.Forms;
namespace DemoWindowsFormApp.Views
{
public interface IPayRollView : IView
{
List<DTOAuthor> DtoAuthors { get; set; }
ComboBox CbxAuthors { get; set; }
Label LblPayRollId { get; set; }
NumericUpDown NudSalary { get; set; }
}
}
The codebehind for PayrollView form that implements IPayRollView.
The thing that is different between this version of MVP is that I am
using events on the form instead of using events on the Interface that
you will see in the tutorial
The presenter.....
I am using everything you see in that tutorial. But the Service layer is
using a WCF Web service and the BLL and DAL sit behind the WCF service,
as opposed to the tutorial that has UI/Presenter/BLL/Service
Layer/DAL.architecture.
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using BLL.DTO;
using DemoWindowsFormApp.Presenters;
using DemoWindowsFormApp.Views;
using Services;
namespace DemoWindowsFormApp
{
public partial class PayRollView : Form, IPayRollView
{
#region Members
private PayRollViewPresenter mPresenter;
#endregion
public PayRollView()
{
mPresenter = new PayRollViewPresenter(this,
TheService1.Instance);
InitializeComponent();
}
public List<DTOAuthor> DtoAuthors { get; set; }
public ComboBox CbxAuthors
{
get { return cbxAuthor; }
set { cbxAuthor = value; }
}
public Label LblPayRollId
{
get { return lblPayRollID; }
set { lblPayRollID = value; }
}
public NumericUpDown NudSalary
{
get { return nudSalary; }
set { nudSalary = value; }
}
private void PayRollView_Load(object sender, EventArgs e)
{
mPresenter.Load();
}
private void cbxAuthor_SelectedIndexChanged(object sender,
EventArgs e)
{
mPresenter.cbxAuthors_SelectedIndexChanged();
}
private void btnAdd_Click(object sender, EventArgs e)
{
mPresenter.btnAddClick();
}
private void btnUpdae_Click(object sender, EventArgs e)
{
mPresenter.btnUpdateClick();
}
private void btnDelete_Click(object sender, EventArgs e)
{
mPresenter.btnUpdateClick();
}
}
}
分享到:
相关推荐
winforms-mvp-example 从 code.google.com/p/winforms-mvp-example 自动导出一段时间以来,我一直在努力研究如何在 winforms 中实现 MVP(Model-View-Presenter),但是大多数示例都太简单了——它们没有处理多种...
qml-mvp-example 带有 QML 和 Widget 视图的 MVP 模式示例
大多数的应用中都会包含搜索...com.gm.searchframework包中包含了框架源代码,而com.example.a80066158.searchframework则是基于该框架开发的一个简单的搜索功能的例子。MVP框架的好处这里不赘述了,使用中慢慢体会吧。
Okuki A simple, hierarchical navigation bus ...MVP Example: Demonstrates Okuki's full capabilities using RxJava 1.x, Toothpick, and Parcelable-State save/restore. It also implements an Okuki-centric ap
kotlin-mvp-example:Kotlin上使用MVP架构的小型客户端服务器应用程序
MVP Android Example used to explain how to use this pattern in our Android apps. This code was created to support an article explanation: Android MVP @ antonioleiva.com (English) Android MVP @ LiME ...
MVP-示例这是了解Android MVP模式的示例程序。 我只写了资料,以尽可能地了解MVP模式。 写在Kotlin。来源描述它代表“模型”,“视图”和“演示者”。 MVP模式是View和Presenter之间的1:1关系。 文件名是[xxx] ...
到浮點式的TMS320C3X 及 TMS320C4X , 到相當於 RISC 的 MVP - TMS320C8X , 都是功能強 大的 DSP晶片。並且由於 TMS320之高性能、可靠性、可程式性、低價位 ,使其廣為市場所採 用 ,本專題即採用 TMS320C50 general ...
Example Dagger 2 using MVP pattern to show how to use this library and pattern in our android applications. Inspired in googlesamples / android-topeka Do you want to learn Dagger2 ? MarioKart Kata for...
android-gif-example:使用Dagger 2 + Retrofit 2 + Moshi + RxJava 2 + Glide 4的MVP中的Gif RecyclerView以及用Kotlin + Kotlin DSL编写的JUnit和Espresso测试!
复古匕首Android 项目使用 MVP + Dagger2 + Retrofit。 创建此代码是为了支持本文: :
TDD示例-测试驱动开发- 具有MVP的TDD示例
Flickr-Recents 这是一个简单的应用程序,向用户显示来自的可滚动图像流。 该应用程序不需要任何或登录。 通过使用所有第三方库的接口和设计模式(包括需要时的IOC /依赖注入),使代码保持模块化,可扩展和可测试。...
这是一个使用MVPHelper自动化构建生成,写的一个MVP模拟登陆演示
这是一个非常简单的MVP播客应用。 它具有以下功能: 将播客与其RSS提要同步 通过iTunes类别发现播客 搜索单个播客和剧集 使用嵌入式HTML5音频播放器播放剧集 最喜欢的剧集 订阅各个播客feed 推荐类似的播客 对于...
Android基本MVP概念 建筑学 要求 : Min SDK Version 15 Target SDK Version 27 Check the compileSdkVersion, and buildToolsVersion to be the latest Build Tools Version 27.0.3 Java 1.8 一步步 步骤1.将其...
话虽如此,在构建 MVP 之后,您将能够构建更有趣的多用户功能。 入门 你需要 SQLite3 来完成这个项目。 如果您还没有安装它,请阅读我们的。 一旦你让 SQLite3 工作,你可以通过以下步骤设置你的开发环境: Fork...
应用程序使用MVP架构。 不同视图类型的分页recyclerview用法。 库:RxJava2,Dagger2,Retrofit2,Butterknife,毕加索,Joda Time。 它使用News API。 (每天限制为1000个请求->每6小时250个请求) 为了运行此...
复仇-MVP项目 在博客文章上阅读更多信息: 使用无RxJava或Dagger的MVP方法构建的Android应用。 使用作为服务,其中包含有关其庞大库的所有信息。 数据由Marvel提供。 :copyright:2016 MARVEL 什么是MVP(ModelView...
主程序是example.m其负载在模拟数据simulated_data.mat从它们的后验分布和样品的所有参数。 要运行该程序,请在命令窗口中键入example ,然后按Enter。 作者 Vincent Chin(电子邮件:) 执照 使用代码的限制很少-...