SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Braintree
http://www.nrumyantsev.com/




    
    
    





2
3









4
Model                View




            Controller




5
Model                  View

                           DataBinding


            Presentation
               Model
            (ViewModel)



6
7






8
<DataTemplate x:Key="MapTemplate">
           <my:Pushpin Location="{Binding Location}" />
</DataTemplate>

...

<my:Map Name="map1"
        Height="494"
        HorizontalAlignment="Left"
        Margin="20,6,0,0"
        VerticalAlignment="Top"
        Width="444"
        Center="{Binding MapCenter, Mode=TwoWay}"
        ZoomLevel="{Binding MapZoomLevel, Mode=TwoWay}">
        <my:MapItemsControl x:Name="ListOfItems"
                  ItemTemplate="{StaticResource MapTemplate}"
                  ItemsSource="{Binding LocationDataCollection}">
        </my:MapItemsControl>
 </my:Map>




  9


     



     <StackPanel Orientation="Horizontal" Height="22">
             <Label Width="50"> Options: </Label>
             <Button x:Name="Search" Width="100"
                     Command="{Binding SearchCommand}" >Search</Button>
     </StackPanel>




10
public class SearchCommand : ICommand
   {
       private ViewModel viewModel;

         public SearchCommand(ViewModel viewModelInstance)
         {
             viewModel = viewModelInstance;
         }

         #region ICommand Members
         public bool CanExecute(object parameter)
         {
             return true;
         }

         public event EventHandler CanExecuteChanged
         {
             add { CommandManager.RequerySuggested += value; }
             remove { CommandManager.RequerySuggested -= value; }
         }

         public void Execute(object parameter)
         {
             viewModel.Search();
         }
         #endregion
11   }









      http://unity.codeplex.com
12   




     IUnityContainer Container = new UnityContainer();

     if (ViewModelBase.IsInDesignModeStatic)
     {
             Container.RegisterType<IDataService,Design.DesignDataService>();
     }
     else
     {
             Container.RegisterType<IDataService, DataService>();
     }

     Container.RegisterType<MainViewModel>
             (new ContainerControlledLifetimeManager());

13
14
15





     
     
     




16




     <phone:PhoneApplicationPage
       x:Class="MvvmLiteRTM.MainPage"
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
       xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
       xmlns:vm="clr-namespace:MvvmLiteRTM.ViewModel"
       DataContext="{Binding Main, Source={StaticResource Locator}}"
       shell:SystemTray.IsVisible="True“>




17





     <Button Content=“ZoomIn" Height="72" Name=“ZoomInButton">
        <i:Interaction.Triggers>
             <i:EventTrigger EventName="Click">
               <cmd:EventToCommand Command="{Binding ZoomInCommand}"/>
             </i:EventTrigger>
        </i:Interaction.Triggers>
     </Button>




18






         RelayCommand ZoomOutCommand = new RelayCommand(
                 () =>
                 {
                         MapZoomLevel--;
                 }
         );




    19
View


       View
                          Messages       ViewModel


     ViewModel
                                       View

                 Messages
                 + callback

                                     ViewModel

20





         private void SendMessageWithCallback()
         {
            Messenger.Default.Send(new NotificationMessageAction<string>(
                         "Hello, call me back",
                         SendMessageCallback));
         }

         private void SendMessageCallback(string message)
         {
                 ...
         }

    21
private NotificationMessageAction<string> _lastMessage;

     public void MessageRecipient()
     {
             Messenger.Default.Register<NotificationMessageAction<string>>(
                     this,
                     m =>
                     {
                         MessageTextBox.Text = m.Notification;
                         _lastMessage = m;

                          // Execute callback with parameter
                          _lastMessage.Execute(MessageTextBox.Text);
                    });
     }



22

     http://ultralightmvvm.codeplex.com/

     http://mvvmlight.codeplex.com/

     http://catel.codeplex.com/

     http://caliburnmicro.codeplex.com/


23
     http://www.japf.fr/silverlight/mvvm/index.html
24


     
     
     

     
     


     
     
25

     

     



     
     




26
View                   Feature




     View Model               IFeature




                  Injection




27








28
29

     









30


      http://create.msdn.com
      http://silverlight.codeplex.com/

      Model-View-ViewModel (MVVM) Explained
      WPF Apps With The Model-View-ViewModel Design Pattern - Josh
       Smith
      http://nrumyantsev.com/
      me@nrumyantsev.com


31

Weitere ähnliche Inhalte

Was ist angesagt?

The Ring programming language version 1.8 book - Part 12 of 202
The Ring programming language version 1.8 book - Part 12 of 202The Ring programming language version 1.8 book - Part 12 of 202
The Ring programming language version 1.8 book - Part 12 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 14 of 210
The Ring programming language version 1.9 book - Part 14 of 210The Ring programming language version 1.9 book - Part 14 of 210
The Ring programming language version 1.9 book - Part 14 of 210Mahmoud Samir Fayed
 
Magento Dependency Injection
Magento Dependency InjectionMagento Dependency Injection
Magento Dependency InjectionAnton Kril
 
Calculadora
CalculadoraCalculadora
CalculadoraCBTa 120
 
Awesome State Management for React and Other Virtual-Dom Libraries
Awesome State Management for React and Other Virtual-Dom LibrariesAwesome State Management for React and Other Virtual-Dom Libraries
Awesome State Management for React and Other Virtual-Dom LibrariesFITC
 
Magento2&amp;java script (2)
Magento2&amp;java script (2)Magento2&amp;java script (2)
Magento2&amp;java script (2)EvgeniyKapelko1
 
Knockout.js Overview
Knockout.js OverviewKnockout.js Overview
Knockout.js Overview민태 김
 
Single page webapps & javascript-testing
Single page webapps & javascript-testingSingle page webapps & javascript-testing
Single page webapps & javascript-testingsmontanari
 
Cycle.js: Functional and Reactive
Cycle.js: Functional and ReactiveCycle.js: Functional and Reactive
Cycle.js: Functional and ReactiveEugene Zharkov
 
Final tagless and cats mtl
Final tagless and cats mtl Final tagless and cats mtl
Final tagless and cats mtl Alexander Zaidel
 
Aplikasi rawat-inap-vbnet
Aplikasi rawat-inap-vbnetAplikasi rawat-inap-vbnet
Aplikasi rawat-inap-vbnetDiaz Alfahrezy
 
Windows Azure 2/8 - Recursos básicos do Windows Azure
Windows Azure 2/8 - Recursos básicos do Windows AzureWindows Azure 2/8 - Recursos básicos do Windows Azure
Windows Azure 2/8 - Recursos básicos do Windows AzureVitor Ciaramella
 
Command-Oriented Architecture
Command-Oriented ArchitectureCommand-Oriented Architecture
Command-Oriented ArchitectureLuiz Messias
 
2018年のXamarinの概要と活用方法
2018年のXamarinの概要と活用方法2018年のXamarinの概要と活用方法
2018年のXamarinの概要と活用方法Yoshito Tabuchi
 

Was ist angesagt? (20)

The Ring programming language version 1.8 book - Part 12 of 202
The Ring programming language version 1.8 book - Part 12 of 202The Ring programming language version 1.8 book - Part 12 of 202
The Ring programming language version 1.8 book - Part 12 of 202
 
The Ring programming language version 1.9 book - Part 14 of 210
The Ring programming language version 1.9 book - Part 14 of 210The Ring programming language version 1.9 book - Part 14 of 210
The Ring programming language version 1.9 book - Part 14 of 210
 
Quanlycanbo
QuanlycanboQuanlycanbo
Quanlycanbo
 
Magento Dependency Injection
Magento Dependency InjectionMagento Dependency Injection
Magento Dependency Injection
 
Calculadora
CalculadoraCalculadora
Calculadora
 
Awesome State Management for React and Other Virtual-Dom Libraries
Awesome State Management for React and Other Virtual-Dom LibrariesAwesome State Management for React and Other Virtual-Dom Libraries
Awesome State Management for React and Other Virtual-Dom Libraries
 
Mobile Web 5.0
Mobile Web 5.0Mobile Web 5.0
Mobile Web 5.0
 
Magento2&amp;java script (2)
Magento2&amp;java script (2)Magento2&amp;java script (2)
Magento2&amp;java script (2)
 
Elm: give it a try
Elm: give it a tryElm: give it a try
Elm: give it a try
 
Knockout.js Overview
Knockout.js OverviewKnockout.js Overview
Knockout.js Overview
 
Single page webapps & javascript-testing
Single page webapps & javascript-testingSingle page webapps & javascript-testing
Single page webapps & javascript-testing
 
Cycle.js: Functional and Reactive
Cycle.js: Functional and ReactiveCycle.js: Functional and Reactive
Cycle.js: Functional and Reactive
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 
Final tagless and cats mtl
Final tagless and cats mtl Final tagless and cats mtl
Final tagless and cats mtl
 
Aplikasi rawat-inap-vbnet
Aplikasi rawat-inap-vbnetAplikasi rawat-inap-vbnet
Aplikasi rawat-inap-vbnet
 
Coding website
Coding websiteCoding website
Coding website
 
Everyday's JS
Everyday's JSEveryday's JS
Everyday's JS
 
Windows Azure 2/8 - Recursos básicos do Windows Azure
Windows Azure 2/8 - Recursos básicos do Windows AzureWindows Azure 2/8 - Recursos básicos do Windows Azure
Windows Azure 2/8 - Recursos básicos do Windows Azure
 
Command-Oriented Architecture
Command-Oriented ArchitectureCommand-Oriented Architecture
Command-Oriented Architecture
 
2018年のXamarinの概要と活用方法
2018年のXamarinの概要と活用方法2018年のXamarinの概要と活用方法
2018年のXamarinの概要と活用方法
 

Andere mochten auch (18)

Palestra de Dado Schneider
 Palestra de Dado Schneider  Palestra de Dado Schneider
Palestra de Dado Schneider
 
Digital Storytelling
Digital StorytellingDigital Storytelling
Digital Storytelling
 
analisis financiero
 analisis financiero analisis financiero
analisis financiero
 
Planificacion educativa
Planificacion educativaPlanificacion educativa
Planificacion educativa
 
Preparing the 4 h message for captiol hill
Preparing the 4 h message for captiol hillPreparing the 4 h message for captiol hill
Preparing the 4 h message for captiol hill
 
Sociedades humanas. ob
Sociedades humanas. obSociedades humanas. ob
Sociedades humanas. ob
 
Show Photos
Show PhotosShow Photos
Show Photos
 
Touring dc
Touring dcTouring dc
Touring dc
 
Realmadrid
RealmadridRealmadrid
Realmadrid
 
Southpark
SouthparkSouthpark
Southpark
 
Southpark
SouthparkSouthpark
Southpark
 
Style Seeker App
Style Seeker AppStyle Seeker App
Style Seeker App
 
Pze x4 p_en
Pze x4 p_enPze x4 p_en
Pze x4 p_en
 
Park model
Park modelPark model
Park model
 
2012 collegiate facilitators & ylt
2012 collegiate facilitators & ylt2012 collegiate facilitators & ylt
2012 collegiate facilitators & ylt
 
Chaperone webinar.pptx
Chaperone webinar.pptxChaperone webinar.pptx
Chaperone webinar.pptx
 
Adult orientation
Adult orientationAdult orientation
Adult orientation
 
bio battery ppt
bio battery pptbio battery ppt
bio battery ppt
 

Ähnlich wie Применение шаблона проектирования MVVM при разработке архитектуры Windows Phone 7 приложений

Synapse india reviews sharing chapter 23 – asp.net-part2
Synapse india reviews sharing  chapter 23 – asp.net-part2Synapse india reviews sharing  chapter 23 – asp.net-part2
Synapse india reviews sharing chapter 23 – asp.net-part2Synapseindiappsdevelopment
 
Mastering Oracle ADF Bindings
Mastering Oracle ADF BindingsMastering Oracle ADF Bindings
Mastering Oracle ADF BindingsEuegene Fedorenko
 
Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for XamarinGet the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for XamarinXamarin
 
A test framework out of the box - Geb for Web and mobile
A test framework out of the box - Geb for Web and mobileA test framework out of the box - Geb for Web and mobile
A test framework out of the box - Geb for Web and mobileGlobalLogic Ukraine
 
Taking Apache Camel For a Ride
Taking Apache Camel For a RideTaking Apache Camel For a Ride
Taking Apache Camel For a RideBruce Snyder
 
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)Eyal Vardi
 
Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Alfredo Morresi
 
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo Ali Parmaksiz
 
JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"GeeksLab Odessa
 
OL4JSF - Latinoware 2010
OL4JSF - Latinoware 2010OL4JSF - Latinoware 2010
OL4JSF - Latinoware 2010Robert Anderson
 
Daniel Jalkut - dotSwift 2019
Daniel Jalkut - dotSwift 2019Daniel Jalkut - dotSwift 2019
Daniel Jalkut - dotSwift 2019DanielJalkut
 
[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM patternNAVER Engineering
 
Building Apps with Flutter - Hillel Coren, Invoice Ninja
Building Apps with Flutter - Hillel Coren, Invoice NinjaBuilding Apps with Flutter - Hillel Coren, Invoice Ninja
Building Apps with Flutter - Hillel Coren, Invoice NinjaDroidConTLV
 

Ähnlich wie Применение шаблона проектирования MVVM при разработке архитектуры Windows Phone 7 приложений (20)

Synapse india reviews sharing chapter 23 – asp.net-part2
Synapse india reviews sharing  chapter 23 – asp.net-part2Synapse india reviews sharing  chapter 23 – asp.net-part2
Synapse india reviews sharing chapter 23 – asp.net-part2
 
Mastering Oracle ADF Bindings
Mastering Oracle ADF BindingsMastering Oracle ADF Bindings
Mastering Oracle ADF Bindings
 
Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for XamarinGet the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin
 
JavaScript Refactoring
JavaScript RefactoringJavaScript Refactoring
JavaScript Refactoring
 
Synapse india dotnet development web approch
Synapse india dotnet development web approchSynapse india dotnet development web approch
Synapse india dotnet development web approch
 
Mate
MateMate
Mate
 
A test framework out of the box - Geb for Web and mobile
A test framework out of the box - Geb for Web and mobileA test framework out of the box - Geb for Web and mobile
A test framework out of the box - Geb for Web and mobile
 
Taking Apache Camel For a Ride
Taking Apache Camel For a RideTaking Apache Camel For a Ride
Taking Apache Camel For a Ride
 
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)
 
Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)
 
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
 
Django quickstart
Django quickstartDjango quickstart
Django quickstart
 
Unit testing with mock libs
Unit testing with mock libsUnit testing with mock libs
Unit testing with mock libs
 
JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"
 
OL4JSF - Latinoware 2010
OL4JSF - Latinoware 2010OL4JSF - Latinoware 2010
OL4JSF - Latinoware 2010
 
Daniel Jalkut - dotSwift 2019
Daniel Jalkut - dotSwift 2019Daniel Jalkut - dotSwift 2019
Daniel Jalkut - dotSwift 2019
 
[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern
 
Prototype UI
Prototype UIPrototype UI
Prototype UI
 
Building Apps with Flutter - Hillel Coren, Invoice Ninja
Building Apps with Flutter - Hillel Coren, Invoice NinjaBuilding Apps with Flutter - Hillel Coren, Invoice Ninja
Building Apps with Flutter - Hillel Coren, Invoice Ninja
 
Eclipse Tricks
Eclipse TricksEclipse Tricks
Eclipse Tricks
 

Kürzlich hochgeladen

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 

Kürzlich hochgeladen (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 

Применение шаблона проектирования MVVM при разработке архитектуры Windows Phone 7 приложений

  • 2.          2
  • 3. 3
  • 5. Model View Controller 5
  • 6. Model View DataBinding Presentation Model (ViewModel) 6
  • 7. 7
  • 9. <DataTemplate x:Key="MapTemplate"> <my:Pushpin Location="{Binding Location}" /> </DataTemplate> ... <my:Map Name="map1" Height="494" HorizontalAlignment="Left" Margin="20,6,0,0" VerticalAlignment="Top" Width="444" Center="{Binding MapCenter, Mode=TwoWay}" ZoomLevel="{Binding MapZoomLevel, Mode=TwoWay}"> <my:MapItemsControl x:Name="ListOfItems" ItemTemplate="{StaticResource MapTemplate}" ItemsSource="{Binding LocationDataCollection}"> </my:MapItemsControl> </my:Map> 9
  • 10.    <StackPanel Orientation="Horizontal" Height="22"> <Label Width="50"> Options: </Label> <Button x:Name="Search" Width="100" Command="{Binding SearchCommand}" >Search</Button> </StackPanel> 10
  • 11. public class SearchCommand : ICommand { private ViewModel viewModel; public SearchCommand(ViewModel viewModelInstance) { viewModel = viewModelInstance; } #region ICommand Members public bool CanExecute(object parameter) { return true; } public event EventHandler CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public void Execute(object parameter) { viewModel.Search(); } #endregion 11 }
  • 12.      http://unity.codeplex.com 12 
  • 13. IUnityContainer Container = new UnityContainer(); if (ViewModelBase.IsInDesignModeStatic) { Container.RegisterType<IDataService,Design.DesignDataService>(); } else { Container.RegisterType<IDataService, DataService>(); } Container.RegisterType<MainViewModel> (new ContainerControlledLifetimeManager()); 13
  • 14. 14
  • 15. 15
  • 16.       16
  • 17.   <phone:PhoneApplicationPage x:Class="MvvmLiteRTM.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:vm="clr-namespace:MvvmLiteRTM.ViewModel" DataContext="{Binding Main, Source={StaticResource Locator}}" shell:SystemTray.IsVisible="True“> 17
  • 18.   <Button Content=“ZoomIn" Height="72" Name=“ZoomInButton"> <i:Interaction.Triggers> <i:EventTrigger EventName="Click"> <cmd:EventToCommand Command="{Binding ZoomInCommand}"/> </i:EventTrigger> </i:Interaction.Triggers> </Button> 18
  • 19.   RelayCommand ZoomOutCommand = new RelayCommand( () => { MapZoomLevel--; } ); 19
  • 20. View View Messages ViewModel ViewModel View Messages + callback ViewModel 20
  • 21.   private void SendMessageWithCallback() { Messenger.Default.Send(new NotificationMessageAction<string>( "Hello, call me back", SendMessageCallback)); } private void SendMessageCallback(string message) { ... } 21
  • 22. private NotificationMessageAction<string> _lastMessage; public void MessageRecipient() { Messenger.Default.Register<NotificationMessageAction<string>>( this, m => { MessageTextBox.Text = m.Notification; _lastMessage = m; // Execute callback with parameter _lastMessage.Execute(MessageTextBox.Text); }); } 22
  • 23. http://ultralightmvvm.codeplex.com/  http://mvvmlight.codeplex.com/  http://catel.codeplex.com/  http://caliburnmicro.codeplex.com/  23 http://www.japf.fr/silverlight/mvvm/index.html
  • 24. 24
  • 25.          25
  • 26.      26
  • 27. View Feature View Model IFeature Injection 27
  • 29. 29
  • 30.       30
  • 31.    http://create.msdn.com  http://silverlight.codeplex.com/   Model-View-ViewModel (MVVM) Explained  WPF Apps With The Model-View-ViewModel Design Pattern - Josh Smith  http://nrumyantsev.com/  me@nrumyantsev.com 31

Hinweis der Redaktion

  1. -Does not have a presenter, has a controller-Request first comes to controller, binds the model with the view-Logic is stored in controller
  2. -State and Logic stored in Presenter-Presenter is an abstraction of view, Presenter unaware of view-View is aware of Presenter, however isolated from Model
  3. -State and Logic stored in Presenter-Presenter is an abstraction of view, Presenter unaware of view-View is aware of Presenter, however isolated from Model-Uses WPF and Silverlight bindings-A very loose coupling between view and viewmodel, very easy to write unit tests-Growing in popularity (several toolkits MVVM Light, Prism, Caliburn)-Used internally at Microsoft during Expression Blend creation
  4. -CanExecute determines if the command can be invoked on the current command target-Execute determines the command action to be performed-CanExecuteChanged event is raised when the command manager detects a change in the command source
  5. -Uses the System.Windows.Interactivity namespace
  6. -Avoid having to write separate class for commands, and implementing Icommand-lamba expression as an action
  7. -allows you to send messages between view models-possible to open up filtered channels (to target types/interfaces)
  8. -the sender sends a string message with a parameter of type NotificationMessageAction&lt;string&gt;-the callback parameter is a string
  9. -The recipient registers to receive a message of type NotificationMessageAction-The Notification property of the NotificationMessageAction type contains the string message-The recipient executes the sender’s callback with a string parameter
  10. -CheckBeginInvokeOnUI excepts Action parameter-Also contains UIThreadDispatrcher property in case you need to do other work on the UI thread.