@@ -12,14 +12,6 @@ namespace eShopOnContainers.Services
1212{
1313 public class NavigationService : INavigationService
1414 {
15- protected Application CurrentApplication
16- {
17- get
18- {
19- return Application . Current ;
20- }
21- }
22-
2315 public Task InitializeAsync ( )
2416 {
2517 if ( string . IsNullOrEmpty ( Settings . AuthAccessToken ) )
@@ -38,32 +30,9 @@ public Task NavigateToAsync<TViewModel>(object parameter) where TViewModel : Vie
3830 return InternalNavigateToAsync ( typeof ( TViewModel ) , parameter ) ;
3931 }
4032
41- public Task NavigateToAsync ( Type viewModelType )
42- {
43- return InternalNavigateToAsync ( viewModelType , null ) ;
44- }
45-
46- public Task NavigateToAsync ( Type viewModelType , object parameter )
47- {
48- return InternalNavigateToAsync ( viewModelType , parameter ) ;
49- }
50-
51- public async Task NavigateBackAsync ( )
52- {
53- if ( CurrentApplication . MainPage is CatalogView )
54- {
55- var mainPage = CurrentApplication . MainPage as CatalogView ;
56- await mainPage . Navigation . PopAsync ( ) ;
57- }
58- else if ( CurrentApplication . MainPage != null )
59- {
60- await CurrentApplication . MainPage . Navigation . PopAsync ( ) ;
61- }
62- }
63-
64- public virtual Task RemoveLastFromBackStackAsync ( )
33+ public Task RemoveLastFromBackStackAsync ( )
6534 {
66- var mainPage = CurrentApplication . MainPage as CustomNavigationView ;
35+ var mainPage = Application . Current . MainPage as CustomNavigationView ;
6736
6837 if ( mainPage != null )
6938 {
@@ -74,9 +43,9 @@ public virtual Task RemoveLastFromBackStackAsync()
7443 return Task . FromResult ( true ) ;
7544 }
7645
77- public virtual Task RemoveBackStackAsync ( )
46+ public Task RemoveBackStackAsync ( )
7847 {
79- var mainPage = CurrentApplication . MainPage as CustomNavigationView ;
48+ var mainPage = Application . Current . MainPage as CustomNavigationView ;
8049
8150 if ( mainPage != null )
8251 {
@@ -90,31 +59,31 @@ public virtual Task RemoveBackStackAsync()
9059 return Task . FromResult ( true ) ;
9160 }
9261
93- protected virtual async Task InternalNavigateToAsync ( Type viewModelType , object parameter )
62+ private async Task InternalNavigateToAsync ( Type viewModelType , object parameter )
9463 {
9564 Page page = CreatePage ( viewModelType , parameter ) ;
9665
9766 if ( page is LoginView )
9867 {
99- CurrentApplication . MainPage = new CustomNavigationView ( page ) ;
68+ Application . Current . MainPage = new CustomNavigationView ( page ) ;
10069 }
10170 else
102- {
103- var navigationPage = CurrentApplication . MainPage as CustomNavigationView ;
71+ {
72+ var navigationPage = Application . Current . MainPage as CustomNavigationView ;
10473 if ( navigationPage != null )
10574 {
10675 await navigationPage . PushAsync ( page ) ;
10776 }
10877 else
10978 {
110- CurrentApplication . MainPage = new CustomNavigationView ( page ) ;
79+ Application . Current . MainPage = new CustomNavigationView ( page ) ;
11180 }
11281 }
11382
11483 await ( page . BindingContext as ViewModelBase ) . InitializeAsync ( parameter ) ;
11584 }
11685
117- protected Type GetPageTypeForViewModel ( Type viewModelType )
86+ private Type GetPageTypeForViewModel ( Type viewModelType )
11887 {
11988 var viewName = viewModelType . FullName . Replace ( "Model" , string . Empty ) ;
12089 var viewModelAssemblyName = viewModelType . GetTypeInfo ( ) . Assembly . FullName ;
@@ -123,7 +92,7 @@ protected Type GetPageTypeForViewModel(Type viewModelType)
12392 return viewType ;
12493 }
12594
126- protected Page CreatePage ( Type viewModelType , object parameter )
95+ private Page CreatePage ( Type viewModelType , object parameter )
12796 {
12897 Type pageType = GetPageTypeForViewModel ( viewModelType ) ;
12998 if ( pageType == null )
0 commit comments