Скачать презентацию An Introduction to the Model-View Model Pattern Srsly Скачать презентацию An Introduction to the Model-View Model Pattern Srsly

b604ec2904172d07cec80da2c40b25cd.ppt

  • Количество слайдов: 22

An Introduction to the Model-View. Model Pattern Srsly? Another MV* Pattern? Brian. Genisio@Gmail. com An Introduction to the Model-View. Model Pattern Srsly? Another MV* Pattern? Brian. Genisio@Gmail. com

How I Got Into MVVM How I Got Into MVVM

The Healthcare Application Screenshot of Web. Station The Healthcare Application Screenshot of Web. Station

The Generalized Problem The Generalized Problem

What We Want What We Want

How Do We Achieve that? View. Model How Do We Achieve that? View. Model

A More Complete Diagram Unit Tests Integration Tests View XAML, Code Behind Bindings Actions A More Complete Diagram Unit Tests Integration Tests View XAML, Code Behind Bindings Actions Behavior View. Model Properties, Commands, View Logic Service Proxies Events Data Model Web

Twitter Search Demo Using MVVM Twitter Search Demo Using MVVM

Emerging Technology We’re still trying to figure out the Best Practices Emerging Technology We’re still trying to figure out the Best Practices

Standing on the Shoulders of Giants MVC MVP Presenter Model Martin Fowler Josh Smith Standing on the Shoulders of Giants MVC MVP Presenter Model Martin Fowler Josh Smith John Gossman Sean Wildermuth

Compared to… Compared to…

Mini Patterns Mini Patterns

Notify. Property. Changed public interface INotify. Property. Changed { event Property. Changed. Event. Handler Notify. Property. Changed public interface INotify. Property. Changed { event Property. Changed. Event. Handler Property. Changed; }

Command Pattern public interface ICommand { bool Can. Execute(object param); void Execute(object param); event Command Pattern public interface ICommand { bool Can. Execute(object param); void Execute(object param); event Event. Handler Can. Execute. Changed; } public class Delegate. Command : ICommand { public Delegate. Command( Action command, Predicate can. Execute); }

Event Aggregator Pattern Event Aggregator Pattern

Attached Behaviors <Text. Block Foreground=“Red” Width=“ 200” Behaviors: Update. When. Text. Changed=“True” /> Font. Attached Behaviors Font. Size Foreground Text. Block Width … Trimming Behavior

MVVM Guidelines 1. Reduce or eliminate your code-behind 2. Bind all of your UI MVVM Guidelines 1. Reduce or eliminate your code-behind 2. Bind all of your UI inputs/outputs to your View. Model 3. Implement INotify. Property. Changed on your View. Model 4. Put your view behavior into the View. Model 5. Do not put any view state into the model 6. Only bind to a model object if there is no view-specific info 7. When testing, treat View. Model as the Real UI 8. Avoid events. Use commands instead

Third Party Support Prism MVVM Light Caliburn Silverlight FX Third Party Support Prism MVVM Light Caliburn Silverlight FX

Demo – Code. Mash App Demo – Code. Mash App

Who Creates the View. Model? XAML View Constructor Other View. Model Marriage Dependency Injection Who Creates the View. Model? XAML View Constructor Other View. Model Marriage Dependency Injection

Silverlight [Unit|Integration|Functional] Testing Nunit/Moq Silverlight UT White Telerik Web. AI Silverlight [Unit|Integration|Functional] Testing Nunit/Moq Silverlight UT White Telerik Web. AI

Contact Info Brian. Genisio@Gmail. com http: //House. Of. Bilz. com http: //Twitter. com/Brian. Genisio Contact Info Brian. Genisio@Gmail. com http: //House. Of. Bilz. com http: //Twitter. com/Brian. Genisio OPEN SPACES http: //speakerrate. com/briangenisio