SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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の概要と活用方法
 

Destacado (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
 

Similar a Применение шаблона проектирования 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
 

Similar a Применение шаблона проектирования 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
 

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Применение шаблона проектирования 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

Notas del editor

  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.