Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PRISM

 PRISM

PRISM course for ITI intake 35

Avatar for Mohamed Massoud

Mohamed Massoud

April 19, 2015
Tweet

More Decks by Mohamed Massoud

Other Decks in Programming

Transcript

  1. Course outline  What is Prism  Benefits of using

    Prism  How to get Prism  How is works
  2. What is PRISM  Composite application framework  Break down

    large applications to smaller modules  Targets is WPF ,Silverlight and windows phone  Built on some design patterns Like ???  Built on separation of concern and loose coupling
  3. Benefits  Reuse when you build module you can reuse

    it  Cross platforms that you can reuse modules between Silverlight and WPF  Extensible  Fixable  Replace component in Run time
  4. How to build PRISM application  Shell  Regions 

    Module Modules will contain number of ?  Views (build by MVVM)  BootStrapper it can build by using MefBootstrapper or UnityBootStrapper
  5. Prerequisites for PRISM  XAML  DataBinding  Resources 

    Commands  Dependency Property  Behaviors  MVVM
  6. Hello World Example  Create Shell  Create BootStrapper with

    MefBootstrapper  Initialize shell  ConfigureAggregateCatalog  Add regions to shell  Create hello world module using MVVM and MEF and inject view to the shell region  Inject module to AggregateCatalog
  7. Regions  There is built in regions like content and

    items regions  We can create our custom region  To do that I have to derive from RegionAdapterBase<T>  Implement CreateRegion method  Single Active region  All Active region  Region  Implement Adpat method  Register to bootstrapper
  8. Communicate Between Modules  Loosely coupled events. A module can

    broadcast that a certain event has occurred. Other modules can subscribe to those events so they will be notified when the event occurs. Loosely coupled events are a lightweight manner of setting up communication between two modules; therefore, they are easily implemented. However, a design that relies too heavily on events can become hard to maintain, especially if many events have to be orchestrated together to fulfill a single task. In that case, it might be better to consider a shared service.  Shared services. A shared service is a class that can be accessed through a common interface. Typically, shared services are found in a shared assembly and provide system-wide services, such as authentication, logging, or configuration.  Shared resources. If you do not want modules to directly communicate with each other, you can also have them communicate indirectly through a shared resource, such as a database or a set of web services.
  9. CompositeCommand  Usually global command  Local command register to

    it  When invoke all child commands invoke  Supports enablement