Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Prism

962 views

Published on

Realizarea de aplicatii composite folosind Microsoft patterns & practices Prism

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Prism

  1. 1. Microsoft patterns & practicesPRISM<br />Realizarea de aplicatii composite folosind<br />Sebastian Negomireanu<br />
  2. 2. Ceeste Prism?<br />Un set de regulisipractici<br />Colectie de design patterns<br />O implementare “referinta”, cepoate fi usormodificata<br />Un set de exemple “hands-on”<br />
  3. 3. Aplicatiipretabile la PRISM<br /><ul><li>Aplicatiimodulare Silverlight si/sau WPF</li></li></ul><li>Aplicatiipretabile la PRISM<br /><ul><li>Aplicatiimodulare Silverlight si/sau WPF
  4. 4. Cu maimulte “ecrane”</li></li></ul><li>Aplicatiipretabile la PRISM<br /><ul><li>Aplicatiimodulare Silverlight si/sau WPF
  5. 5. Cu maimulte “ecrane”
  6. 6. Interactiunecomplexa (sibogata) cu utilizatorul</li></li></ul><li>Aplicatiipretabile la PRISM<br /><ul><li>Aplicatiimodulare Silverlight si/sau WPF
  7. 7. Cu maimulte “ecrane”
  8. 8. Interactiunecomplexa (sibogata) cu utilizatorul
  9. 9. Vizualizari multiple de date</li></li></ul><li>Aplicatiipretabile la PRISM<br /><ul><li>Aplicatiimodulare Silverlight si/sau WPF
  10. 10. Cu maimulte “ecrane”
  11. 11. Interactiunecomplexa (sibogata) cu utilizatorul
  12. 12. Vizualizari multiple de date
  13. 13. Aplicatii cu un timp de viata lung (ani), care trebuiesa se adapteze la modificarineprevazute</li></li></ul><li>Arhitecturaaplicatiilor PRISM<br />
  14. 14. Mai clar…<br />
  15. 15. Bootstrapper<br />Clasaresponsabila cu initializarea PRISM:<br />Seteaza Shell-ulcaRootVisual<br />Inregistreaza in containerul DI toateserviciile/elementelecomuneintregiiaplicatii<br />Incarcamodulelesauspecifcastrategia de incarcare<br />Specificaalteinformatiinecesarerulariiaplicatiei (logging, framework exceptions, region adapters etc.)<br />
  16. 16. Dependency Injection<br />Design pattern care ajuta la:<br />Reducereadependintelordintreobiecteindependente<br />Ajuta la gestiunea lifetime-uluiobiectelorintr-un mod centralizat (per-instance, singleton etc.)<br />IoC/DI<br />Consumer<br />Resolve<br />Register<br />ServiceA<br />Constructor(IService service)<br />IService<br />ServiceB<br />
  17. 17. Dependency Injection<br />
  18. 18. Shell<br />Reprezinta “baza” aplicatiei<br />In mod normal continedoarregiuni<br />Functioneazaca un container pentru UI<br />Regiunilesuntcontinute in containere:<br />ItemsControl<br />TabControl<br />Noicontainere pot fi adaugateprinimplementarea de adaptere (ex. GridView)<br />
  19. 19. Modularitate<br />
  20. 20. Procesul de incarcarea modulelor<br />Module catalog<br />
  21. 21. Partitionare in module<br />
  22. 22. Partitionarepeverticala<br />
  23. 23. Partitionarepeorizontala<br />
  24. 24. Comunicareintre module<br />ModulA<br />Publish<br />Event Aggregator<br />Subscribe<br />ModulB<br />ModulC<br />ModulD<br />
  25. 25. Comunicareintre module<br />ModulA<br />Event<br />Event Aggregator<br />Event<br />Event<br />Event<br />ModulB<br />ModulD<br />ModulC<br />
  26. 26. MVVM<br />Model<br />View<br />ViewModel<br />Services<br />INotifyCollectionChanged<br />INotifyPropertyChanged<br />Interaction<br />View<br />ViewModel<br />Model<br />Notifications<br />Data binding<br />Commands<br />Business<br />Logic<br />Presentation<br />Logic<br />UI<br />(XAML)<br />UI Logic<br />(code behind)<br />
  27. 27. View<br />Element vizual (Window, Page, control, data template etc.)<br />NU are nici un fel de business logic implementat<br />In general reactiv (prin data binding)<br />AcceseazaViewModelprinintermediulDataContext<br />Poateavealogica, darlimitata la UI (ex. declansareanimatii, behaviors etc.)<br />Intotdeaunaruleazapethreadul UI-ului<br />
  28. 28. ViewModel<br />E o clasa non-vizuala<br />Incapsuleazalogica de prezentaresidatelepentru view<br />Expuneproprietatipentru data binding (intotdeaunapetheadul UI-ului)<br />Extindemodelul cu proprietatisimetodespecificelayerului de prezentare<br />Nu are referinta la View si nu are informatiidespreimplementareaspecifica a View-ului<br />Poate fi folosit in comun de view-uridiferite<br />De obiceiimplementeazaINotifyPropertyChangedsi/sauINotifyCollection Changed pentru a suporta data-binding<br />PoateimplementaIDataErrorInfo/INotifyDataErrorInfopentruvalidare<br />
  29. 29. Model<br />Clase non-vizuale care incapsuleaza business-logic-ul<br />Nu au referinta la View sauViewModelsi nu depind de detaliile de implementare<br />De obiceiimplementeazaINotifyPropertyChangedsi/sauINotifyCollection Changed pentru a suportadata-binding siIDataErrorInfo/INotifyDataErrorInfopentruvalidare<br />De obicei se folosescimpreuna cu un serviciusau repository pentrupersistenta, acces la date si caching<br />
  30. 30. Procesul de creare al aplicatiilor<br />Creareproiect Shell<br />Definireregiuni Shell<br />Creare M/V/VM<br />Creare M/V/VM<br />Crearemodulaplicatie<br />Crearemodulaplicatie<br />CreareServicii<br />CreareServicii<br />CreareBootstrapper<br />Crearemodulinfrastructura<br />Definirecomenzi<br />comune<br />Definireevenimentecomune<br />Definirealtetipuri / helperecomune<br />
  31. 31. Definirea Shell-ului<br />View top-level<br />Container marcatcaregiune<br />(cu nume)<br />Elementevizualeglobale<br />(meniuri, toolbar-uri etc.)<br />View-urile pot fi compuse din alte view-uri<br />View-urile pot continealteregiuni<br />
  32. 32. CreareaBootstrapper-ului<br />InstantiazaBootstrapper-ul<br />Initializari, afiseaza Shell-ul, creeazacatalogul de module siincarcamodulele<br />Servicii composite UI (Region Manager, Event Aggregator) siservicii de incarcare a modulelor<br />Fereastra top-level (root visual)<br />
  33. 33. Creareamodulelor<br />Pentruaplicatii desktop: <br /><ul><li>ClassLibrary</li></ul>Pentru SL:<br /><ul><li>ClassLibrary (nu permite download on demand)
  34. 34. Application (permite download on demand</li></ul>Pas optional, pot existacataloage cu functie de discovery<br />
  35. 35. Concluzie<br />PRISM defineste un set de practicisi patterns care ajuta la dezvoltareaaplicatiilor composite<br />Aplicatiile se bazeazape un element central + module (plugins)<br />Modulele pot fi incarcate on demand sauimperativ<br />Modulelelucreaza independent<br />Existamecanismedecuplate care asigura<br />Integrareaelementelor de UI ale modulelor (Region Manager)<br />Comunicareaintre module (Event Aggregator)<br />Declansarea de actiuniintr-un mod generic (Commanding)<br />Notificariindependente de UI (Interaction)<br />Inregistrare/descoperiretipuri (IoC/DI)<br />Separareintre UI (Views), prezentare (ViewModels), logica/domain objects (Models), procese business (Services)<br />
  36. 36. Detalii<br />Prism website<br />http://compositewpf.codeplex.com/<br />Contact<br />http://byteflux.me/<br />http://twitter.com/nseba<br />contact@byteflux.me<br />

×