Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 983529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:52:20+00:00 2026-05-16T04:52:20+00:00

I have an application that has a window similar to the one bellow .

  • 0

I have an application that has a window similar to the one bellow .

alt text http://a.imageshack.us/img137/7481/screenshotxh.jpg

The requirement here is that when the user clicks the Save button everything has to get saved. The “Save” and “Reset” buttons are “common” to all tabs. Hence, when the “Personal Information” tab is selected and “Save” is clicked the program should also save changes made in the “Friends” tab and changes made in the “Employment History” tab.

The app already has code for the following and I want to keep this code:

-PersonalInformationView , PersonalInformationPresenter, PersonalInformationModel

-FriendsView, FriendsPresenter, FriendsModel

-EmploymentHistoryView, EmploymentHistoryPresenter, EmploymentHistoryModel

Each presenter has a Save method.

The question is what would be a good design pattern to use taking into consideration that I want to keep the code I already have. Also, I want this window to have model, view, presenter as well. Or maybe I should rephrase my question a bit: what’s the best way of including “sub-views”, “sub-presenters” when programming MVP ?

Regards,
MadSeb

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T04:52:21+00:00Added an answer on May 16, 2026 at 4:52 am

    I would make your new presenter take in your sub presenters as constructor arguments, something like:

    class DialogPresenter {
    
        private readonly IDialogView view;
        private readonly PersonalInformationPresenter personal;
        private readonly FriendsPresenter friends;
        private readonly EmploymentHistoryPresenter history;
    
        void DialogPresenter(IDialogView view, PersonalInformationPresenter personal, FriendsPresenter friends, EmploymentHistoryPresenter history) {
            this.view = view;
            this.personal = personal;
            this.friends = friends;
            this.history = history;
        }
    
        bool Display() {
            this.personal.Display();
            this.friends.Display();
            this.history.Display();
    
            return this.view.Display() == DialogResult.Ok;
        }
    
        void Save() {
            this.personal.Save();
            this.friends.Save();
            this.history.Save();
        }
    }
    

    Of course, if your presenters had a common interface between them, this could be simplified (and made more extendable) like so:

    class DialogPresenter {
    
        private readonly IDialogView view;
        private readonly IPresenters[] presenters;
    
        void DialogPresenter(IDialogView view, IPresenters[] presenters)
        {
            this.view = view;
            this.presenters = presenters;
        }
    
        bool Display() {
            foreach (var item in this.presenters)
                item.Display();
    
            return this.view.Display() == DialogResult.Ok;
        }
    
        void Save() {
            var validation = new List<string>();
    
            foreach (var item in this.presenters)
                validation.AddRange(item.Validate());
    
            if (validation.Count > 0) {
                    _view.ShowErrors(validation);
                    return;
            }
    
            foreach (var item in this.presenters)
                validation.AddRange(item.Save());
        }
    }
    

    Edit:
    Calling code would be something like this:

    void DisplayForm() {
    
        using (var frm = new frmDisplay) {
    
            //or just use DI to get the models etc
            var personal = new PersonalInformationPresenter(personalModel, frm.PersonalTab);    //some properties to expose your views
            var friends = new FriendsPresenter(friendslModel, frm.FriendsTab);
            var history = new EmploymentHistoryPresenter(employmentHistoryModel, frm.HistoryTab);
    
            var presenter = new DialogPresenter(frm, personal, friends, history);
            if (presenter.Display()) {    
                presenter.Save();
            }
        }
    }
    

    Hope that is of some inpsiration/help 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an application that has a primary window, it can launch multiple other
I have a Windows application that has 2 Forms . From one form I
I have an application that has two threads. The first one (the main thread)
I have a c# windows form application that has a similar GUI functionality as
I have an mvc application that has been coded to use Windows authentication and
Scenario I have a C# windows forms application that has a number of processes.
I have an application that has 2 beans with the same name, but which
We have an application that has a database full of polygons (currently stored as
I have a application that has an activity that shows message logs. The thing
I have an application that has two localization options at the moment through .resx

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.