This project has moved and is read-only. For the latest updates, please go here.

Restore the window size in the Application layer

Jun 1, 2012 at 6:18 AM
Edited Jun 1, 2012 at 6:18 AM

Main question:

In the Book Library project, you restore the window size in  Waf.BookLibrary.Library.Applications.ViewModels.ShellViewModel. Shouldn't it be implemented at the Presentation level?

Restoring the window size in the Presentation level allows us to get rid of PresentationService and IPresentationService.

Minor additional questions:

  • What actually does the Waf.BookLibrary.Library.Presentation.Services.PresentationService.InitializeCultures() method?
  • Could you please add xml-comments at least to public methods and interfaces in sample projects?
Jun 1, 2012 at 1:27 PM

Thank you for your feedback.

1. Main question:
I agree that restoring and saving the window size could also be done in the Presentation layer. This way you would save some lines of code.
The reason why I did it in the Application layer is that I didn’t want the Presentation layer to know how and where these settings are going to be saved.
I believe both approaches are valid.

2. Question: InitializeCultures?
The code in PresentationService.InitializeCultures() is a workaround for a major WPF localization design issue. WPF Binding uses always “en-US” for formatting values.

The following line overwrites the default value of the Language property which is used by the Binding.

    new FrameworkPropertyMetadata(

See also the LocalizationSample and its documentation.

3. XML Comments for sample projects
I will think about it.

Jun 2, 2012 at 11:36 PM
Edited Jun 2, 2012 at 11:36 PM

Thank you very much for the fast response.

1. Main question.

I agree, that settings saving task is not for the Presentation layer. May be the best approach can be changing the window size in the Presentation layer and saving these settings in the Application layer.

2.  Question: InitializeCultures?

Very good point! I didn't know that.

3. XML Comments for sample projects

Thank you. I would appreciate it.