SlideShare a Scribd company logo
Navigation


  Eyal Vardi
  CEO E4D Solutions LTD
  Microsoft MVP Visual C#
  blog: www.eVardi.com
Agenda
           Interaction Request

           State-Based Navigation

           View-Based Navigation




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Interaction Request




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
View Model Codes Sample
        InteractionRequest<Confirmation> action { get; set; }

        action.Raise(
             new Confirmation { Title = "Test II", Content = DateTime.Now },
             x => Date = x.Content.ToString()
        );




        <ei:Interaction.Triggers>
           <prism:InteractionRequestTrigger
               SourceObject="{Binding action}">
               <prism:PopupChildWindowAction
                        ContentTemplate="{StaticResource NT}"/>
        </ei:Interaction.Triggers>




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Interaction in ViewModel




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Interaction in View




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Interaction Request


© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
State-Based Navigation




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
State-Based Navigation


                                                                                 View
                                                           Binding
                                                                                 Model




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
State-Based Navigation




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Data State Behavior
        <i:Interaction.Behaviors>
             <ei:DataStateBehavior Binding="{Binding ShowDetails}" Value="True"
                     TrueState="ShowDetails"
                     FalseState="ShowContacts"/>
        </i:Interaction.Behaviors>

        <VisualStateManager.VisualStateGroups>

             <VisualStateGroup x:Name="DetailStates">

                    <VisualStateGroup.Transitions />

                    <VisualState x:Name="ShowContacts" />
                    <VisualState x:Name="ShowContacts" />

             </VisualStateGroup>

        </VisualStateManager.VisualStateGroups>




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Data State Behavior


© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
View-Based Navigation




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Basic Region Navigation
           The view to be displayed is identified via a URI
                regionManager.RequestNavigate(
                                "MainRegion",
                                new Uri("InboxView", UriKind.Relative) );




           View Registration
                // Unity
                container.RegisterType<object, InboxView>("InboxView");

                // MEF
                [Export("InboxView")]
                public partial class InboxView : UserControl




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
RequestNavigate Method
           The RequestNavigate method also allows you
            to specify a callback method, or a delegate,
            which will be called when navigation is
            complete.

        private void SelectedEmployeeChanged(object sender, EventArgs e)
        {
           ...
           regionManager.RequestNavigate(
             RegionNames.TabRegion, "EmployeeDetails", NavigationCompleted);
        }

        private void NavigationCompleted(NavigationResult result) { ... }




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
INavigationAware Interface
           By implementing this interface, your view or
            view model can opt-in to participate in the
            navigation process.

        public interface INavigationAware
        {
           bool IsNavigationTarget( NavigationContext navigationContext );
           void OnNavigatedTo     ( NavigationContext navigationContext );
           void OnNavigatedFrom   ( NavigationContext navigationContext );
        }




                                                                      IsNavigationTarget
            View I                                                                           View II
             ( Form )           OnNavigatedFrom                              OnNavigatedTo    ( To )

© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Basic Navigation


© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
IRegionMemberLifetime
           Sometimes you will want the deactivated view
            to be removed from the region.


        public class EmployeeDetailsViewModel : IRegionMemberLifetime
        {
           public bool KeepAlive { get { return true; } }
        }




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Passing Parameters During
   Navigation
        Employee employee = Employees.CurrentItem as Employee;

        if (employee != null)
        {
           UriQuery query = new UriQuery();
           query.Add("ID", employee.Id);

             _regionManager.RequestNavigate( RegionNames.TabRegion,
                        new Uri("EmployeeDetailsView" + query.ToString(),
                        UriKind.Relative) );
        }



        public void OnNavigatedTo( NavigationContext navigationContext )
        {
           string id = navigationContext.Parameters["ID"];
        }


© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
IRegionNavigationContentLoader




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Confirming or Cancelling Nav




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
IConfirmNavigationRequest
           The implementation of this method invokes
            the interaction request defined earlier so that
            the user can confirm or cancel the navigation
            operation.

        void IConfirmNavigationRequest.ConfirmNavigationRequest(
                           NavigationContext navContext, Action<bool> callback)
        {
           this.confirmExitInteractionRequest.Raise (
               new Confirmation { Content = "...", Title = "..." },
               c => callback(c.Confirmed)
           );
        }




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Confirming or Cancelling
     Navigation

© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Using the Navigation Journal
           The NavigationContext class provides access
            to the region navigation service.
           The region navigation service implements the
            IRegionNavigationService.

        public interface IRegionNavigationService : INavigateAsync
        {
          IRegion Region {get; set;}
          IRegionNavigationJournal Journal {get;}
          event EventHandler<RegionNavigationEventArgs> Navigating;
          event EventHandler<RegionNavigationEventArgs> Navigated;
          event EventHandler<RegionNavigationFailedEventArgs> NavigationFailed;
        }




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
IRegionNavigationJournal
           The Journal property provides access to the
            navigation journal associated with the region.

        public interface IRegionNavigationJournal
        {
           bool CanGoBack { get; }
           bool CanGoForward { get; }
           IRegionNavigationJournalEntry CurrentEntry { get; }
           INavigateAsync NavigationTarget { get; set; }
           void Clear();
           void GoBack();
           void GoForward();
           void RecordNavigation(IRegionNavigationJournalEntry entry);
        }




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
The Region
   Navigation
   Sequence




© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
Navigation


© 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il

More Related Content

Viewers also liked

ASP.NET MVC Core
ASP.NET MVC CoreASP.NET MVC Core
ASP.NET MVC Core
Eduard Tomàs
 
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
Chen-Tien Tsai
 
Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.
Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.
Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.
Brand Xanh
 
Bài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPT
Bài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPTBài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPT
Bài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPT
MasterCode.vn
 
Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...
Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...
Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...
MasterCode.vn
 
Bài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPT
Bài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPTBài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPT
Bài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPT
MasterCode.vn
 
Bài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPT
Bài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPTBài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPT
Bài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPT
MasterCode.vn
 
Bài 3: Triển khai dịch vụ Active Directory - Giáo trình FPT
Bài 3: Triển khai dịch vụ Active Directory - Giáo trình FPTBài 3: Triển khai dịch vụ Active Directory - Giáo trình FPT
Bài 3: Triển khai dịch vụ Active Directory - Giáo trình FPT
MasterCode.vn
 
Bài 2 Cài đặt Windows Server 2008 - Giáo trình FPT
Bài 2 Cài đặt Windows Server 2008 - Giáo trình FPTBài 2 Cài đặt Windows Server 2008 - Giáo trình FPT
Bài 2 Cài đặt Windows Server 2008 - Giáo trình FPT
MasterCode.vn
 
Bài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPT
Bài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPTBài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPT
Bài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPT
MasterCode.vn
 
OLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSEOLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSE
Zalpa Rathod
 

Viewers also liked (11)

ASP.NET MVC Core
ASP.NET MVC CoreASP.NET MVC Core
ASP.NET MVC Core
 
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
 
Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.
Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.
Hướng dẫn cài đặt windows server 2008 cơ bản cho người mới bắt đầu.
 
Bài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPT
Bài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPTBài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPT
Bài 4: Triển khai Active Directory: Quản trị nhóm - Giáo trình FPT
 
Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...
Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...
Bài 8: Triển khai bảo mật sử dụng chính sách nhóm (Group policy) - Giáo trình...
 
Bài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPT
Bài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPTBài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPT
Bài 5: Triển khai AD – Quản trị tài khoản máy tính - Giáo trình FPT
 
Bài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPT
Bài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPTBài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPT
Bài 6: Triển khai hạ tầng chính sách nhóm (GP) - Giáo trình FPT
 
Bài 3: Triển khai dịch vụ Active Directory - Giáo trình FPT
Bài 3: Triển khai dịch vụ Active Directory - Giáo trình FPTBài 3: Triển khai dịch vụ Active Directory - Giáo trình FPT
Bài 3: Triển khai dịch vụ Active Directory - Giáo trình FPT
 
Bài 2 Cài đặt Windows Server 2008 - Giáo trình FPT
Bài 2 Cài đặt Windows Server 2008 - Giáo trình FPTBài 2 Cài đặt Windows Server 2008 - Giáo trình FPT
Bài 2 Cài đặt Windows Server 2008 - Giáo trình FPT
 
Bài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPT
Bài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPTBài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPT
Bài 7: Quản trị người dùng thông qua chính sách nhóm - Giáo trình FPT
 
OLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSEOLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSE
 

Similar to Prism Navigation

Asp.Net Mvc Internals &amp; Extensibility
Asp.Net Mvc Internals &amp; ExtensibilityAsp.Net Mvc Internals &amp; Extensibility
Asp.Net Mvc Internals &amp; Extensibility
Eyal Vardi
 
Asp.net mvc internals & extensibility
Asp.net mvc internals & extensibilityAsp.net mvc internals & extensibility
Asp.net mvc internals & extensibility
Eyal Vardi
 
Coherence 12.1.2 Live Events
Coherence 12.1.2 Live EventsCoherence 12.1.2 Live Events
Coherence 12.1.2 Live Events
harvraja
 
Triggers, actions & behaviors in XAML
Triggers, actions & behaviors in XAMLTriggers, actions & behaviors in XAML
Triggers, actions & behaviors in XAML
Eyal Vardi
 
Mvc & java script
Mvc & java scriptMvc & java script
Mvc & java script
Eyal Vardi
 
SignalR
SignalRSignalR
SignalR
Eyal Vardi
 
Web api crud operations
Web api crud operationsWeb api crud operations
Web api crud operations
Eyal Vardi
 
Net conf BG xamarin lecture
Net conf BG xamarin lectureNet conf BG xamarin lecture
Net conf BG xamarin lecture
Tsvyatko Konov
 
OID Install and Config
OID Install and ConfigOID Install and Config
OID Install and Config
Vigilant Technologies
 
iPhone - web development lotus notes domino
iPhone - web development lotus notes dominoiPhone - web development lotus notes domino
iPhone - web development lotus notes domino
dominion
 
JavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
JavaCro'14 - Building interactive web applications with Vaadin – Peter LehtoJavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
JavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Android101 : Introduksjon til Android
Android101 : Introduksjon til AndroidAndroid101 : Introduksjon til Android
Android101 : Introduksjon til Android
Truls Jørgensen
 
Présentation et bonnes pratiques du pattern MVVM - MIC Belgique
Présentation et bonnes pratiques du pattern MVVM - MIC BelgiquePrésentation et bonnes pratiques du pattern MVVM - MIC Belgique
Présentation et bonnes pratiques du pattern MVVM - MIC Belgique
Denis Voituron
 
EWD 3 Training Course Part 14: Using Ajax for QEWD Messages
EWD 3 Training Course Part 14: Using Ajax for QEWD MessagesEWD 3 Training Course Part 14: Using Ajax for QEWD Messages
EWD 3 Training Course Part 14: Using Ajax for QEWD Messages
Rob Tweed
 
Async & Parallel in JavaScript
Async & Parallel in JavaScriptAsync & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
 
HTML5 on Mobile
HTML5 on MobileHTML5 on Mobile
HTML5 on Mobile
Adam Lu
 
112815 java ee8_davidd
112815 java ee8_davidd112815 java ee8_davidd
112815 java ee8_davidd
Takashi Ito
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
Yoann Gotthilf
 
Creating an Uber Clone - Part XXIV - Transcript.pdf
Creating an Uber Clone - Part XXIV - Transcript.pdfCreating an Uber Clone - Part XXIV - Transcript.pdf
Creating an Uber Clone - Part XXIV - Transcript.pdf
ShaiAlmog1
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
Mahmoud Hamed Mahmoud
 

Similar to Prism Navigation (20)

Asp.Net Mvc Internals &amp; Extensibility
Asp.Net Mvc Internals &amp; ExtensibilityAsp.Net Mvc Internals &amp; Extensibility
Asp.Net Mvc Internals &amp; Extensibility
 
Asp.net mvc internals & extensibility
Asp.net mvc internals & extensibilityAsp.net mvc internals & extensibility
Asp.net mvc internals & extensibility
 
Coherence 12.1.2 Live Events
Coherence 12.1.2 Live EventsCoherence 12.1.2 Live Events
Coherence 12.1.2 Live Events
 
Triggers, actions & behaviors in XAML
Triggers, actions & behaviors in XAMLTriggers, actions & behaviors in XAML
Triggers, actions & behaviors in XAML
 
Mvc & java script
Mvc & java scriptMvc & java script
Mvc & java script
 
SignalR
SignalRSignalR
SignalR
 
Web api crud operations
Web api crud operationsWeb api crud operations
Web api crud operations
 
Net conf BG xamarin lecture
Net conf BG xamarin lectureNet conf BG xamarin lecture
Net conf BG xamarin lecture
 
OID Install and Config
OID Install and ConfigOID Install and Config
OID Install and Config
 
iPhone - web development lotus notes domino
iPhone - web development lotus notes dominoiPhone - web development lotus notes domino
iPhone - web development lotus notes domino
 
JavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
JavaCro'14 - Building interactive web applications with Vaadin – Peter LehtoJavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
JavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
 
Android101 : Introduksjon til Android
Android101 : Introduksjon til AndroidAndroid101 : Introduksjon til Android
Android101 : Introduksjon til Android
 
Présentation et bonnes pratiques du pattern MVVM - MIC Belgique
Présentation et bonnes pratiques du pattern MVVM - MIC BelgiquePrésentation et bonnes pratiques du pattern MVVM - MIC Belgique
Présentation et bonnes pratiques du pattern MVVM - MIC Belgique
 
EWD 3 Training Course Part 14: Using Ajax for QEWD Messages
EWD 3 Training Course Part 14: Using Ajax for QEWD MessagesEWD 3 Training Course Part 14: Using Ajax for QEWD Messages
EWD 3 Training Course Part 14: Using Ajax for QEWD Messages
 
Async & Parallel in JavaScript
Async & Parallel in JavaScriptAsync & Parallel in JavaScript
Async & Parallel in JavaScript
 
HTML5 on Mobile
HTML5 on MobileHTML5 on Mobile
HTML5 on Mobile
 
112815 java ee8_davidd
112815 java ee8_davidd112815 java ee8_davidd
112815 java ee8_davidd
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Creating an Uber Clone - Part XXIV - Transcript.pdf
Creating an Uber Clone - Part XXIV - Transcript.pdfCreating an Uber Clone - Part XXIV - Transcript.pdf
Creating an Uber Clone - Part XXIV - Transcript.pdf
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
 

More from Eyal Vardi

Why magic
Why magicWhy magic
Why magic
Eyal Vardi
 
Smart Contract
Smart ContractSmart Contract
Smart Contract
Eyal Vardi
 
Rachel's grandmother's recipes
Rachel's grandmother's recipesRachel's grandmother's recipes
Rachel's grandmother's recipes
Eyal Vardi
 
Performance Optimization In Angular 2
Performance Optimization In Angular 2Performance Optimization In Angular 2
Performance Optimization In Angular 2
Eyal Vardi
 
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
 
Angular 2 NgModule
Angular 2 NgModuleAngular 2 NgModule
Angular 2 NgModule
Eyal Vardi
 
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.xUpgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
Eyal Vardi
 
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time CompilationAngular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time Compilation
Eyal Vardi
 
Routing And Navigation
Routing And NavigationRouting And Navigation
Routing And Navigation
Eyal Vardi
 
Angular 2 Architecture
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 Architecture
Eyal Vardi
 
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.xAngular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
Eyal Vardi
 
Angular 2.0 Views
Angular 2.0 ViewsAngular 2.0 Views
Angular 2.0 Views
Eyal Vardi
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
Eyal Vardi
 
Template syntax in Angular 2.0
Template syntax in Angular 2.0Template syntax in Angular 2.0
Template syntax in Angular 2.0
Eyal Vardi
 
Http Communication in Angular 2.0
Http Communication in Angular 2.0Http Communication in Angular 2.0
Http Communication in Angular 2.0
Eyal Vardi
 
Angular 2.0 Dependency injection
Angular 2.0 Dependency injectionAngular 2.0 Dependency injection
Angular 2.0 Dependency injection
Eyal Vardi
 
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and NavigationAngular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
Eyal Vardi
 
Async & Parallel in JavaScript
Async & Parallel in JavaScriptAsync & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
 
Angular 2.0 Pipes
Angular 2.0 PipesAngular 2.0 Pipes
Angular 2.0 Pipes
Eyal Vardi
 
Angular 2.0 forms
Angular 2.0 formsAngular 2.0 forms
Angular 2.0 forms
Eyal Vardi
 

More from Eyal Vardi (20)

Why magic
Why magicWhy magic
Why magic
 
Smart Contract
Smart ContractSmart Contract
Smart Contract
 
Rachel's grandmother's recipes
Rachel's grandmother's recipesRachel's grandmother's recipes
Rachel's grandmother's recipes
 
Performance Optimization In Angular 2
Performance Optimization In Angular 2Performance Optimization In Angular 2
Performance Optimization In Angular 2
 
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)
 
Angular 2 NgModule
Angular 2 NgModuleAngular 2 NgModule
Angular 2 NgModule
 
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.xUpgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
 
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time CompilationAngular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time Compilation
 
Routing And Navigation
Routing And NavigationRouting And Navigation
Routing And Navigation
 
Angular 2 Architecture
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 Architecture
 
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.xAngular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
 
Angular 2.0 Views
Angular 2.0 ViewsAngular 2.0 Views
Angular 2.0 Views
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
 
Template syntax in Angular 2.0
Template syntax in Angular 2.0Template syntax in Angular 2.0
Template syntax in Angular 2.0
 
Http Communication in Angular 2.0
Http Communication in Angular 2.0Http Communication in Angular 2.0
Http Communication in Angular 2.0
 
Angular 2.0 Dependency injection
Angular 2.0 Dependency injectionAngular 2.0 Dependency injection
Angular 2.0 Dependency injection
 
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and NavigationAngular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
 
Async & Parallel in JavaScript
Async & Parallel in JavaScriptAsync & Parallel in JavaScript
Async & Parallel in JavaScript
 
Angular 2.0 Pipes
Angular 2.0 PipesAngular 2.0 Pipes
Angular 2.0 Pipes
 
Angular 2.0 forms
Angular 2.0 formsAngular 2.0 forms
Angular 2.0 forms
 

Recently uploaded

B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 

Recently uploaded (20)

B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 

Prism Navigation

  • 1. Navigation Eyal Vardi CEO E4D Solutions LTD Microsoft MVP Visual C# blog: www.eVardi.com
  • 2. Agenda  Interaction Request  State-Based Navigation  View-Based Navigation © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 3. Interaction Request © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 4. View Model Codes Sample InteractionRequest<Confirmation> action { get; set; } action.Raise( new Confirmation { Title = "Test II", Content = DateTime.Now }, x => Date = x.Content.ToString() ); <ei:Interaction.Triggers> <prism:InteractionRequestTrigger SourceObject="{Binding action}"> <prism:PopupChildWindowAction ContentTemplate="{StaticResource NT}"/> </ei:Interaction.Triggers> © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 5. Interaction in ViewModel © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 6. Interaction in View © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 7. Interaction Request © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 8. State-Based Navigation © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 9. State-Based Navigation View Binding Model © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 10. State-Based Navigation © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 11. Data State Behavior <i:Interaction.Behaviors> <ei:DataStateBehavior Binding="{Binding ShowDetails}" Value="True" TrueState="ShowDetails" FalseState="ShowContacts"/> </i:Interaction.Behaviors> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="DetailStates"> <VisualStateGroup.Transitions /> <VisualState x:Name="ShowContacts" /> <VisualState x:Name="ShowContacts" /> </VisualStateGroup> </VisualStateManager.VisualStateGroups> © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 12. Data State Behavior © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 13. View-Based Navigation © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 14. Basic Region Navigation  The view to be displayed is identified via a URI regionManager.RequestNavigate( "MainRegion", new Uri("InboxView", UriKind.Relative) );  View Registration // Unity container.RegisterType<object, InboxView>("InboxView"); // MEF [Export("InboxView")] public partial class InboxView : UserControl © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 15. RequestNavigate Method  The RequestNavigate method also allows you to specify a callback method, or a delegate, which will be called when navigation is complete. private void SelectedEmployeeChanged(object sender, EventArgs e) { ... regionManager.RequestNavigate( RegionNames.TabRegion, "EmployeeDetails", NavigationCompleted); } private void NavigationCompleted(NavigationResult result) { ... } © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 16. INavigationAware Interface  By implementing this interface, your view or view model can opt-in to participate in the navigation process. public interface INavigationAware { bool IsNavigationTarget( NavigationContext navigationContext ); void OnNavigatedTo ( NavigationContext navigationContext ); void OnNavigatedFrom ( NavigationContext navigationContext ); } IsNavigationTarget View I View II ( Form ) OnNavigatedFrom OnNavigatedTo ( To ) © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 17. Basic Navigation © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 18. IRegionMemberLifetime  Sometimes you will want the deactivated view to be removed from the region. public class EmployeeDetailsViewModel : IRegionMemberLifetime { public bool KeepAlive { get { return true; } } } © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 19. Passing Parameters During Navigation Employee employee = Employees.CurrentItem as Employee; if (employee != null) { UriQuery query = new UriQuery(); query.Add("ID", employee.Id); _regionManager.RequestNavigate( RegionNames.TabRegion, new Uri("EmployeeDetailsView" + query.ToString(), UriKind.Relative) ); } public void OnNavigatedTo( NavigationContext navigationContext ) { string id = navigationContext.Parameters["ID"]; } © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 20. IRegionNavigationContentLoader © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 21. Confirming or Cancelling Nav © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 22. IConfirmNavigationRequest  The implementation of this method invokes the interaction request defined earlier so that the user can confirm or cancel the navigation operation. void IConfirmNavigationRequest.ConfirmNavigationRequest( NavigationContext navContext, Action<bool> callback) { this.confirmExitInteractionRequest.Raise ( new Confirmation { Content = "...", Title = "..." }, c => callback(c.Confirmed) ); } © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 23. Confirming or Cancelling Navigation © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 24. Using the Navigation Journal  The NavigationContext class provides access to the region navigation service.  The region navigation service implements the IRegionNavigationService. public interface IRegionNavigationService : INavigateAsync { IRegion Region {get; set;} IRegionNavigationJournal Journal {get;} event EventHandler<RegionNavigationEventArgs> Navigating; event EventHandler<RegionNavigationEventArgs> Navigated; event EventHandler<RegionNavigationFailedEventArgs> NavigationFailed; } © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 25. IRegionNavigationJournal  The Journal property provides access to the navigation journal associated with the region. public interface IRegionNavigationJournal { bool CanGoBack { get; } bool CanGoForward { get; } IRegionNavigationJournalEntry CurrentEntry { get; } INavigateAsync NavigationTarget { get; set; } void Clear(); void GoBack(); void GoForward(); void RecordNavigation(IRegionNavigationJournalEntry entry); } © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 26. The Region Navigation Sequence © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il
  • 27. Navigation © 2010 E4D LTD. All rights reserved. Tel: 054-5-767-300, Email: Eyal@E4D.co.il