mvp

Decoupling the view, presentation and ASP.NET Web Forms

孤人 提交于 2019-12-05 07:05:29
I have an ASP.NET Web Forms page which the presenter needs to populate with controls. This interaction is somewhat sensitive to the page-life cycle and I was wondering if there's a trick to it, that I don't know about. I wanna be practical about the whole thing but not compromise testability. Currently I have this: public interface ISomeContract { void InstantiateIn(System.Web.UI.Control container); } This contract has a dependency on System.Web.UI.Control and I need that to be able to do things with the ASP.NET Web Forms programming model. But neither the view nor the presenter may have

using backgroundworker in Winforms (C#) with MVP pattern

自闭症网瘾萝莉.ら 提交于 2019-12-05 03:16:13
问题 I've been trying to refactor a spaghetti code of an app by using MVP pattern. But now I'm struggling with this: A form that has button that calls a the DoWork method (of a backgroundworker) which is a long operation. My question is if I move the long operation out of the view into the Presenter then how do I send progress changes from this operation to the View? The BGW must be in the Presenter also? Can you give me a sample of how to do this? Thank you in advance. 回答1: This outlines the use

GWT 2.2 MVP vs. GWT 2.1 Activities-Places

岁酱吖の 提交于 2019-12-05 01:11:41
I'm starting to develop a large GWT application, and after reading a lot of articles and blog posts, I'm trying to understand what is the difference between the 2.2 Model-View-Presenter and the 2.1 Activities-Places design patterns? Which pattern do you recommend and why? Should I use MVP simply because it is "newer"? On the other hand Places-Activities seems to be more "intuitive"... Or am i totally missing the point and MVP is just an improved version of Activities-Places? Thanks to all GWT gurus out there :-) First I would recommend you reading this: http://code.google.com/webtoolkit/doc

Android MVP: safe use Context in Presenter

时光毁灭记忆、已成空白 提交于 2019-12-04 23:07:07
In my app I work with ContentProvider and use LoaderManager.LoaderCallbacks<Cursor>. Fragment (View) public class ArticleCatalogFragment extends BaseFragment implements ArticleCatalogPresenter.View, LoaderManager.LoaderCallbacks<Cursor> { @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { return onCreateArticleCatalogLoader(args); } @Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { data.registerContentObserver(new LoaderContentObserver(new Handler(), loader)); updateUI(data); } private Loader onCreateArticleCatalogLoader(Bundle args) { int categoryId

MVP events or property

有些话、适合烂在心里 提交于 2019-12-04 20:57:43
I'm using the MVP pattern in a windows form app. I need to change a radio button on the view. I can do this by exposing a Boolean property on the view, but should I be using events to manipulate the view instead? It's a matter of purity vs being pragmatic... and a bit of personal style. Shouldn't matter... events are just more work than normal methods but more decoupled. Personally I like to keep views decoupled or unaware of the presenters, hence Views communicate to the presenter by raising events . This eliminates the need for the view to have a reference to the presenter. Keep Views thin

How to apply MVP pattern to android project

淺唱寂寞╮ 提交于 2019-12-04 18:45:20
Sorry about my English grammar. My question is little bit stupid but I want to understand clearly about how MVP pattern apply in real application. I'm developing an android project. I want to apply MVP pattern to my project. I refer to this demo : https://github.com/antoniolg/androidmvp I'm very excited with this pattern. But in this demo project, I see each activity (a view) , we always have a presenter and an interactor (model) and something else. So in project which have many screen : How should I manage the presenter and model. With each activity (example LoginActivity), I create a "login"

Winforms MVP Grid Events Problem

别来无恙 提交于 2019-12-04 17:04:06
I am trying to implement the MVP pattern for WINFORMS. Its a simple for with a button and a Grid, on button click, the grid will load, and user can fill in values into the grid. For my button click event, I have something like this: _presenter.LoadGrid(); Which is simple and straightforward. My question is, in regards to grid... I am planning to have a row click event firing....for enabling/disabling the subsequent input fields for the specific columns/rows of the grid etc. I understand that the presenter should not contain any GUI elements and the View(form) shouldn't really contain Logic? So

GWT servlet filter ,How to identify special service request?

旧巷老猫 提交于 2019-12-04 15:48:16
I created a app with GWT+requestfacotry(MVP)+GAE. There are some service or method exposed to GWT client ,such as 1.create 2.remove 3.query I want to add authorization function to "create" and "remove" ,but not to "query". I did it with servlet filter : public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { UserService userService = UserServiceFactory.getUserService(); HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse

MVP - Should the Presenter use Session?

北城余情 提交于 2019-12-04 12:27:47
问题 I am using the Model-View-Presenter pattern for a web page. Should the presenter be aware of Session or should only the view be aware of it? I guess what I am getting at is that concepts like Session are very related to the architecture of the view so should they be limited to use by the view? Otherwise what would happen if I wanted to reuse the presenter on a similar page on a different architecture (or do I not need to worry about that unless I have plans to do so)? 回答1: I am doing

Android MVP : One Activity with Multiple Fragments

老子叫甜甜 提交于 2019-12-04 11:29:51
问题 I have an Activity that hosts multiple fragments that define each step in a registration flow for a user. The flow is complex and the next step is defined by user actions in the previous steps. The flow is like below: MainActivity | Fragment1 --> Fragment2 --> Fragment3 --> Fragment4 \ --> Fragment5 --> Fragment6 Following MVP, I have View & Presenter for each Fragment involved. The concern I have is how to communicate between the Fragment and the Activity in an MVP way. The result of each