Click here to Skip to main content
15,914,594 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
AnswerRe: How to introduce Continuous Integration? Pin
BobJanova6-Aug-12 5:19
BobJanova6-Aug-12 5:19 
GeneralRe: How to introduce Continuous Integration? Pin
Bernhard Hiller6-Aug-12 21:21
Bernhard Hiller6-Aug-12 21:21 
GeneralRe: How to introduce Continuous Integration? Pin
pasztorpisti6-Aug-12 22:17
pasztorpisti6-Aug-12 22:17 
GeneralRe: How to introduce Continuous Integration? Pin
BobJanova7-Aug-12 0:24
BobJanova7-Aug-12 0:24 
GeneralRe: How to introduce Continuous Integration? Pin
pasztorpisti6-Aug-12 22:21
pasztorpisti6-Aug-12 22:21 
AnswerRe: How to introduce Continuous Integration? Pin
Hesham Amin18-Aug-12 15:40
Hesham Amin18-Aug-12 15:40 
QuestionPhilosophical questions about updating a production CMS server Pin
KaЯl5-Jul-12 4:07
KaЯl5-Jul-12 4:07 
AnswerRe: Philosophical questions about updating a production CMS server Pin
jschell5-Jul-12 6:06
jschell5-Jul-12 6:06 
GeneralRe: Philosophical questions about updating a production CMS server Pin
KaЯl5-Jul-12 22:41
KaЯl5-Jul-12 22:41 
AnswerRe: Philosophical questions about updating a production CMS server Pin
Hesham Amin18-Aug-12 15:45
Hesham Amin18-Aug-12 15:45 
GeneralRe: Philosophical questions about updating a production CMS server Pin
KaЯl22-Aug-12 3:21
KaЯl22-Aug-12 3:21 
QuestionWebsite And Service Using Real Time Data Feed Pin
Gavin Coates4-Jul-12 5:34
Gavin Coates4-Jul-12 5:34 
AnswerRe: Website And Service Using Real Time Data Feed Pin
jschell5-Jul-12 6:15
jschell5-Jul-12 6:15 
GeneralRe: Website And Service Using Real Time Data Feed Pin
Albert Holguin17-Jul-12 10:18
professionalAlbert Holguin17-Jul-12 10:18 
AnswerRe: Website And Service Using Real Time Data Feed Pin
Eddy Vluggen2-Aug-12 23:50
professionalEddy Vluggen2-Aug-12 23:50 
AnswerRe: Website And Service Using Real Time Data Feed Pin
wizardzz9-Aug-12 8:15
wizardzz9-Aug-12 8:15 
QuestionCommonApplicationData Pin
mmujahid29-Jun-12 11:38
mmujahid29-Jun-12 11:38 
AnswerRe: CommonApplicationData Pin
Richard Andrew x6429-Jun-12 11:51
professionalRichard Andrew x6429-Jun-12 11:51 
QuestionBest Pattern for a New Service Pin
Brian C Hart26-Jun-12 9:12
professionalBrian C Hart26-Jun-12 9:12 
SuggestionRe: Best Pattern for a New Service Pin
kisMicrosoftDev27-Jun-12 6:23
kisMicrosoftDev27-Jun-12 6:23 
AnswerRe: Best Pattern for a New Service Pin
jschell27-Jun-12 10:14
jschell27-Jun-12 10:14 
GeneralRe: Best Pattern for a New Service Pin
Brian C Hart27-Jun-12 11:00
professionalBrian C Hart27-Jun-12 11:00 
AnswerRe: Best Pattern for a New Service Pin
jschell28-Jun-12 8:41
jschell28-Jun-12 8:41 
QuestionWPF App Design Thoughts Pin
Kevin Marois20-Jun-12 7:58
professionalKevin Marois20-Jun-12 7:58 
I'm starting a new WPF app. The app's visual layout is pretty simple[^].

I have done apps like this before, but I'd like to revisit the way I do this.

Basically, the main content area contains a Content Presenter that is bound to a property called MainContent in the MainWindowViewModel. Then logic in the MainWindowViewModel determines which view to bind. The main content is then dynamic based of business logic.

For example, after installation there will be a series of views, like a wizard, that walks the user through the intial setup. Then, once up & running, what is displayed there is based off what action the user choise.

I had a conversion with a co-worker who was totally against this design because he thought that the VM's should not know about any views. He is right in that the MainWindowViewModel has a method called LoadView that accepts an enum containing the names of the content items to show.

So, if the user clicks a customer account, the click handler would pass AppViews.CustomerAccount to LoadView, and the LoadView method looks like this:

private UserControl _MainContent;
public UserControl MainContent
{
    get { return _MainContent; }
    set
    {
        if (_MainContent == value)
            return;
        _MainContent = value;
        RaisePropertyChanged("MainContent");
    }
}
        
public void LoadView(AppViews ViewToLoad)
{
    _ViewModeBase vm = null;
    UserControl view = null;

    switch (ViewToLoad)
    {
        case AppViews.CustomerAccount:
            vm = new CustomerAccountViewModel();
            view = new CustomerAccountView();
            break;

        // Once CASE for each view
    }

    view.DataContext = vm;
    MainContent = view;
}


Again, I have done this with success a few times, but I want to make sure it's a solid design.

Anyone have a better way?

Thanks
If it's not broken, fix it until it is

AnswerRe: WPF App Design Thoughts Pin
Ian Shlasko20-Jun-12 8:06
Ian Shlasko20-Jun-12 8:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.